SERIN right into SPRAM
Moskog
Posts: 554
While trying to limit the number of varables, to save RAM, I would like to PUT the bytes received by the SERIN command right into locations of the SPRAM.
This is the way I do it today:
firstVariable var word
secondVariable var word
thirdvariable var word
SERIN RX, Baud, [noparse][[/noparse]firstVariable, secondVariable, thirdVariable]
PUT 0, firstVariable
PUT 1, secondVariable
PUT 2, thirdVariable
So, is there a better way to put the values into the SPRAM without spending Words?
·
This is the way I do it today:
firstVariable var word
secondVariable var word
thirdvariable var word
SERIN RX, Baud, [noparse][[/noparse]firstVariable, secondVariable, thirdVariable]
PUT 0, firstVariable
PUT 1, secondVariable
PUT 2, thirdVariable
So, is there a better way to put the values into the SPRAM without spending Words?
·
Comments
firstVariable var word
secondVariable var word
thirdvariable var word
SERIN RX, Baud, [noparse][[/noparse]firstVariable, secondVariable, thirdVariable]
PUT 0, Word firstVariable
PUT 2, Word secondVariable
PUT 4, Word thirdVariable
Well, thank you Mike for reply, I see the SPSTR formatter in the manual. There isn't much information on the formatter there. I can see what it is, at page 404 (manual 2.2) but I can't find no additional explanation later in the chapter. But I see examples where other formatters are placed within SERIN commands so I guess I should give it a try.
SERIN RX, Baud, [noparse][[/noparse]firstVariable, secondVariable, thirdVariable]
PUT 0, Word firstVariable
PUT 2, Word secondVariable
PUT 4, Word thirdVariable
This can be replaced with the following line:
SERIN RX, Baud, [noparse][[/noparse] SPSTR 48]
The SPSTR 48 puts the 3 incoming Words into the SPRAM starting at location 0.
So I can read the firstVariable.HIGHBYTE out of location 0, firstVariable.LOWBYTE out of location 1 and so on.
But I won't do that because what I wanted to do was to limit the RAM used for variables to minimum.. but now I can declare just one variable and use it several times.
Thanks Mike Green for leading me into the right direction (again)!