Shop OBEX P1 Docs P2 Docs Learn Events
Quick Question — Parallax Forums

Quick Question

ElementElement Posts: 9
edited 2007-03-07 03:45 in BASIC Stamp
Alright, I just made a program with the BS2 module. The program is written for the BS2. I am using is for navigation, and am almost done for those people who read my last topic, and helped me out with it smilewinkgrin.gif. I am using the Parallax QTI's in conjunction with the parallax RFID tags, and reader. It just so happens that I am almost out of memory and was looking into buying the BS2sx module since it can process faster and has a lot more memory. Now the one question I have is, will my program written in the BS2 language work with the BS2sx? Or will i have to re-write the code with the BS2sx's codes. Are the codes the same except they just have more capabilities? Or will it work out perfect and i won't have to change a thing in my program? confused.gif Any help would be useful.

Thanks in advance,
-Element roll.gif

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-07 03:45
    The same program will compile for the BS2sx with the only changes being the constants for some speed related things that are all described in the PBasic manual. In particular, the Baud constants may be different and the timing durations for things like PULSOUT or PULSIN (PAUSE is the same). The PBasic manual does discuss how you can use conditional compilation to make the same program compile for any or all models of Stamp.

    If you're almost out of memory, you have to understand that the larger memory Stamps still have the same 2K limitation for the memory of a program "slot". The difference is that a program may have more than one slot on the larger Stamps. This works a bit like overlays in that two slots can share variables (again consult the PBasic manual for the RUN statement), but it's not like you can call a routine in the "overlay". You can RUN a "slot" from the beginning and can only return to another slot by doing a RUN which again executes the slot from the beginning.

    Frequently, programs can be made much smaller by making subroutines where appropriate, by simplifying code, by making use of tables in EEPROM.
Sign In or Register to comment.