Friday, January 2, 2009

MikroC Code for reading and writing data into EEPROM

<---Previous Tutorial

Here is an example program showing how to read and write into EEPROM ,This program first writes 0x80 into the address 0x00 and the reads and displays it in portb .

unsigned short data = 0x80,address=0x00;

void main() {
PORTB = 0x00;
TRISB = 0x00;

EEprom_Write(address,data); //writes 0x80 into the location 0x00
Delay_ms(20); //insert 20 ms delay between every read and write cycle
PORTB = Eeprom_Read(address); //reads the data from 0x00 and send it to portb
Delay_ms(500);
}

1 comment:

Saurabh said...

Thanks...
Really simple program.
Well explained