Пробвам с примери от интернет но нещо не се пулучава

. ето един от тях.
unsigned char adcData,a=0;
unsigned char adc;
unsigned char i=0,j,k=0;
//----------------------Lecture du eeprom fonction------------------------------
unsigned char readEEPROM(unsigned char address)
{
EEADR = address; //Address to be read
EECON1.EEPGD = 0;//Selecting EEPROM Data Memory
EECON1.RD = 1; //Initialise read cycle
return EEDATA; //Returning data
}
//----------------------Ecriture dans eeprom fonction---------------------------
void writeEEPROM(unsigned char address, unsigned char datas)
{
unsigned char INTCON_SAVE;//To save INTCON register value
EEADR = address; //Address to write
EEDATA = datas; //Data to write
EECON1.EEPGD = 0; //Selecting EEPROM Data Memory
EECON1.WREN = 1; //Enable writing of EEPROM
INTCON_SAVE=INTCON;//Backup INCON interupt register
INTCON=0; //Diables the interrupt
EECON2=0x55; //Required sequence for write to internal EEPROM
EECON2=0xAA; //Required sequence for write to internal EEPROM
EECON1.WR = 1; //Initialise write cycle
INTCON = INTCON_SAVE;//Enables Interrupt
EECON1.WREN = 0; //To disable write
while(PIR2.EEIF == 0)//Checking for complition of write operation
{
asm nop; //do nothing
}
PIR2.EEIF = 0; //Clearing EEIF bit
}
//----------------------------Interruption externe------------------------------
//------------------stockage position servo dans l Eeprom-----------------------
void interrupt() // Interrupt ISR
{
INTCON.INTF=0; // Clear the interrupt 0 flag
writeEEPROM(k,adcData);k++;
//j=k/4;
}
//----------------------------Programme principale------------------------------
void main()
{
//-----------------------Configuration des modules------------------------------
OSCCON = 1<<IRCF2|1<<IRCF1|1<<IRCF0; // IRCF<2:0>: 111 = 8Mz
ANSEL = 0x01; // Configure AN0 pins as analog
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
OPTION_REG.INTEDG = 1; // Set Rising Edge Trigger for INT RB0
INTCON.GIE = 1; // Enable The Global Interrupt
INTCON.INTE = 1; // Enable INT
ADCON1 = 0x80; // Configuration Register ADC
ADC_Init(); // Initialisation ADC
TRISA= 0b00000001; // Configuration IO
TRISB= 0b00000001; // Configuration IO
TRISC= 0b00000011; // Configuration IO
porta=0; // Initialisation port A
portb=0; // Initialisation port B
portc=0; // Initialisation port C
do
{
//-----------------------------mode apprentissage-------------------------------
if(PORTC.F0==1 )
{
// 1er channel
PORTC.F2=1;PORTC.F3=0;
adcData = ADC_Read(0)*0.25;
PORTB.F1 = 1; // Rising edge of pulse
Delay_us(1000);
for(i=0; i<adcData; i++)
{
Delay_us(1);
}
PORTB.F1 = 0; // Falling edge of pulse
Delay_ms(2);
}
//-------------------------------mode automatique-------------------------------
if(PORTC.F1==1)
{
PORTC.F3=1;PORTC.F2=0;
a=0; //Initialisation ariable adresse EEprom
for(j=0;j<k;j++) //Lecture des valeurs stock? dans EEPROM
{
// 1er servo
adc = readEEPROM(a); //Lecture valeur servo 1 du EEPROM
PORTB.F1 = 1; // Rising edge of pulse//PWM g?n?rer
Delay_us(1000);
for(i=0; i<adc; i++)
{
Delay_us(1);
}
PORTB.F1 = 0; // Falling edge of pulse
Delay_ms(100);
a+=1; //Incr?mentation addresse EEPROM
}
}
}while(1);
}