program Eeprom
dim counter as byte ' loop variable
main:
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
C1ON_bit = 0 ' Disable comparators
C2ON_bit = 0
PORTB = 0
PORTC = 0
PORTD = 0
TRISB = 0
TRISC = 0
TRISD = 0
for counter = 0 to 31 ' Fill data buffer
EEPROM_Write(0x80+counter, counter) 'Write data to address 0x80+ii
next counter
EEPROM_Write(0x02,0xAA) ' Write some data at address 2
EEPROM_Write(0x50,0x55) ' Write some data at address 0150
Delay_ms(1000) ' Blink PORTB and PORTC diodes
PORTB = 0xFF ' to indicate reading start
PORTC = 0xFF
Delay_ms(1000)
PORTB = 0x00
PORTC = 0x00
Delay_ms(1000)
PORTB = EEPROM_Read(0x02) ' Read data from address 2 and dis
play
it on PORTB
' Read data from address 0x50 and dis
PORTC = EEPROM_Read(0x50)
play it on PORTC
Delay_ms(1000)
for counter = 0 to 31 ' Read 32 bytes block from address
0x100
PORTD = EEPROM_Read(0x80+counter) ' and display data on PORTC
Delay_ms(100)
next counter
end.