MODEMRESP Read modem response |
Top Previous Next |
This script command reads the response from a command sent to a Hayes compatible modem with the MODEMCMD script command. It is not required to read the response from the modem when a command is sent, but you may optionally use this command to confirm that a modem is present or is properly responding to commands. The /enableresp option is required on the MODEMCMD command prior to calling MODEMRESP.
In the following example, the variable ‘resp’ will contain the response from the modem. The response is likely to be AT which will be the modem echoing back the command.
MODEMCMD "AT" /enableresp MODEMRESP resp
Typically your script should continue call MODEMRESP until the three-second time-out expires. This way you will be sure to get all of the characters of the response. So, your script might look like the following.
; send AT command to modem MODEMCMD "AT" /enableresp :resp_loop MODEMRESP resp IFERROR= $ERROR_OPTIMEDOUT GOTO end of_resp ; do something meaningful here with the responses... ; ... GOTO resp_loop : end of_resp
Related Command(s): MODEMCMD, DIAL, ANSWER
|