Using PUT & GET
Vern Roach
Posts: 9
Dear Parallax People,
On p.245 of the Stamp Manual in refering to Scratch Pad RAM it says that "...each location is always configured as a byte only."··Can I·do the following? :
····················Value·· VAR·· Byte
··················· PUT 0, Value.LOWBYTE
··················· PUT 1, Value.HIGHBYTE
The Stamp Editor didn't balk when I entered the above lines, but I wanted to be sure.
Vern Roach
·········
On p.245 of the Stamp Manual in refering to Scratch Pad RAM it says that "...each location is always configured as a byte only."··Can I·do the following? :
····················Value·· VAR·· Byte
··················· PUT 0, Value.LOWBYTE
··················· PUT 1, Value.HIGHBYTE
The Stamp Editor didn't balk when I entered the above lines, but I wanted to be sure.
Vern Roach
·········
Comments
· PUT 0, Word value
What the compiler does is generate this code for you:
· PUT 0, value.LOWBYTE
· PUT 1, value.HIGHBYTE
You can also PUT/GET multiple values like this:
· PUT 0, status, Word value
For this the compiler would generate:
· PUT 0, status
· PUT 1, value.LOWBYTE
· PUT 2, value.HIGHBYTE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 11/15/2005 2:13:33 AM GMT
Thanks for being perceptive - Yes, I did mean "Value VAR Word". And thank you for elaborating on the capabilities of PBASIC 2.5. The ability to use GET & PUT very much like READ & WRITE really takes the restrictions off what might seem like a not-too-large RAM capacity. (To 3rd parties: I'm truly a beginner at this!)
Thanks again
Vern Roach
Put 0, value.lowbyte
Put 1, value.highbyte
actually uses less code space than...
Put 0, word value
·
This is not a problem exactly, just something to be aware of.
-- PJA --
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· The ScratchPad RAM is just that, RAM, and has an unlimited number of write cycles, just as variable space does.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I've learned my lesson now. Sorry about any confusion.
·· While we're getting technical, the EEPROM write life of the BS1 & BS2 is 10,000,000 (Ten Million) writes.· The BS 2e, BS 2sx, BS 2p, and BS 2pe EEPROM is guaranteed for 100,000 write cycles before it wears out.·
Oooh, a donut!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
If I put 4 in, I get 4 out. Seems like double digit numbers dont want·to work right.
Temp1 = 42
PUT 1, Temp1
.
.
.
GET 1, Temp1
DEBUG "Temp1=", DEC Temp1
I've tried...
PUT 1,Temp1.LOWBYTE
PUT 1,Temp1.HIGHBYTE
Nothing seems to work.
Edit: Oh yeah I'm using a BS2P40
Post Edited (HIBITDAC) : 11/18/2005 10:31:23 AM GMT
You failed to mention how Temp1 is defined, WORD, BYTE, NIB? It's always best to include the whole program when asking for assistance on a question like this.
Regards,
Bruce Bates
I've defined as Word...samething, Byte...samething, Nib...samething.
If I...
Temp1 = 38
Put 1 Temp1
Get 1,Temp1
Temp1 = Temp1 / 10
It displays 30, samething with 52 execpt it displays 50. seems like it is adding a zero for no reason.
Post Edited (HIBITDAC) : 11/18/2005 10:41:32 AM GMT