Shop OBEX P1 Docs P2 Docs Learn Events
exiting loops based on SERIN state — Parallax Forums

exiting loops based on SERIN state

gtslabsgtslabs Posts: 40
edited 2007-04-03 13:54 in BASIC Stamp
I have code that continually outputs data to my Visual Basic Interface.
I am trying to insert some code that tells it to stop reading the serial data.
So when I send it the number "1" it exits the REadData: loop and executes the shiftout command I have at the bottom.

This is just fragments from my code.
How do I get it to test for this SERIN line? Right now it just stops there as I have no input going to it yet.

ReadData:
waitRDY:
··· IF IN5 = 1 THEN waitRDY····· 'wait for RDY to go low to indicate output update.
···· SHIFTIN DATAout, SCLK, MSBPOST, [noparse][[/noparse]resultLow,resultMid,resultHigh]··· 'read conversion result from data register.

···· DEBUG HEX2 resultlow, HEX2 resultmid, HEX2 resulthigh ,"x"
···· PAUSE 200

···· 'Check for user intervention from Visual Basic to stop continous reading.
···· SERIN INPUT_PIN, BAUDMODE, [noparse][[/noparse]Command]
···· GOSUB TakeAction
GOTO ReadData

TakeAction:· ' Determines what to do based on result of GetInput
· SELECT Command
· CASE "1"
··· SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$31] 'Write Comm - Stop Continous Read from Data Register
· ENDSELECT

Comments

Sign In or Register to comment.