CheckPort (Check Status of a Control Port)
CheckPort returns the status of a
Syntax
CheckPort ( Port )

In the following example code, the status of control port C1 is checked and the result is stored in the variable PortStat. The port is set by the state of Flag (if Flag is high, the port is set high).
Public PortStat As Boolean
Public Flag As Boolean
BeginProg
Scan (1,Sec,3,0)
If Flag
PortSet (C1 ,1)
Else
PortSet (C1 ,0)
EndIf
PortStat=CheckPort(C1)
NextScan
EndProg
Remarks
CheckPort returns True (-1) if the specified
Parameter
Port
The number of the port to use in this instruction. An alphanumeric code is entered. Right-click to display a list.
Code | Description |
---|---|
C1 | Control Port 1 |
C2 | Control Port 2 |
C3 | Control Port 3 |
C4 | Control Port 4 |
U1 | Universal terminal 1 |
U2 | Universal terminal 2 |
U3 | Universal terminal 3 |
U4 | Universal terminal 4 |
U5 | Universal terminal 5 |
U6 | Universal terminal 6 |
U7 | Universal terminal 7 |
U8 | Universal terminal 8 |
U9 | Universal terminal 9 |
U10 | Universal terminal 10 |
U11 | Universal terminal 11 |
U12 | Universal terminal 12 |
Type: Constant
Caution: The value returned may not be valid if using the control port as a serial port or as a pulse counting port.