Shop OBEX P1 Docs P2 Docs Learn Events
SX/B program question — Parallax Forums

SX/B program question

MacGeek117MacGeek117 Posts: 747
edited 2006-02-08 03:16 in General Discussion
I have a program that I've posted in two versions to show my problem.
I declared the subroutine, but I can't call it without using GOSUB.
RoboGeek

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are·3 kinds of people in the world,

the dreamers, the do-ers, and the "Oh, what's this button do"-ers.
Formerly bugg.
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com

Comments

  • BeanBean Posts: 8,129
    edited 2006-02-08 03:11
    You have to declare the subroutine BEFORE you try to use it.

    If you want to have declared subroutines in an interrupt you just make the interrupt a simple GOTO.

    Like so:
    DEVICE SX28, OSCHS3, TURBO, STACKX, OPTIONX
    FREQ  50_000_000
     
    PIEZO VAR RB.1
     
    X VAR BYTE
     
    INTERRUPT
      GOTO HandleInt
     
    CRICKET SUB
     
    HandleInt:
      WKPND_B = X
      IF X = %00000001 THEN
        CRICKET
      ENDIF
      WKPND_B = %00000000
    RETURNINT
     
    PROGRAM Start
     
    Start:
      WKED_B = %11111110
      WKEN_B = %11111110
      TRIS_B = %00000001
      WKPND_B = %00000000
      X = 0
     
    Main:
      SLEEP
     
    CRICKET:
     FREQOUT PIEZO, 14, 4500
     FREQOUT PIEZO, 11, 4200
     FREQOUT PIEZO, 14, 4500
     FREQOUT PIEZO, 11, 4200
     FREQOUT PIEZO, 14, 4500
     FREQOUT PIEZO, 11, 4200
     FREQOUT PIEZO, 14, 4500
     FREQOUT PIEZO, 11, 4200
    RETURN
    

    Please DO use the template in your programs, I just removed it so it would be shorted to post.

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."


    Post Edited (Bean (Hitt Consulting)) : 2/8/2006 3:14:55 AM GMT
  • MacGeek117MacGeek117 Posts: 747
    edited 2006-02-08 03:15
    Thanks, Bean!
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are·3 kinds of people in the world,

    the dreamers, the do-ers, and the "Oh, what's this button do"-ers.
    Formerly bugg.
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.startrek.com
    ·
  • ChetChet Posts: 150
    edited 2006-02-08 03:16
    Check out Jon's reply to me on 2/3/2006 2:02 PM (GMT -8):

    Quote:

    You're overlooking the latest version of SX/B!

    1.42.01 -- you can get it here: http://forums.parallax.com/forums/default.aspx?f=7&m=54473

    If that doesn't fix the problem please post your code and I'll have a look.

    unquote
Sign In or Register to comment.