SERIN with WAIT for OK what happens if it never comes?
Brian Lee
Posts: 6
I am having a problem that I can’t find the answer for. I am sending a configuration string to a cell with SEROUT and before I send the next line I need to WAIT for OK for the modem by SERIN RxModem, 240, [noparse]/noparse]WAIT (“OK”[noparse];)[/noparse but want happens if the modem does not respond?
·
I think the best way to handle this is WAIT x seconds then jump out of the WAIT state and go to a different part of the program to flash a LED to indicate an error then go back to the start of the modem configuration.
·
Does anyone have any suggestions on how to do this?
·
I think the best way to handle this is WAIT x seconds then jump out of the WAIT state and go to a different part of the program to flash a LED to indicate an error then go back to the start of the modem configuration.
·
Does anyone have any suggestions on how to do this?
Comments
www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf
The SERIN command alows you to set a timeout and if reached will jump to a different part of your program. The Manual will explain how to do this under SERIN.
·
RxD·······················CON 16················ 'RxD at SIN
Ipin ······················ CON 15················'Ipin is I/O pin 15
TxModem ··········· ·CON 14··············· 'TxD to modem
baud ···················· CON 240············· 'N9600 for BS2 p
timeout·················CON 2000 ··········· 'Timeout = 1000 ms
char ····················· VAR Byte
·
start:
SEROUT TxModem, baud, [noparse][[/noparse]"AT", CR]
SERIN RxD\Ipin, baud, timeout, NoData, [noparse][[/noparse]char]
DEBUG CR, "R: ", char
GOTO start
·
NoData:
DEBUG CR, "No response from the device."
PAUSE 1500
GOTO start
·
Is there other ways of accomplishing this task? Or is this the most efficient way?
The modem would have to be configured to use hardware handshaking and to send verbose result codes. Those may or may not be the defaults.
Without hardware handshaking, there is danger that the modem will send responses before the Stamp is ready.
SERIN RxD\Ipin, baud, timeout, NoData, [noparse][[/noparse]WAIT("OK")]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com