' *****************************************************
symbol EEPROMscl = C.3 '
symbol EEPROMsda = C.4 '
' *** Variables ***
symbol MessageData = b3 ; EEPROM data byte
;symbol xxxxxxx= b1 ; RESERVED FOR FUTURE USE
symbol GPCounter = b5 ' General purpose counter variable
' *****************************************************
' *** Directives ***
#picaxe 28x2 ' specify processor
' #no_data ' save time downloading
#terminal off ' disable terminal window after downloading
#terminal 9600 ' open terminal after download
setfreq m16 ' Set processor speed
#com 4 ' Set the download port
' *****************************************************
' *** Main Program ***
' *** LCD messages Table ***
'##########0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444455555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
'##########0000000000011111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
'##########0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
table 0, ("Visualizador LCD 2 x 16 ")
;
GPCounter = 0
;do ; Uncomment this block to make sure i'm using the correct 28x2 pins
; ;pulsout EEPROMscl,1
; ;pause 20
; pulsout EEPROMsda,1
; pause 20
;loop
wait 10 ; wait 10 seconds
gosub EEPROMWrite
wait 10 ; wait 10 seconds
gosub EEPROMRead
end
' *****************************************************
EEPROMRead:
serout a.4, N9600_16, (cr, lf, "Mensaje:", cr, lf)
for GPCounter = 0 to 255
i2cslave %10100000, i2cfast_16, i2cword
readi2c GPCounter, (MessageData)
; serout a.4, N9600_16, (cr, lf,"GPCounter:",#GPCounter," EEPROM:",#MessageData, " (",MessageData,")") ;
serout a.4, N9600_16, (MessageData) ;
pause 10
next GPCounter
pause 100
low EEPROMscl
low EEPROMsda
return
' *****************************************************
EEPROMWrite:
serout a.4, N9600_16, (cr,lf, "Programming ...")
; MessageData = "-" ; Write the "-" character to all memory locations
for GPCounter = 0 to 255
i2cslave %10100000, i2cfast_16, i2cword
readtable GPCounter, MessageData ' read text Characters in the Table
writei2c GPCounter, (MessageData)
pause 10
; serout a.4, N9600_16, (cr,lf, "Writting EEPROM position:",#GPCounter, " with data: ",#MessageData, " (",MessageData,")") ;
next GPCounter
low EEPROMscl
low EEPROMsda
serout a.4, N9600_16, (cr, lf, "Programming done!",cr,lf) ;
return