Hi all
I have a little problem with a small routine reading serial eeprom 24c65
The idea is get a string from memory (readi2c command) and put
the data over serial line via serout command
The problem is that the pbp no handle strings very well, the data
I want o read a sinlge line from the memory
the i2c memory looks like this…
org 000
Db “string one”,0
Dc “string two”,0
Db “string …”,0 … and so on.
The last ‘0’ is for know when the string is ending
I have used a 8051 assembler to generate the hex image burned in the eeprom
And my code is..
'Direccion is word all others vars are byte sized
'String is my array
mainloop:
for k = 0 to 50 '50 lines?????????
gosub readline 'read 1 line
hserout [str string\20,10,13] 'print message???
pause 100
next k ' no reset direccion
hserout ["End ",10,13]
pause 3000
goto mainloop
readline:
dirarray = 0 'reset pointer char to 0 (the array)
lineloper:
i2cread porta.2,porta.1,$a0,direccion,[j] 'read char
if (j=0 ) then doneline '0 = end of line
dirarray = direccion
string[dirarray] = j 'make string
direccion = direccion +1 'inc addr
pause 100
goto lineloper 'next char
doneline:
direccion = direccion +1 'skip the enf of line (0)
return 'we done
I have setup the hyperterminal correctly but, I can only see the same line ‘string one’ again , and again
Anyone know, what is wrong….?
Thanks in advance
Bookmarks