ComPortIsActive (Detect if COM Port is Active)
The ComPortIsActive function returns a Boolean Data type used to represent conditions or hardware that have only two states (true or false) such as flags and control ports. value, based on whether or not activity is detected on the specified COM port.
Syntax
variable = ComPortIsActive ( ComPort )

In the following example, a socket is opened using TCPOpen. ComPortIsActive is used to monitor the socket for activity. Once activity is no longer detected, the socket is closed.
Public ComActive As Boolean, Socket
BeginProg
Scan (1,Sec,3,0)
Socket = TCPOpen
("192.168.1.23",3000,0)
ComActive = ComPortIsActive (Socket)
'other
instructions
NextScan
SlowSequence
Do
If ComActive = False Then
TCPClose(Socket)
Loop
EndProg
Parameter
ComPort (Communications Port)
The communications port that will be used by the instruction. Right-click to display a list. Options vary depending on the instruction.
Alphanumeric | Description |
---|---|
ComRS232 | RS232 port of the datalogger |
ComUSB | USB of the datalogger |
ComME | Datalogger CS I/O port; modem enabled |
Com310 | Datalogger CS I/O port; COM310 modem |
Com320 | Datalogger CS I/O port; COM320 modem |
ComSDC7 | Datalogger CS I/O port; SDC7 |
ComSDC8 | Datalogger CS I/O port; SDC8 |
ComSDC10 | Datalogger CS I/O port; SDC10 |
ComSDC11 | Datalogger CS I/O port; SDC11 |
ComC1 | Datalogger control terminals 1 & 2 |
ComC3 | Datalogger control terminals 3 & 4 |
ComU1 | Universal terminal pair U1 (TX) & U2 (RX) |
ComU3 | Universal terminal pair U3 (TX) & U4 (RX) |
ComU5 | Universal terminal pair U5 (TX) & U6 (RX) |
ComU7 | Universal terminal pair U7 (TX) & U8 (RX) |
ComU9 | Universal terminal pair U9 (TX) & U10 (RX) |
ComU11 | Universal terminal pair U11 (TX) & U12 (RX) |
ComRF | Integrated radio communication |
If the instruction has a ResultCode parameter and a negative value is entered for the ComPort, the datalogger will not wait on a response from the destination device before proceeding to the next instruction.
Type: Constant. For all instructions except SerialOpen, this parameter can also be a variable.
ComPort can also be a virtual ComPort, such as the result of a TCPOpen instruction. This can be used to determine if the socket connection is still available.