Scanning the Incoming Data Stream
In cases where you cannot depend on 100% Hayes compatibility or you
want to be independent of the cable wiring, scanning for the NO CARRIER
result code is more reliable.
At the low-level of the program all received data is retrieved through one
subroutine. This subroutine can be augmented to provide the service needed.
As data passes through, the last 14 characters are buffered, typically in
a circular buffer. If more data passes in each call, only the last 14 need
to be copied. When the processor is free, (e.g., after 100 ms of idle time
or the receive routine has returned no data for 30 to 100 calls), then the
buffer is compared against the <CR><LF>NO CARRIER<CR><LF>result
code. If a match is found, the loss-of-carrier event is triggered.
By checking when there is idle time, or after no data has been received
for a while, you reduce the CPU overhead and ensure that the modem is not
falsely triggered when the string is imbedded in an actual data stream.
You can also modify the linefeed character by setting Sregister S4
- Line Feed Character to a different value such as S4=31 to make the
result code sequence more unique. This action affects other result codes
generated by the modem.
Click here to return to the Contents page.