Shop OBEX P1 Docs P2 Docs Learn Events
Processing Code when variable changes — Parallax Forums

Processing Code when variable changes

philipad23philipad23 Posts: 44
edited 2006-02-07 20:41 in BASIC Stamp
Hi all!

I am using the BS2 to receive signals from a remote control. The data received is stored as a word variable. I want to run a subroutine to make some process to the signal, but I dont know how to run the subroutine everytime a new signal is received and is stored to the RAM.

the code it will be like:

a VAR Word

main:
IF (new value of a, different than previous value) THEN subroutine_1
GOTO main

Thanks

Post Edited By Moderator (Chris Savage (Parallax)) : 2/7/2006 4:06:12 PM GMT

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-07 13:39
    philipad23 said...
    main:
    IF (new value of a, different than previous value) THEN subroutine_1
    GOTO main
    Main:
    IF A = B THEN Main  'when A=B therefore no chng
    GOTO Somewhere      'A did not = B, so branch
    
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-07 16:06
    A descriptive subject line will help you get more answers as well.· I fixed this one for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-07 20:41
    Or:

    A VAR WORD
    B VAR WORD

    Main:
    < Read new value for B >
    IF A = B THEN MAIN
    ' Else, A <> B, so...
    A = B
    ' Do the stuff you want to do when the value changes...
    GOTO MAIN
Sign In or Register to comment.