property ModemStatus : Byte
Returns the modem status byte and clears all delta bits.
The status is returned in the byte format used by the UART's modem status register. The returned value can be used with the following bit masks to isolate the desired bits:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You'll probably find it easier to use the CTS, DSR, RI, DCD, and related DeltaXxx properties instead of ModemStatus, but ModemStatus is more efficient when you need to check several signals at once.
ModemStatus also clears the internal "delta" bits used to indicate changes in the CTS, DSR, RI, and DCD signals. This affects the results of subsequent checks of DeltaCTS, etc.
The following example uses ModemStatus to check for dropped carrier. It would have been simpler in this case to check the DCD property directly:
Status := ApxComPort.ModemStatus;
if Status and DCDMask = 0 then
...port dropped carrier
See also: CTS, DCD, DeltaCTS, DeltaDCD, DeltaDSR, DeltaRI, DSR, RI