Shop OBEX P1 Docs P2 Docs Learn Events
How to call another slot from the not zero slot? — Parallax Forums

How to call another slot from the not zero slot?

Julien HordiesJulien Hordies Posts: 6
edited 2005-07-15 14:02 in BASIC Stamp
Hello,

I'm doing a program using differents slots and I'd like to call data from the·slot 4 in the slot 3? Is that possible and if yes how do have I to do this?
I'm trying to use the function Store but it does't works. The slots are defined in the principal program running in slot 0 but I can't use the slot 4 from the program running on the slot 3.


Thank you.



Julien Hordies





P.S:Still sorry for my english but I'm still Belgian...

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-07-15 13:42
    Very simple.· Suppose you are in slot 3 and you want to go to slot 4.· In slot 3 you simply write

    RUN 4

    Now then, if you want to go to a special routine in slot 4, for example,
    "dotask4", then in slot 3 you would write

    com = 1 (or whatever number)
    RUN 4

    Then at the very beginning of the slot 4 you would write

    if com = 1 then dotask4

    When you have finished dotask4, then you can write RUN 0, RUN 1, or wherever you want to go.· If you want to go to a special spot then used the same technique.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Julien HordiesJulien Hordies Posts: 6
    edited 2005-07-15 13:46
    I've understood that but what I'm trying to do is to read data from the slot 4 and to compare it with other data that I read in slot 0. For the slot 0 I could read those datas, but I can't do it for the slot 4 still from the slot 3... In that case I don't have to use the run function but the store and read or write function. So is it also possible to do?


    Thanks.



    julien Hordies
  • NewzedNewzed Posts: 2,503
    edited 2005-07-15 13:49
    OK - different story.· Which Stamp are you using?

    Sid
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-15 13:50
    Use STORE ... like this:

    Compare_Values:
    · STORE 4
    · READ Slot4Addr, slot4Value
    · STORE 0
    · READ Slot0Addr, slot0Value

    · IF (slot4Value > slot0Value) THEN
    ···
    · ENDIF
    · ...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • OrionOrion Posts: 236
    edited 2005-07-15 13:50
    Try putting the data in the scratch pad memory with PUT & GET commands

    slot 0
    put 0, data


    slot 3
    get 0, data
  • Julien HordiesJulien Hordies Posts: 6
    edited 2005-07-15 14:02
    Ok,it works...thank you all...It was just because I named my differents slots and that in that case I had to specify a variable or a value for the slot's name in the slot which was running.


    Thank you again.


    julien Hordies
Sign In or Register to comment.