Shop OBEX P1 Docs P2 Docs Learn Events
Help!!! Please — Parallax Forums

Help!!! Please

edited 2005-03-30 18:49 in BASIC Stamp
We are having some trouble with retaining the memory we put into our stamp on the board of education stamp (bs2).· We can load the program onto it, but as soon as we disconnect the serial cable, the program stops and will not retain the program in memory.· Anone know why and how to fix this??? Thanks very much.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-30 16:38
    It would be helpful to see your code. Perhaps your program is waiting on some serial inpu that never comes, hence the appearance is that the program is no longer there (not the case, the program is stored in non-volatile memory).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • edited 2005-03-30 16:42
    Here is the code...Your help would be incredible.


    '{$STAMP BS2}
    '{$PBASIC 2.5}
    ' {$PORT COM3}
    'declare output pins
    push_BUTTON······· PIN 0
    UpRtMotor········· PIN 2
    UpLtMotor········· PIN 3
    LowRtMotor········ PIN 4
    LowLtMotor········ PIN 5
    UpSplitMotor1····· PIN 6
    UpSplitMotor2····· PIN 7
    DownSplitMotor1··· PIN 8
    DownSplitMotor2··· PIN 9
    PositionDealCardMotor·· PIN 10
    DealMotor········· PIN 11
    'RtServos·········· PIN 11
    'LtServos·········· PIN 12
    'WirelessSensor···· PIN 13
    'declare variables needed
    loop_count········ VAR Byte
    OPEN········ CON 1· 'define an alias for the constant 1
    CLOSED······ CON 0· 'define an alias for the constant 0
    'numPlayersIn······ VAR Byte
    '=========================================
    Main:
    GOSUB WaitPush 'call subroutine to wait for the pushbutton
    GOSUB Shuffle
    END

    '==========================================
    'Shuffle the cards - Test
    '==========================================
    WaitPush:
    ······· DO WHILE ( push_BUTTON = OPEN)
    ··········· 'empty loop just waits for pushbutton press
    ······· LOOP
    ······· RETURN

    Shuffle:
    HIGH UpRtMotor
    HIGH UpLtMotor
    HIGH LowRtMotor
    HIGH LowLtMotor
    HIGH UpSplitMotor1
    HIGH UpSplitMotor2
    HIGH DownSplitMotor1
    HIGH DownSplitMotor2
    HIGH PositionDealCardMotor
    HIGH DealMotor

    ······· 'Split cards in half
    ············ LOW UpSplitMotor1
    ············ PAUSE 5000
    ············ HIGH UpSplitMotor1
    ············ LOW UpSplitMotor2
    ············ PAUSE 5000
    ············ HIGH UpSplitMotor2
    ······· 'Shuffle cards first time
    ······· FOR loop_count = 1 TO 3 STEP 1
    ··········· LOW UpRtMotor
    ··········· PAUSE 5000
    ··········· HIGH UpRtMotor
    ··········· LOW UpLtMotor
    ··········· PAUSE 5000
    ··········· HIGH UpLtMotor
    ······· NEXT

    ······· 'Split cards again
    ··········· LOW DownSplitMotor1
    ··········· PAUSE 5000
    ··········· HIGH DownSplitMotor1
    ··········· LOW DownSplitMotor2
    ··········· PAUSE 5000
    ··········· HIGH DownSplitMotor2

    ······· 'Shuffle cards again
    ······· FOR loop_count = 1 TO 3 STEP 1
    ··········· LOW· LowRtMotor
    ··········· PAUSE 5000
    ··········· HIGH LowRtMotor
    ··········· LOW LowLtMotor
    ··········· PAUSE 5000
    ··········· HIGH LowLtMotor
    ········ NEXT
    ···
    'Put cards into dealing position
    ······· LOW PositionDealCardMotor
    ······· PAUSE 5000
    ······· HIGH PositionDealCardMotor

    ··· 'Deal Cards
    ······· LOW DealMotor
    ······· PAUSE 5000
    ······· HIGH DealMotor
    ··· RETURN

    ·········
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-30 16:46
    So the program works when connected to your PC, but not after? Very strange. You might want to hang an LED or two off spare pin(s) to tell you where you are in the program when not connected. For example, You could light an LED when you jump into your WaitPush subroutine and extinguish it when you exit. Do the same (with a different LED or blink it to be different) with the Shuffle routine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • edited 2005-03-30 16:52
    When the serial cable is attached to the board, the program runs perfectly.· However, if the serial cable is removed, the program stops right away. Without touching anything, if the serial cable is touched back to the board again, the program resumes.· Is there some sort of wiring that must be done in order to write to the eeprom or something? ·We dont understand why the stamp will not save the program for use when not connected to the serial cable. Thanks.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-30 17:00
    You problem is peculiar indeed. For clarification, the program ALWAYS runs from the Stamp's EEPROM. When you select Run in the editor, it gets compiled and downloaded (to the EEPROM), then the BASIC Stamp is reset and the program runs. The only thing I can think of is something is holding your Stamp in reset after you unplug the cable. The ATN pin (physical pin 3) should be floating -- check to make sure nothing is connected to it that might cause the Stamp to reset.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • edited 2005-03-30 17:12
    What do you mean by floating, when you say that ATN pin (physical pin 3) should be floating? Also does it matter what setting we have the board in either (1 or 2) to turn it on, when we program the Stamp?
  • edited 2005-03-30 18:06
    We are having some trouble with retaining the memory we put into our stamp on the board of education stamp (bs2).· We can load the program onto it, but as soon as we disconnect the serial cable, the program stops and will not retain the program in memory.· Anone know why and how to fix this??? Thanks very much.
  • edited 2005-03-30 18:06
    What do you mean by floating, when you say that ATN pin (physical pin 3) should be floating? Also does it matter what setting we have the board in either (1 or 2) to turn it on, when we program the Stamp?
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-30 18:49
    I've seen this as a grounding problem before. The PC's serial port can be supplying a ground to your board which makes it work. I don't know how you are trying to drive your motors -- is the motor power supply ground tied to the BS2 ground?

    What power supply are you trying to drive your motors with? What driver chips?

    "Floating" means there is nothing connected to a pin that is set for input. Thus the input 'floats', since it is not connected either to ground or to Vdd. It is also likely that the program HAS been successfully loaded into the chip, it's just hard for you to determine this once you've disconnected the serial cable.

    You might want to put in the start of your program a statement:
    DEBUG [noparse][[/noparse]"The BS2 is Reset", CR]

    This way, every time your chip resets, you'll get a message that it did.
Sign In or Register to comment.