Shop OBEX P1 Docs P2 Docs Learn Events
PollRun not transfering information — Parallax Forums

PollRun not transfering information

Cruzer_1Cruzer_1 Posts: 2
edited 2010-01-22 16:51 in BASIC Stamp
hello,
i am using a BS2p24 micro in a project of mine.
In this program i am using
POLLIN 2, 1
POLLRUN 1
POLLMODE 4

However when poll run is activated and runs the program in slot one, the information from a variable in slot 0
is not carried through to the program in slot 1.
does any one have any idea on why the program is doing this and is there a solution?
any help will be greatly appreciated. thanks.

-cruzer

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-22 16:51
    The variables in the two slot programs have to be declared in exactly the same order and sizes. That's the only reason why one is not "carried through". When the Stamp is reset, all the variables are initialized to zero. When the Stamp switches from one slot to another, the variables in the Stamp's memory simply stay the way they are. If the two programs refer to the same locations, the values from the first slot will still be there and can be referred to by the 2nd slot's program.

    The Stamp Editor's compiler allocates variables in the order they're declared in the program according to their sizes. I believe words come first, then bytes, then nibbles, then individual bits. If you have extra variables, that can throw things off.

    There's a good explanation of multi-slot programming in one of the Nuts and Volts Columns (maybe #85). Look under the "Resources" tab on the main Parallax webpage. You'll find the link to the Nuts and Volts Columns index.
Sign In or Register to comment.