Mikroc Having a EEPROM library .There are only two functions in this library
- Eeprom_Read
- Eeprom_Write
First function Eeprom_Read returns an integer value from the specified address. The following is the syntax .
unsigned short Eeprom_Read(unsigned int address);
Second Function Eeprom_Write takes two parameters address and data .
See syntax given below .
void Eeprom_Write(unsigned int address, unsigned short data);
See the Example programunsigned short data = 0xAA, address=0x00;
void main() {
PORTB = 0x00;
TRISB = 0x00;
//writes 0xAA into the location 0x00
EEprom_Write(address,data);
//insert 20 or 30 ms delay between every read and write cycle
Delay_ms(20);
// the following delay is just for making a feel
Delay_ms(1000);
//reads the data from 0x00 and send it to PORTB
PORTB = Eeprom_Read(address);
Delay_ms(1000);
}
1 comment:
haii, i also use MicroC for my EEPROM programming but the problems is how i want to display EEPROM data in LCD and how to know the data actually in the address? plez help me..
Post a Comment