Shop OBEX P1 Docs P2 Docs Learn Events
Strange stamp reset bug — Parallax Forums

Strange stamp reset bug

UghaUgha Posts: 543
edited 2008-12-01 15:09 in General Discussion
I've got a weird bug I can't figure out and I'd like some advice.

Using the schematics in Nuts and Volts Column #22 I built a matrix keypad using
pushbuttons.

I followed the schematic exactly and included·220 ohm "zap" resistors (which I assume are
for static protection) and 10k pullup resistors.

I put the whole thing on a header that plugs right into the BOE's pins P7-P0 slots... plus
a wire hanging off that plugs into VDD.

I used a slightly simplified version of the code provided in the column and the keypad works
absolutely perfectly. The keys are read and translated exactly as expected and I can read
in the keys and take action based on what is entered.

The problem is after every 2 key presses, the stamp resets.

I've tried using both fresh AAs in the BOE-bot battery pack, and a 9volt with no difference.

I've got both a second BS2 (OEM) connected and a serial LCD on the same BOE but no other
power drain. Not even a single LED.

I tried disconnecting the BOE and LCD, and the same still happens.

Its got to be in my matrix keypad somewhere but I'll be danged if I can figure out where. I
checked every solder joint and there are no bridges anywhere.

Any idea what can be causing the stamp to reset in this case?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-01 05:02
    Usually these "every 2 presses" sort of thing is from a programming error, sometimes a mismatch between GOSUBs and RETURNS.
  • UghaUgha Posts: 543
    edited 2008-12-01 13:30
    Weird. I thought it was a power issue.

    Here's the code I'm using on the master stamp... Please excuse how messy it is.

    I basically just copied and pasted the keypad code and used a simple serial interface from another Nuts and Volts column to get two stamps to communicate. At the moment the communication is one-way so I can safely disable the second stamp for debugging.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-01 14:49
    You've got several subroutines (neck_right, neck_left, head_up, head_down) that end with RETURN, yet are just jumped to using IF THEN <label>. There's nothing to return to and the Stamp obliges by resetting.
  • UghaUgha Posts: 543
    edited 2008-12-01 15:09
    It doesn't return to the next line?

    Your absolutely right. I just dug around in the PBASIC syntax guide and I realize I've been under the incorrect assumption
    that IF... THEN <subroutine> does a GOSUB, instead it does a GOTO. That seems like such a subtle difference... but seems
    to be an important one.

    Thanks Mike.
Sign In or Register to comment.