Shop OBEX P1 Docs P2 Docs Learn Events
Program memory / storage memory with SX chip — Parallax Forums

Program memory / storage memory with SX chip

dufflingduffling Posts: 73
edited 2005-03-21 17:12 in General Discussion
Im moving from basic stamp 2sx to the SX/B , im not sure of how the memory is organized on the SX , does it work in· a similar fashion to the basic stamp 2sx program slots?

or are there different steps to be taken if i require more program storage space?

thanks again.
·

Comments

  • dufflingduffling Posts: 73
    edited 2005-03-21 09:40
    sorry my confusion is from reading the specs for the SX chip

    it says it has·2048 x 12· EEPROM , im very unclear how the RAM and EEPROM are allocated on this chip ..

    does the basic stamp 2sx have an additional eeprom ?·

    slightly confused..

    ·
  • dufflingduffling Posts: 73
    edited 2005-03-21 11:17
    sorry another addition to my question :

    one thing im perplexed about ..

    If the Basic stamp2sx uses the SX chip as does the SX/B system ..········· how does the basic stmp 2sx have 8 x 2k slots of Program memory ?······ when it appears the SX only has 2k?

    i must be missing something very basic here .. so im sorry for that ..

    since im used to the basic stamp 2sx , does the memory work in a similar way on the Sx/b? system ...... im currently filling up almost all the available program slots on my bs2sx after opptimizing everything nicely
    so im going to need the program storage

    currently im switching between program slots .. is a similar approach possible on the SX/b?····· and is a similar scratch pad memory able to be done with the Sx/b


    thanks..
    ·
  • BeanBean Posts: 8,129
    edited 2005-03-21 12:08
    The BS2sx contains an external EEPROM that stores the program and non-volatile data. The SX has FLASH memory to store the program (cannot store runtime non-volatile data unless an external EEPROM is connected).
    If you have the program memory full in a BS2sx, I don't think you are going to get that program to fit into an SX.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-21 14:38
    Duffling, if your code is occupying 16K of tokenized PBASIC, I just dont see how your going to fit that on a single SX. The SX28 has 2K like you mentioned, and the SX48/52 is 4K. Are you truely using 16K of program space or do you have alot of data your storing in there as well, if the latter is the case you can incorperate an external eeprom to store your data in to offload it to make room for the true code. The program space of an SX cannot be expanded, in the past we have talked about workarounds to this but it basically means tokenizing, which is what the Stamp does (though my tokenized forth interpreter runs faster than PBASIC does, I haven't done precise benchmarks, and the difference in languages makes it difficult to compare) but your best bet is to subroutine the heck out of your program.

    An optimized PBASIC program is not the same as an optimized assembly program, with PBASIC creating a loop construct (a for(i=0;i<n;i++) in C) is the same if you count up, count down or count by 3's. In SX assembler there is a command called decsz which decrements a variable and skips the next instruction if the result is zero (there is also an incsz) which means your most efficient method of contructing a loop in assembler is so that it ends on the variable being zero and changes by one for each iteration. Also optimization for speed and optimization for space are entirely different beasts.

    There is something vaguely akin to program slot in the SX but it is quite different, the entire space can be reached within a program unlike a BS slot, but there are restrictions such as you cannot execute a call to an address that has·the 9th bit of its address set, but·there·is a·simple workaround to this.

    Post Edited (Paul Baker) : 3/21/2005 2:59:08 PM GMT
  • dufflingduffling Posts: 73
    edited 2005-03-21 16:55
    ok understood.. but im curious .. how does the basic stamp 2sx manage to allow programs to be stored in slots

    to clarify ..

    i CAN add an eeprom to my SX to store data...... ( i am storing many strings and such in the bs2sx )


    from your experience you have managed to write very serious code within the limits of the SX 2k limit ?

    am i correct in assuming that .. done correctly you can fit quite a complicated program even with SX/B code into the sx memory?

    i also assume that assembly mixed in there will allow even more code to be put inside ..


    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-21 17:12
    duffling said...
    ok understood.. but im curious .. how does the basic stamp 2sx manage to allow programs to be stored in slots

    to clarify ..

    i CAN add an eeprom to my SX to store data...... ( i am storing many strings and such in the bs2sx )

    Yes, Serial EEPROMs can provide you with vast amounts of space for little money (128Kx8 ~$10-$20), a·few I/O pins at speeds that still runs circles around a stamp.


    from your experience you have managed to write very serious code within the limits of the SX 2k limit ?

    Yes, I have not seen anyone complain about lack of program space in an SX in the forums by experienced programmers since I became·active in the forums last July. Though I believe I read a while back·someone migrated to an SX52 for more code space when they found the·SX28 didn't have enough.·

    am i correct in assuming that .. done correctly you can fit quite a complicated program even with SX/B code into the sx memory?

    Yes, look out for the contest submissions that should be posted very soon, or check out Bean's SX-video display module.·

    i also assume that assembly mixed in there will allow even more code to be put inside ..

    Yes, SX/B is an unoptimized basic compiler


Sign In or Register to comment.