Code:
SCL var PortC.5 ' I2C Clock
SDA var PortC.4 ' I2C Data
ROM0 CON $A0 ' EEPROM 0 Address
ADDR VAR word ' ROM Location
MonPort var PortB.7 ' Monitor Port
Mode con 16572 ' 4800 Baud 8N1 for Monitor Port
Test var byte[21] ' Test Array
I2Cdelay con 10 ' Delay after I2Cwrite
Temp var byte
CLEAR
SEROUT2 MonPort,Mode,[13,10,"** MCU started",13,10,13,10]
ADDR=100
I2CREAD SDA,SCL,ROM0,ADDR,[Temp]
IF Temp="*" THEN GOTO SkipWrite
I2CWRITE SDA,SCL,ROM0,ADDR,_
[$2A,$20,$54,$65,$73,$74,$20,$45,$45,$50,$52,$4F,_
$4D,$20,$2D,$2D,$3E,$20,$4F,$4B,$21]
PAUSE I2Cdelay
SEROUT2 MonPort,Mode,["** EEPROM written",13,10,13,10]
GOTO Loop
SkipWrite:
SEROUT2 MonPort,Mode,["** EEPROM write skipped",13,10,13,10]
I2CREAD SDA,SCL,ROM0,addr,[str test\21]
Loop:
SEROUT2 MonPort,Mode,[STR Test\21,13,10]
PAUSE 1000
GOTO Loop
END
Bookmarks