Correct use of READ and WRITE with word variables?

free1000

New Member
I'm struggling with some of the descriptions in the manual.

I'd like to store some WORD sized data in the EEPROM area of a 28X so I've been looking at the manual entries for WORD READ and WRITE. I don't want to use an external EEPROM, there are plenty of ic2 examples for this, but I don't want to go down that route as my data storage requirements are pretty minimal

There aren't any code examples for writing and reading word data, so I'm a bit unsure about how to use the syntax

WRITE location, data, data, WORD wordvariable

and

READ location, data, data, WORD wordvariable

I'd expect to have a bit of code that looked something like

main :

' set value of word variable
w0 = 1234

' write word variable data to 2 byte locations in EEPROM
WRITE somewhere, b0, b1, WORD w0

end


Is there a brief code example somewhere that could show me how to do this?
 

eclectic

Moderator
Hope this is correct!

#picaxe 28X
w0 = 12345
w1 = 2345
write 0,WORD w0
write 3,WORD w1

pause 1000

read 0,WORD w3
sertxd ("Location 0 = ", #w3,cr,lf)
read 3,WORD w4
sertxd ("Location 3 = ", #w4,cr,lf)

This syntax checks correctly and works in the simulaor.

e.
 
Last edited:

free1000

New Member
#picaxe 28X
w0 = 12345
w1 = 2345
write 0,WORD w0
write 3,WORD w1

pause 1000

read 0,WORD w3
sertxd ("Location 0 = ", #w3,cr,lf)
read 3,WORD w4
sertxd ("Location 3 = ", #w4,cr,lf)

This syntax checks correctly and works in the simulaor.

e.
Cheers I'll try it. I've tried several other variations with no success.
 
Top