PortSet (Set Port)
The PortSet instruction is used to set a port high or low.
Syntax
PortSet ( Port, State

This example uses PortSet to set port 1 high at the beginning of each scan, and to set it back low at the end of each scan.
Public RefTemp, Tblk1
DataTable( TEST, 1, 1000)
DataInterval( 0, 1,Min, 10)
Average( 1, Tblk1, FP2, 0)
EndTable
BeginProg
Scan( 1,Sec, 1, 0)
PortSet(C1, 1) 'Set port 1 high
TCDiff (Tblk1(),1,mv200C,U1,TypeT,RefTemp,True,0,15000,1.8,32)
CallTable TEST
PortSet(C1, 0) 'Set port 1 low
NextScan
EndProg
Remarks
The Delay() instruction can be used to set a delay between two PortSet instructions. When the PortSet() is running in a slow sequence, the Delay() Option must be 0 and the delay can be no larger than the scan interval of the main scan.
Parameters
Port
The number of the port to use in this instruction. 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
State
Determines whether to set the port high or low. Right-click to display a list.
Value | State |
---|---|
0 | Low |
≠0 | High |
Type: Constant, Variable, or Expression
Optional Parameter
Option
Optional parameter that determines whether the instruction will run in the measurement task sequence or the processing task sequence; also affects whether the program will compile and run in SequentialMode or PipelineMode:
Option | Description |
---|---|
Omitted | Instruction is run within the measurement task sequence; program will compile in SequentialMode |
0 | Instruction is run within the measurement task sequence; program will attempt to compile in PipelineMode* |
1 | Instruction is run within the processing task sequence; program will attempt to compile in PipelineMode* |
*other programming may force the program into SequentialMode