I forget to point out one thing  when i use the sdcc version 2.6.3 it compile successfull but the data was not written on the eeprom.When the same code compiled with sdcc 2.6.0 then it work successfully,data is written on the eeprom.Is this a bug of sdcc 2.6.3.If it is abug of that version plz inform me

On 1/25/07, george john <az.j.george@gmail.com > wrote:

#define __16f877A
void WriteByteToEE(unsigned char d, const unsigned char ad);
void main(void)
 WriteByteToEE( 0x45,0x01);

void WriteByteToEE(unsigned char d, const unsigned char ad)
    EEADR  = ad;                          // Address to write to
    EEDATA = d;                           // Data to write
    WREN   = 1;                             // Enable writes to the EEProm
    GIE    = 0;                             // Disable interrupts during write
    EECON2 = 0x55;                          // Write "password" to EECON2
    EECON2 = 0xAA;
    WR     = 1;                             // Initiate a write cycle
    while(WR==1)                 //while loop
    WREN   = 0;             // Wait for write to complete                        
    EEIF   = 0;             // Disable writes to EEProm


This is a c code which write the data to eeprom .But it doesn't work.
When this code is written in asm it works well.