There are three main instructions for reading/writing I/O signals:
- DigitalOut – Use this to turn on/off an output or group of outputs
- DigitalIn – Use this to read the value of an input or output
- PulseOut – Use this to turn on/off an output or group of outputs for a defined period of time
DigitalOut Instruction
The DigitalOut instruction is used to turn on/off an output or group of outputs. The general syntax is shown below:
The Output Target can be toggled between Output#, OutputGroupHalf# or OutputGroup#. These values can be toggled from the Detail Edit panel.
Each OutputGroup contains 8 individual Outputs, and each OutputGroupHalf contains 4 individual Outputs. Thus, Output Group 1 contains Outputs 1-8, Output Group 2 contains Outputs 9-16, etc… And Output Group Half 1 contains Outputs 1-4, Outputs Group Half 2 contains Outputs 5-8, etc…
In case of an individual output, the Value is defined as ON/OFF/INVERT. In the case of Groups or Half Groups, the Value is defined as either a constant integer or a B Variable.
Examples
Output Signal #12 is turned ON |
OutputGroup #3 is set to 24 (00011000 Binary). This correlates to Outputs #20 and #21 being turned ON as shown below. |
DigitalIn Instruction
The DigitalIn Instruction can be used to read the value of an input or output. The general syntax is shown below:
As with Outputs, Inputs are divided into Groups and Half-Groups. Each InputGroup contains 8 individual Inputs, and each InputGroupHalf contains 4 individual Inputs. Thus, Input Group 1 contains Inputs 1-8, Input Group 2 contains Inputs 9-16, etc… And Input Group Half 1 contains Inputs 1-4, Input Group Half 2 contains Inputs 5-8, etc…
The DigitalIn Instruction can read the values of both Inputs and Outputs as well as Specific Inputs and Outputs. The desired target can be changed from the Detail Edit panel.
Examples
The ON/OFF status of Input #12 is stored in B016. If the Input is ON, B016 will be 1. If the Input is OFF, B016 will be 0. |
The value of B002 is determined by the binary representation of OutputGroup 8 (Output Signals 57-64). For example, the status shown below would represent the binary value 10010110. The value of B002 would then be the decimal value 150 (binary 10010110 equals decimal 150). |
PulseOut Instruction
The PulseOut Instruction is very similar to DigitalOut except that it only turns on the Output(s) for a fixed period of time. The default time period is 300 ms (0.3 seconds); however, an optional parameter can be defined to customize this duration. The general syntax is shown below:
Examples
Output #128 is turned on for 0.3 seconds. |
Output #5 is turned on for 1.00 seconds. |
OutputGroup #3 is set to 24 (00011000 Binary) for 0.3 seconds. |
Comments
0 comments
Please sign in to leave a comment.