//
// EEPROM Example
// By PEK '2004
//
// MCU: 16F877
// Clock: 10 MHz
//
// To be used with the CCS compiler
//

#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=10000000)

#rom  0x2100={0x80}  // First position in EEPROM

void main()
{
   int8 value;

   // Read from the first position
   value = read_eeprom(0x00);

   // Show value on port B
   output_b(value);

   // Write to the second position (verify in the programmer software)
   write_eeprom(0x01, value+1);

   while(1);
}
