hamed8419215
Member level 5
Hi to all (Salam)
I want to read from internal EEPROM of a PIC16F876A.
I wrote a function for read and also a function to write.
The write function works fine but the read function does not work.
these are my functions (In mikroC PRO):
I also debug it with Proteus. in read function EEADR always filled with 0xA1 not with EEReadAddress.:?
I want to read from internal EEPROM of a PIC16F876A.
I wrote a function for read and also a function to write.
The write function works fine but the read function does not work.
these are my functions (In mikroC PRO):
I wrote these function just like PIC16F87xA data sheet.//---------Read EEPROM--------//
char ReadEEPROM(char EEReadAddress)
{
EEADR=EEReadAddress;
EEPGD_bit=0;
RD_bit=0;
asm nop;
return(EEDATA);
}
//--------Write EEPROM--------//
void WriteEEPROM(char EEWriteAddress, char EEPROMData)
{
EEADR=EEWriteAddress;
EEDATA=EEPROMData;
EEPGD_bit=0;
WREN_bit=1;
EECON2=0x55;
EECON2=0xAA;
WR_bit=1;
WREN_bit=0;
while(WR_bit)
{
asm nop;
}
}
I also debug it with Proteus. in read function EEADR always filled with 0xA1 not with EEReadAddress.:?