BASIC commands
PROGRAMMING MANUAL
169
R
e
vi
si
o
n
1
.0
3.2.237 READ_BIT
/i
3.2.238 READ_OP
/i
3.2.239 REG_POS
/i
Type
System command
Syntax
READ_BIT(bit_number, vr_number)
Description
The
READ_BIT
command returns the value of the specified bit in the speci-
fied VR variable, either 0 or 1.
Arguments
•
bit_number
The number of the bit to be read. Range: [0,52].
•
vr_number
The number of the VR variable for which the bit is read. Range:
[0,64999].
Example
No example.
See also
CLEAR_BIT
,
SET_BIT
.
Type
I/O command
Syntax
READ_OP(output_no)
READ_OP(first_output_no, last_output_no)
Description
READ_OP(output_no)
, returns the binary value (0 or 1) of the digital output
output_no
.
READ_OP(first_output_no, last_output_no)
, returns the number that is the
decimal representation of the concatenation of the binary values of the range
first_output_no
to
final_output_no
.
Note: The difference between
first_output_no
and
last_output_no
must be
less than 24.
Note: Outputs 0 to 7 do not physically exist on the TJ2-MC64. They cannot be
written. Their return value is always 0.
Note:
READ_OP
checks the state of the output logic.
READ_OP
can return
the value 1 even if no actual output is present.
Arguments
•
output_no
The number of the output.
•
first_output_no
The number of the first output of the output range.
•
last_output_no
The number of the last output of the output range.
Example
If output 11 has value 1, output 12 has value 1, output 13 has value 0, and
output 14 has value 1,
READ_OP(11,14)
returns 13 (1101 bin).
Example
In this example a single output is tested:
WAIT UNTIL READ_OP(12) = ON
GOSUB place
Example
Check a range of 8 outputs and call a routine if one of them has value 1:
op_bits = READ_OP(16, 23)
IF op_bits <> 0 THEN
GOSUB check_outputs
ENDIF
See also
N/A
Type
Axis parameter (read-only)
Syntax
REG_POS
Description
The
REG_POS
parameter stores the position in user units at which the pri-
mary registration event occurred.
Arguments
N/A