When to Consider Time


The use of timing varies between commands and processes. Some commands take longer to execute. Use the following guidelines to determine the appropriate amount of time to allow for commands and processes.

1. For the Zn - Perform Soft Reset command, wait 2 s for a response, then wait an additional 600 ms, whether a response were received.

2. For general setup commands, wait 2 s for the response.

3. For the hang-up command (Hn - Control The Switchhook ), wait up to 20 s for a response. Vseries modems may take longer to hang-up if data buffered within the modem is still waiting to be transmitted and acknowledged. S38 controls this time.

4. For dial commands (D - Dial Command or On - Go Online Command ) wait at least 1 minute. Values set for carrier detect time, tone versus pulse dialing, commas in the phone number, all can take additional time.

If the software times out, the modem may be disconnected, turned off, or disconnected from the computer. If this is the case, enforce a reasonable timeout to the first setup or identification command. That determines whether a modem is attached and functioning.

A timeout may also occur when the software receives a result code it does not recognize. The software may continue to wait until it receives a code it does recognize. If this is the case, the controller should proceed as if an ERROR result code is received. The only time you should stop is when a connect (D - Dial Command , A - Answer Command , or S0 - Ring After Which To Answer ) command is issued.

Before implementing a timeout, consider the advantages of this level of program interruption. For example, if the program times out from a dial command in 1 minute when it may take 2 minutes to complete the call, the timeout thwarts the command. The modem always responds with a result code, whether BUSY, NO CARRIER, or CONNECT, after some length of time.

Idle time is the time since data was received. Elapsed time is the time since the software started looking for the result. Idle time can be measured by resetting the timeout clock each time the software receives a character. Rather than exiting the loop after 2 seconds of elapsed time, the logic changes to exit after no further data has been received for 2 seconds.

Click here to return to the Contents page.