Shop OBEX P1 Docs P2 Docs Learn Events
Data directive for memory slots 8-15 on Pe or Px? — Parallax Forums

Data directive for memory slots 8-15 on Pe or Px?

StampUSRStampUSR Posts: 48
edited 2005-07-18 02:15 in BASIC Stamp
Is there a way to assign a compile time value to memory locations in slots 8-15 on a BS2px?

Because you can't put programs in those slots I don't think you can use a DATA directive to assign initial compile time values as desired into those memory slots.

Closest thing I can think of to do this is have a little section of code in slot 0 that checks the value of the byte in slot 0 (assigned to be 0 at compile time) and if it is a 0 changes it to 1 and then saves the appropriate data in the upper slots 8-15. That should work but is kind of ugly and wastes memory as whatever the defaults from the upper slots should be has to be stored in the lower slots.

Comments

  • dandreaedandreae Posts: 1,375
    edited 2005-07-17 03:59
    The BS2px only has 16K of memory which can be used for programming and data collection.· Therefore you only have slots 0 to 7 to work with.· Take a look at the "Data Logger AppNote at this link for more information regarding the slots 8 through 15·using the BS2pe:· http://www.parallax.com/detail.asp?product_id=BS2PE·.



    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 7/17/2005 2:47:02 PM GMT
  • StampUSRStampUSR Posts: 48
    edited 2005-07-17 04:22
    Dave,

    OK, then you have a typo in the PBASIC Syntax Guide under the store command.

    "† Note: On the BS2pe and BS2px, slots 8 - 15 are only available for data (READ and WRITE); they cannot be used to run programs. "

    What happens if you 'Store 8' or 'Store 9' on a PX? Reason I ask is it does end up storing the data somewhere and retrieves it properly. Does it just wrap around back to slot 0 and 1?

    Thanks!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-07-17 06:02
    StampUSR said...(trimmed)
    Is there a way to assign a compile time value to memory locations in slots 8-15 on a BS2px?
    Because you can't put programs in those slots I don't think you can use a DATA directive to assign initial compile time values as desired into those memory slots.
    Hello,

    ·· Actually, you can store values to these slots at compile time.· Please see the RUN command for more information.· The data would actually be in other program files intended for these slots.· The filenames would be included in the STAMP directive on slot 0, and at compile time all the data would be downloaded following the download of the main program in slot 0.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • StampUSRStampUSR Posts: 48
    edited 2005-07-17 13:59
    Chris,

    I have programs in slots 0-7. I was asking based on the documentation that said the px could store data in slots 8-15 but not have programs there. If that was the case I didn't see how you could store values at compile time since you couldn't have programs loaded in 8-15 and therefor couldn't use the DATA directive in those programs.

    But if the PX doesn't really have slots 8-15 then the above is irrelevant.

    Thanks!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-17 14:09
    The BS2px only has eight slots (0 - 7) -- the BS2pe is the only BASIC Stamp with 16 slots. The driving force behind the BS2pe was data collection (low power + lots of EE space).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-07-17 20:42
    Okay, I see...I saw the mentioning of the BS2pe in their and didn't catch the 8-15 banks...Apologies.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-07-18 02:15
    What I'm going to say applies only to the BS2pe, because as Dave and Jon pointed out, it is the only one that has banks 8 to 15.

    It is true that if you are working in the IDE and you already have program slots 0 to 7 and you attempt to add another program, even if you only intend to put DATA for a BS2pe there, the IDE will squack and tell you that you can have no more than 8 total programs assigned to one project. As you surmised, it appears that the only way to get DATA into banks 8 to 15 is by writing a routine in a lower bank that will transfer the DATA, only at run time, not at compile time.

    However, that is not totally true. This may be a bit esoteric, but here goes anyway. {BS2pe only}. The limitation is in the IDE, not in the Stamp. If you write your own downloader (using information contained in the developer documents, or the hack at www.emesys.com/BS2clone.htm), you can work around the limitation and program those banks at download time. In the protocol that programs the Stamp, there is a byte that declares the target bank number for each 2k-byte segment. If you edit that byte to be a number in the range of 8 to 15, the 2k segment will in fact be directed to that bank in the BS2pe. It could be otherwise, so I did test it, by hacking into the code for the Stache field programmer, to make it conditionally redirect slot 0-7 data to slots 8-15. That way, I can do a field upgrade of data tables. Program code too will be transferred, but you can_not_ RUN it in the higher banks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.