Shop OBEX P1 Docs P2 Docs Learn Events
SERIN/SEROUT with READ/WRITE or GET/PUT or STORE? — Parallax Forums

SERIN/SEROUT with READ/WRITE or GET/PUT or STORE?

Christina KellerChristina Keller Posts: 8
edited 2005-06-24 13:57 in BASIC Stamp
I am using a BS2p24 to input, format, and output data from a GPS to a device that takes in ASCII and prints it over video (XBOB/Basic Overlay Board). I am using SERIN and SEROUT to transfer the data, but I am running out of variable or EEPROM room. I really just need more of one or the other: if I had more variables I would need less prg. space; if I had more prg. space I could reuse the variables more. I know about the 128 Scratchpad and the 8x2K bytes and external EEPROMs, but they seem to do me no good with SERIN and SEROUT (Those commands want variables, not READor GET). Or maybe I am not accessing them right? And what is up with the 8: are there really 8 EEPROMs in there? Can I get to them without READ/WRITE? or Maybe there are other ways to output serial data srtaight from the Scrtachpad or these mysterious 8 EEPROMS that I can't seem to access??

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-21 14:06
    Christina,

    ·· The SPSTR·function can be used to grab a string from SERIN and drop it into the scratchpad RAM.· Please see the help file under SEROUT for usage.· As for the mysterious 8 EEPROM slots, I had never heard it put quite that way.· But if you look up in the help file under the RUN command, you'll get some information on using these extra slots of memory.· Another place to get information on multiple EEPROM slots is the·Nuts & Volts·Column #87 (Multi-Bank Programming), which is available from our website as a free download.· Click Downloads\Nuts & Volts Columns\Volume 3.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-06-21 16:52
    The source of the "8 eeprom slots" is that the original PIC16C57 based BS2 design that Parallax created their PBasic run-time library for only had 2 KBytes of EEPROM. Now, larger EEPROM's are available, but the run-time library is limited in its addressing to 2K. So what you gonna do?

    What you do is use a 16 K eeprom, but treat it like 8 2K eeproms, and use the 'run' option to switch between them. This preserves your old run-time library, yet gives you LOTS more memory for your programs.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-21 17:16
    Christina,

    How much data are you wanting to RX and display on your video overlay?· If you're using a standard GPS string like $GPRMC then buffering it into the Scratchpad and parsing it after is the way to go.· If you happen to be using a Garmin eTrex GPS, you can switch to formatted text output mode and capture data into variables on-the-fly.· I've done this with a BS2 (code attached).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Christina KellerChristina Keller Posts: 8
    edited 2005-06-23 15:52
    I think the RUN command is my best bet to solve the space issue. Ideally, I would like to have 3 or 4 completely or mostly seperate programs that the user can choose from with input switches. I have read the Nuts and Volts multi bank article, but I am confused: The sample program in there uses two RAM scratchpad slots, or banks: 0 and 1. I think I would like to use the EEPROM solts 0-7 to free my scrathpad up for GPS data. How do I go about accesing those slots? In the manual it says you need to download the different programs into the desired slots, and they seem to be different files, but I can't fiigure out how to do that (it won't let me save the "subroutine" files, or differnt programs, as
    [noparse][[/noparse]subroutine]1tongue.gifrg1.bs2
    for example, the way it is in the book.) However, the Nuts and Volts example appears to be all one file. Is that because it only uses RAM? Do I need to do some external wiring to access the different EEPROM slots??
  • Christina KellerChristina Keller Posts: 8
    edited 2005-06-23 15:54
    stupid auto format smiley face: I meant ": p"
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-23 16:41
    What are you going to do with the GPS data. Store it? That would be a good use for Slots 1 - 7. But for buffering and processing, you're going to have to do it on the fly (you can using fixed 2400 baud format) or buffer it in the Scratchpad and parse the data out later. I've done both processes for different projects -- both techniques are explained in my Nuts & Volts articles.

    I have only once run out of program space in a single slot -- turned out to be a GPS datalogger for my boss's model airplane. The program needed to store the data, the "print" it (using DEBUG) in a formatted fashion so we could pull it into Excel very easily.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Christina KellerChristina Keller Posts: 8
    edited 2005-06-23 16:52
    I am not going to store the GPS data. As soon as I get it in I will format it and send it SEROUT to the device that writes it over video. I my program to have the option (user decided) to use either one of NMEA GPS (one that outpus at 4800 baud and the other at 96 baud) or a GAMA GPS, and maybe even another one. They all have slightly differnt formeats, even the NMEA ones cuz one includes more decimal places than the others which makes usign the SPSTR a bit tircky. I actually have all the programs working seperately, like I can run one at a time, but I want to get them all on there and the user can decide which one to run. Is there a way to do that with the RUN command? Is seems like there should be, but I can't figure out how to access it. Maybe there is something in the editor that I can tell which program slot to put each one in since the default is 0?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-23 18:42
    If you're just going to receive and reformat then I think you should use the SPRAM as a buffer for the GPS string, parse it as required, and then send data to your video overlay unit. I have used the SPSTR with GPS strings that vary in length -- usually I didn't need anything from the end so I truncated a bit; you could also buffer more characters than you need and catch a bit of the next string.

    What you might consider is using Slot 0 as a simple menu program which launches Slot 1 or Slot 2 depending on what the user wants to do. That way you can keep the programs separate and conserve variable space.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Christina KellerChristina Keller Posts: 8
    edited 2005-06-23 19:51
    Yes, that is a good idea. That is what I want to do. But I can't figure out HOW to get the launch-able programs into Slot 1 or 2, etc. The book is kinda vague, and the help syntax doesn't tell me how to go about getting the programs called with the RUN command into their appropriate slots. It seems like there should be a button on the editor or maybe some hard-wiring to do? Or do I actually write it into the code with something like PUT? (But PUT only puts stuff in RAM right, not EEPROM?)

    Thanks for your help thus far, though.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-23 20:38
    Slots are actually loaded via the $STAMP directive (See chapter 3 of the manual).· In short, here's what you would do it you had three programs: Menu.BSP (for slot 0), GPS1.BSP (for slot 1), and GPS2.BSP (for slot 2).

    Put this declaration in Menu.BSP:

    ' {$STAMP BS2p, GPS1.BSP, GPS2.BSP}

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Christina KellerChristina Keller Posts: 8
    edited 2005-06-24 13:57
    Thanks so much. I got it running!
Sign In or Register to comment.