Shop OBEX P1 Docs P2 Docs Learn Events
Hardware and memory questions — Parallax Forums

Hardware and memory questions

thikyelathikyela Posts: 8
edited 2010-02-24 00:04 in BASIC Stamp
Howdy. I am using a BS2 Homework board for a school project. My program has exceeded the max eeprom space (2K), and I need to upgrade.

There are "Board of Education" Rev B. boards available at my school. They have removable IC chips (they are BS2-ICs, same memory as the one I own). Can I use any of these modules, like the BS2e, in these boards? This one in particular..

http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/9/List/0/SortField/0/Level/a/ProductID/2/Default.aspx

Also, I understand that there is actually, in this particular example, 8 X 2K program 'slots'. Since I use several sub-programs to make up the overall program, can I just move a few into another 'slot', or is it not that simple?

When I load my program into the Basic Stamp Editor, how does it 'know' that eeprom is exceeded? Is it the directive? Because even if i change that, I am still going over some kind of limit. Or is this another instance of the 2K 'slot' being exceeded?

Any help would be greatly appreciated. I can't seem to find specific answers on the parallax site.

Thank you
Scott

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-23 18:39
    1) The Board of Education can be used with any of the Stamp modules including the BS2e that you mentioned.

    2) Each program slot is 2K and should be thought of as an "overlay" area. The way to execute code in another slot is to use the RUN statement which is like a GOTO in that there's no way to return to the place where the RUN was executed.

    3) All programs must fit in 2K. That's the limit that the Stamp Editor is checking.

    There's a good discussion of multi-slot programming in one of the Nuts and Volts Columns (#87).

    www.parallax.com/Resources/NutsVoltsColumns/NutsVoltsVolume3/tabid/445/Default.aspx
  • thikyelathikyela Posts: 8
    edited 2010-02-24 00:04
    Thanks Mike. I see, so I would be able to goto another slot, but only to the beginning, not where I came from, like gosub and return allows. That might work.

    I could also try and tidy up my exceptionally large piece of code. I know it's possible, I'm just not that good at programming.

    For example...

    FOR P = 1 TO 4

    DO

    IF keyready = 1 THEN 'checks if a key is pressed
    GOSUB getkey 'retrieves the new key
    IF Key = PassD(P) THEN ' checks key value against stored password digit (1-4)
    D(P)OK = 1 'sets flag for this iteration's digit (if correct)
    ENDIF
    ENDIF
    LOOP UNTIL Key <> 100 'key needs to be pressed to proceed to next for
    SEROUT LCDpin, baudlcd, [noparse][[/noparse]"*",9] 'shifts a * to the right on LCD to show a key was pressed
    PAUSE 400
    key=100 'changes key back to impossible number
    NEXT P
    IF (D1Ok=1 AND D2ok=1 AND D3ok=1 AND D4ok=1) THEN 'if all numbers match the stored password...

    PULSOUT TimerRESET, 10 'resets timer
    PAUSE 10
    PULSOUT Trigger, 10
    PAUSE 10
    D1ok=0[noparse]:D[/noparse]2ok=0[noparse]:D[/noparse]3ok=0[noparse]:D[/noparse]4Ok=0 'resets digit flags
    RETURN

    ELSE
    GOSUB clearLCD
    SEROUT lcdpin, baudlcd, [noparse][[/noparse]"Incorrect",149, "Password"]
    PAUSE 2000
    D1ok=0[noparse]:D[/noparse]2ok=0[noparse]:D[/noparse]3ok=0[noparse]:D[/noparse]4Ok=0
    GOSUB EnterPass
    ENDIF

    Right now I have a working password checker consisting of a bunch of if thens. I know from other BASIC types of programming you can use a for next loop, which I would like to do. I'm not sure how to get this to work with my program, though. All this basically does is goes and checks PassD1 through PassD4 against the key pressed. It would make my day if I can use the 'P' variable in place of the number (PasssD(P)), and not use 4 separate do loops. Or something to this effect. If anyone with more brains than I can offer a suggestion, I sure could use one.

    Thank you
    Scott
Sign In or Register to comment.