Shop OBEX P1 Docs P2 Docs Learn Events
GET - PUT with BS2pe — Parallax Forums

GET - PUT with BS2pe

TumblerTumbler Posts: 323
edited 2008-11-05 03:48 in BASIC Stamp
Hello,

I'm trying to write a gps sentence to my usb mem. stick.
First i write it into the scratchpad ram with this code:

SERIN GPSpin,Baud,2000, No_GPS_Data,[noparse][[/noparse]WAIT("$GPRMC"),SPSTR 64]

Is it possible to write the whole SPRAM into the USBstick in one string? or do i have to read each byte of the SPRAM and write it into the stick?


·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-04 05:38
    1) You do need to figure out the length of the GPS sentence you've read

    2) You could use SPSTR to write the GPS string from the scratchpad ram

    3) I don't know how large the buffer is inside the Vinculum chip, but that may limit how much data can be written at a time. The firmware manual for the Vinculum chip may have that information.
  • TumblerTumbler Posts: 323
    edited 2008-11-04 06:49
    Mike,

    I decided to write the sentence into the eeprom first, to avoid many writings to the usb stick.

    i need max 64 bytes for one sentence. One eeprom bank memory is 2048 bytes.
    So i can use 32 sentences in one bank.
    
    
    y=y+1
    if y=32 then WRITE_TO_STICK
    
    GET_GPS_SENTENCE        'read valid sentence and store in into SPRAM
    DEBUG DEC2 y,":"        ' sample n°
      FOR x = 0 TO 51       'i need only the first 51 bytes to store
       GET x, char          ' read source byte
        DEBUG char
        WRITE (y*64)+x, char ' write byte to target slot
      NEXT
      DEBUG CR
    NEXT
    


    Here i store 32 times (0-31) a sentence into the eeprom (bank 1)
    As you can see i make a loop to read the bytes from SPRAM
    can it be done more easier? i mean, reading 51 bytes in one command?
    This command is not working: GET 0,SPSTR 51
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-11-04 07:26
    Bytes have to come from the scratchpad one at a time and then to the stick. No equivalent for SPSTR on output.

    If the string is 64 bytes,

    LOW vrts   ' necessary to fake receive ready while sending 
     SEROUT vtx\vcts, vBaud, [noparse][[/noparse] $8,$20,0,0,0,64,CR]
     FOR idx=0 TO 63
        GET idx, char
        SEROUT vtx\vcts, vBaud, [noparse][[/noparse]char]    ' with flow control
     NEXT
    HIGH vrts
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TumblerTumbler Posts: 323
    edited 2008-11-05 03:48
    Ok thanks Tracey.

    I tried that too earlier, but forgot to count the CR·LF chars to count. freaked.gif
    But it works now.
    ·
Sign In or Register to comment.