exiting loops based on SERIN state
gtslabs
Posts: 40
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
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