Shop OBEX P1 Docs P2 Docs Learn Events
Wierd debug thingy — Parallax Forums

Wierd debug thingy

GICU812GICU812 Posts: 289
edited 2008-11-24 00:22 in BASIC Stamp
I am working on this project, to get right down to it, Im getting a number added to a variable that shouldnt be.
I should be toggling from dec 4 to dec 0 and back. Instead, im getting 515. Its a binary thing, the variable is a 16 bit word, each bit representing the status of a device.

Well in trying to figure this out, I found that I am getting debug output that isnt anywhere in my code. I've hacked the code up in looking for this, so dont look to much into the messyness, but Ive replaced "on" and "off" with "oneee" and "offeee", The words "on" and "off" do not appear anywhere in the debug code now. Yet, im getting "on" and "off" in the debug window at the same time my variable is getting messed up. Odd huh?

Heres the debug output I get when its working:

beep
3
2
98
98
·3oneeeoffeeee
goinghere
welcome
Temp = %0000000000000100
backStatus = %0000000000000100
test

Heres what I get when the varaible gets corrupted

beep
3
2
98
99
·3off
status = 515
=0000001000000011

Just now I noticed there is a problem in the good output, "oneeeoffeee" its irrelevant, I probably messed up the if-then, its irrelevant in my problem. You see in the second output, I get "3off", yet unless im missing something, the word "off" is nowhere in the program anymore

Ideas?

Comments

  • GICU812GICU812 Posts: 289
    edited 2008-11-23 23:22
    AHAH!

    Thats interesting.

    Its a multislot program, as you can see. Well I removed slot 1 and therefore, slot 2 became slot 1. Slot 2 no longer exists in the program, but its still in the Stamps' EEPROM because it does not erase unused slots. But I never changed the POLLRUN 2

    So when the program activated from the POLLRUN command, it went to the old program in slot 2, but when it was triggered by the timer, it ran the correct slot 1.

    Its odd the IDE would not check that you were POLLRUN-ing a valid slot, since it calls slot 2, which technically doesnt exist in the program.

    So, problem solved.

    Thanks for looking though.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-23 23:37
    (1) You show us the code for Slot 0 (POLLRUN0), and for Slot 1 (POLLRUN2), but not for Slot 2. Did you mean to have a program POLLRUN1 in Slot 1, and POLLRUN2 in Slot2, instead of the way you actually have it? Your Slot 0 code has both a "Run 1" and a "Pollrun 2" statement, so maybe you've got old code in Slot 2 and are executing it with the Pollrun. Perhaps you meant to specify code for both Slots 1 and 2 in the $STAMP declaration in your POLLRUN0 -- but you didn't.

    (2) The variable lists for the Slots you show us don't have the same variables. One of them has word variable "Status" where the other has word variable "Tracker". These will interfere with each other, and I'll bet there's something interfering in Slot 2, too. You must declare the same variables, with the same sizes, in the same order, in all Slots.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-23 23:38
    Ah, I see you found it while I was writing. Cheers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • GICU812GICU812 Posts: 289
    edited 2008-11-24 00:22
    Yea, thanks though. Had the program left in slot 2 been so simular (just an earlier version) it would have been much easier to figure out. But as it is, it acted almost just like it should have. Confused me for about an hour.
Sign In or Register to comment.