SX/B program question
MacGeek117
Posts: 747
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
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
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 RETURNPlease 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
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
·
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