Reference Manual

PMAC 2 Software Reference
PMAC On-Line Command Specification 261
Acc 34x manual) plus 2. Any attempt to read a TWS type M-variable defined in this manner
(with bit one of its address set to 1) returns zero and the actual read is prevented by PMAC
firmware.
Because you can not directly access the individual bits of the “thumbwheel port on an
Accessory 34x board and because of the relatively long time it takes to clock the data in or
out of PMAC (A 32-bit Read or a 32-bit Write to an individual port takes approximately 64
microseconds of time in the PMAC’s background time slot) it is best to keep an “image” of
each M-variable of this type in internal memory. The image variable would preferably be a
32-bit or 48-bit fixed point M-variable, but it could also be a 48-bit floating point P or Q
variable.
The best procedure for using TWS M-variables in a program is as follows. The input word
(TWS M-variable) should be copied into its image variable at the beginning of a sequence of
operations. The operations can then be done on the image variable without requiring PMAC
to actually read or write to the I/O port for each operation. The output word is first
“assembled” into its image variable, and then copied to the actual output word once at the
end of a sequence of operations. This procedure will allow the most efficient and flexible use
of TWS M-variables.
This type of variable can only be used in background tasks (PLCs and PLCCs 1-31). They
cannot be used in foreground tasks (motion programs and PLC and PLCC 0).
Example
To address Port B of board #1 as an output using M101, use the following definition. This
addressing format is not recommended because accidental reads of the port are not protected
against (Consider using the write-only format).
M100->TWS:4 ;Port B (BIO 0-31) of an ACC-34x with SW1 switches all on
;not assigned for write-only
To address Port B as above using the write-only addressing format, use the following
definition:
M100->TWS:6 ;Port B (BIO 0-31) of an ACC-34x with SW1 switches all ON
;assigned for write-only (6=4+2)
To address Port A of board #1 as an input using M99, use the following definition. This
addressing format is not recommended because accidental writing to the port is not protected
against (Consider using the read-only format).
M99->TWS:0 ;Port A (AIO 0-31) of an ACC-34x with SW1 switches all on
; not assigned for read-only
To address Port A as above using the read-only addressing format, use the following
definition:
M100->TWS:1 ;Port A (AIO 0-31) of an ACC-34x with SW1 switches all on
;assigned for read-only (1=0+1)
Yet another example: to address Port A of board #6 as an input using M300, we would use
the following definition:
M300->TWS:41 ;Port A (AIO 0-31) of an ACC-34x with SW1 switches
; ON, ON, OFF, ON, ON assigned for read-only (41=40+1)
See Also
M-Variables (Computational Features)
On-line commands M{constant}, M{constant}->,
M{constant}->TWR:{address}
Serial I/O Multiplexer Board (ACC-34) Manual