Shop OBEX P1 Docs P2 Docs Learn Events
Programitcally Sending Serial Commands — Parallax Forums

Programitcally Sending Serial Commands

Keith MyersKeith Myers Posts: 3
edited 2006-04-04 00:08 in BASIC Stamp
I know the basic stamp is limited on memory, so I got to thinking...

Would there be a way to only send fractions of a program to the stamp "Behind the Scenes". Any examples (VB Express 2006) Would be great

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-04-03 10:39
    Create packets and have the BasicStamp echo the received packet for verification.

    I am not exactly sure what you have in mind as 'fractions of a program'. You would have to create a 'higher command language' and use that with the communications. PBasic would pretty much interpret what you send.

    In some ways, you would be mimicing what PBasic already does.
    Alternatively, there is a 'field programmer' that can change between several programs without the aide of a PC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-03 12:23
    In the "olden days", they called these "overlays" or "load modules". Memory was tight back then, so you'd have a 'common' area which always stayed in memory, then another area into which you could swap in "load modules" when needed, and get additional functionality.

    For this to work, your run-time environment must support it. The BS2 run-time environment does NOT support this. The BS2p chips, with their larger eeprom, do support a multi-page environment, though.

    And it makes sense that it does not support it. Why would you purchase a nice, small, reliable, real-time module, only to hang additional memory off of it to 'swap in' code overlays? Who could afford to waste that much time?

    Oh, and having said that, since I believe the BS2 can write its own eeprom memory, in theory this WOULD be possible.· In practice, it might be amazingly awkward.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-04-03 13:10
    Allan -

    Just a bit of a correction. Any of the PBASIC Stamps based on the Ubicom SX chips are capable of multi-bank programming. This includes, but is not limited to, the BS-2p series, as the BS-2SX and BS-2e are also capable of being multi-bank programmed.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-03 14:07
    There's no problem of receiving a new program on the serial port and dumping it into another Program Slot on a BS2p or newer. (Not certain if the BS2sx allows a program in one slot to overwrite another slot).

    BUT, and this is important, it must be complete programs of 2KB, not just bits of them.

    Writing the PC-based code, though... Sorry, but I don't use VB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Keith MyersKeith Myers Posts: 3
    edited 2006-04-03 16:16
    I need to be more clear... Please see the diagram below






    Visual Basic(GUI)
    > User Selects Option
    >Send PreTokenized code "Behind the secenes"

    ·
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-03 17:36
    As long as that 'pretokenized code' is a complete 2KB block, that shouldn't be a problem with a BS2p or other BS2 which allows one program to overwrite another program slot.

    Just keep the 'master' program which does the receiving and starting of the other programs in slot 0.

    Of course, if you don't know in beforehand what the 'pretokenized code' will be, then your VB program will have to assemble it into a source, based on the user's selections, and feed it through the tokenizer DLL first. A bit more difficult, but still doable.

    You may want to add a bit of logic in your system(either an option sent from the VB program, or in the program in Slot 0) which rotates which slot the new program is loaded into.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Keith MyersKeith Myers Posts: 3
    edited 2006-04-03 19:41
    I was more or less looking to complile it with pbasic then use a Visual Basic Program to send it (The .tok file) the problem is that I am not sure how... Can some one scratch up a small example
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-04 00:08
    Downloading instructions can be found on our web site: http://www.parallax.com/html_pages/downloads/tokenizer/tokenizer.asp

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.