READ returns random values?
philipad23
Posts: 44
Hi all
I have te following code that enters values to be stored to EEPROM. After the values are stored they are all displayed. The problem is that I get deifferent values from those I enter.
' {$STAMP BS2}
' {$PBASIC 2.5}
datrcv VAR Word
romindxstr VAR Byte
k VAR Byte
main:
SERIN 16, 84, Timeout, [noparse][[/noparse]DEC datrcv]
WRITE romindxstr,Word datrcv
romindxstr=romindxstr+1
FOR k=0 TO romindxstr-1
READ k, Word datrcv
DEBUG ? datrcv
NEXT
GOTO main
timeout:
DEBUG "timeout"
GOTO main
Anyone can help me?
I have te following code that enters values to be stored to EEPROM. After the values are stored they are all displayed. The problem is that I get deifferent values from those I enter.
' {$STAMP BS2}
' {$PBASIC 2.5}
datrcv VAR Word
romindxstr VAR Byte
k VAR Byte
main:
SERIN 16, 84, Timeout, [noparse][[/noparse]DEC datrcv]
WRITE romindxstr,Word datrcv
romindxstr=romindxstr+1
FOR k=0 TO romindxstr-1
READ k, Word datrcv
DEBUG ? datrcv
NEXT
GOTO main
timeout:
DEBUG "timeout"
GOTO main
Anyone can help me?
Comments
WRITE 2*romindxstr,Word datrcv
romindxstr=romindxstr+1
FOR k=0 TO romindxstr-1
READ 2*k, Word datrcv
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com