3.131
EDH0162En1040 – 06/99
MM4005
TG — Toggle I/O output bits
Usage
IMM
PGM
MIP
Syntax
xxTGnn
Parameters
Description
xx
[int]
— I/O bit number.
nn
[int]
— I/O bit mask.
Range
xx
—
0
to
8.
nn
—
0
to
255.
Units
xx
— None.
xx
— None.
Defaults
xx
Missing: 0.
Out of range: Error E.
Floating point: Error A.
nn
Missing: 255.
Out of range: Error C.
Floating point: Decimal part truncated.
Description
This command toggles one to all output bits of the I/O port. If
xx
is speci-
fied between 1 and 8, the
nn
mask must be missing and then the selected
bit will be inverted.
If
xx
is missing or set to 0 and
nn
is between 1 and 255, the controller will
toggle all bits corresponding to the mask. For example, if
nn
is 140, the
equivalent binary mask is 10001100 which means that I/O output bits num-
ber 3, 4 and 8 will be inverted (remember that I/O bits are numbered from 1
to 8).
If
xx
is missing or set to 0 and
nn
is not specified, the controller toggles all
8 bits. This is equivalent to setting
xx
to 0 and
nn
to 255.
Returns
None.
Errors
A
—
Unknown message code.
E
—
Incorrect I/O channel number.
Rel. Commands
CB
—
Clear I/O outputs bits.
RO
—
Read I/O output.
SB
—
Set I/O output bits.
SO
—
Set I/O output byte.
Example
0RO |
Read all 8 bits of the I/O output port.
0RO209
|
Controller returns 209, which converted to binary means:
bit 8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
1
1
0
1
0
0
0
1
TG224
|
Toggle bits number 6, 7 and 8 of the I/O output port
.
0RO |
Read all 8 bits of the I/O output port.
0RO49
|
Controller returns 49, which converted to binary means:
bit 8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
0
0
1
1
0
0
0
1
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com