PortSet (Set Port)

The PortSet instruction is used to set a port high or low.

Syntax

PortSet ( Port, State, Option [optional] )

Remarks

By default, 5 V is applied to the port when the State is set high. Use the PortPairConfig instruction to set the output to 3.3 V.This instruction is controlled by the task sequencer, which sets up the measurement order. This results in the PortSet instruction always occurring directly after the measurement instruction preceding it in the program, regardless of whether or not the PortSet instruction is in a conditional block. To write to a port conditionally, use the WriteIO instruction.

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