Shop OBEX P1 Docs P2 Docs Learn Events
storing of data in serin — Parallax Forums

storing of data in serin

JuliusJulius Posts: 8
edited 2007-01-17 15:06 in BASIC Stamp
I have a string of GPS signal, that I need to store in a variable before I transmit serout via a bluetooth device
to the desktop.

The GPS signal consist of around 50 characters, but I can't seem to store them properly. Below is the code:



bdata VAR Byte(26)

SERIN 8,240,[noparse][[/noparse]STR bdata\26]
'DEBUG STR bdata,CR
SEROUT 1,240,[noparse][[/noparse]STR bdata\26]

GOTO main


I can't seem to declare more than 26 bytes space for bdata. Is there another way of storing 50 characters?


Thank you!

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2007-01-16 13:26
    What has worked for me (with a BS2) is to use SERIN to read in the first 25 chars and resend that batch to the PC. Then use a second SERIN with the SKIP directive to jump over the first 25 chars and grab the next batch. Send that to the PC. Note that this technique requires waiting for two GPS transmissions to get a whole string. With fast updates (or slow movement!) its not usually an issue.

    Or, use a BS2sx which has 63 bytes of scratchpad memory in which you can store a whole string before sending to the the PC.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • JuliusJulius Posts: 8
    edited 2007-01-16 15:03
    Hmm.. I shall go check out the scratchpad memory.... so it is a store it in kind of like the serin command I use?
    I'm using tbe Bs2sx.
  • stamptrolstamptrol Posts: 1,731
    edited 2007-01-16 15:12
    OK, you're halfway t here!

    Grab 25 characters with a SERIN command and use the PUT command in a loop to put each character into the scratch pad.

    Use a second SERIN with SKIP as described above and grab a second 25 characters. Again, use a loop with PUT to load each character into the scratchpad, being careful not to overwrite what you already put there.

    Then use a loop with a GET command to send the string out with a SEROUT to the PC.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-16 15:42
    If you use a BS2p/pe/px, you can use the SPSTR formatter with the SERIN statement. This directly stores the input into the scratchpad memory.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-16 15:54
    Julius,

    Tom has provided a solution for the BS2sx. If you should get a BS2p series I can post the code we use to input an NMEA string into the SPRAM. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • JuliusJulius Posts: 8
    edited 2007-01-17 09:00
    Yea, I got it out thanks. Now I must make sense of the NMEA strings and soon get outdoors to retrieve some satellite signals.

    is there a way to re-declare variables after i run the "retrieve GPS" subroutine?

    So I can free up RAM for other variables in the program.

    Thanks!
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-17 15:06
    It's not quite "re-declaring" variables, but you can declare alternate names for the same variables. Look at "alias" in the PBasic Manual (page 87 ?). It is commonly used for re-using variables.
Sign In or Register to comment.