Include "modedefs.bas" @ Device PIC16F877,XT_OSC,WDT_off,PWRT_off,PROTECT_off ,BOD_Off define adc_bits 10 define osc 4 DEFINE LCD_DREG PORTD DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTD DEFINE LCD_RSBIT 1 DEFINE LCD_EREG PORTD DEFINE LCD_EBIT 0 low portD.2 S1 var PORTA.0 sda var portc.4 scl var portc.3 addr var byte cont con %10100000 dat con 45 b0 var byte TRISA = %111111 adcon1 = 7 addr = 2 '---------------- main program ----------------- lcdout $fe,1,"EEPROM 24LC16B" PAUSE 2000 start: if S1= 1 then pause 100 lcdout $fe,1,"WRITE DATA =45" i2cwrite sda,scl,cont,addr,[dat] pause 1000 ENDIF if (s1 = 0) then pause 100 i2cread sda,scl,cont,addr,[b0] pause 1000 lcdout $fe,1,"READ DATA= ",$fe,$8B,dec b0 ENDIF goto stART END