SPSTR L help
Falcon
Posts: 191
I am using this code on a BS2PX-equipped Base Unit to receive six BYTES of data from a remote STAMP, and it's working flawlessly.
However, I'm short on variable space for further development. I'm interested in using the SPSTR L modifier to save this data straight into the SPRAM.
1. Can the SPSTR L modifier be used with the WAIT modifier in the same SERIN statement?
If so, would the following be the correct approach?
2. If I have another SERIN statement further along in the code with the SPSTR L modifier would it over-ride the data written by the previous SERIN statement, or would it write to the next available SPRAM location? Is there a way around for the former outcome?
falcon
SERIN SI\FC, baud, 100, notalk,[WAIT ("Report"), a2dResult0, a2dResult1, a2dResult2, a2dResult3, a2dResult4, a2dResult5] ' Serial In from Remote BS2
However, I'm short on variable space for further development. I'm interested in using the SPSTR L modifier to save this data straight into the SPRAM.
1. Can the SPSTR L modifier be used with the WAIT modifier in the same SERIN statement?
If so, would the following be the correct approach?
SERIN SI\FC, baud, 100, notalk,[WAIT ("Report"), SPSTR 6, a2dResult0, a2dResult1, a2dResult2, a2dResult3, a2dResult4, a2dResult5] ' Serial In from Remote BS2
2. If I have another SERIN statement further along in the code with the SPSTR L modifier would it over-ride the data written by the previous SERIN statement, or would it write to the next available SPRAM location? Is there a way around for the former outcome?
falcon
Comments
No, the 2nd use of SPSTR would overwrite the data from the 1st use and the only way around this is to move the data somewhere else before the 2nd use. You could move it elsewhere in the scratchpad RAM since the SPSTR modifier always starts at location zero of the scratchpad RAM.
You'd leave out the a2dResult0 ... a2dResult5 variables since those bytes go into the scratchpad RAM
That worked like a charm. Required lots of GET statements but I just saved 7 bytes of variable space giving me enough to develop the last phase of my project. And I see a few opportunities to save even more space.
falcon