User's Manual

Turbo PMAC User Manual
408 Writing a Host Communications Program
Enabling: To start operation of this buffer:
1. Write the starting location of the second part of the buffer into register 0x104A (X:$060412). This
location is expressed as a Turbo PMAC address offset from the start of DPRAM’s variable-buffer
space at $060450, and it must be between $0000 and $0BAF for the 8k x 16 DPRAM, or between
$0000 and $3BAF for the 32k x 16 DPRAM.
2. Starting at the DPRAM location specified in the above step, write the Turbo PMAC addresses of the
registers to be copied, and the register types. The first 16-bit word holds the low 16 bits of the Turbo
PMAC address of the first register to be copied; the second 16-bit word hold the high 4 bits of this
address in bits 0 –3; bits 4 – 5 take a value of 0, 1, or 2 to specify Y, Long, or X, respectively, for the
first register. The third and fourth words specify the address and type of the second register to be
copied, and so on.
3. Write a number representing the size of the buffer into register 0x1048 (Y:$060412). This value must
be between 1 and 128. When Turbo PMAC sees that this value is greater than zero and the individual
data ready bit is zero, it is ready to start copying the registers you have specified into DPRAM.
4. To enable the single-user mode, write a zero into the control word at 0x1044 (Y:$060411). To enable
the multi-user mode write a 256 (set bit 8 and clear bit 0) into this control and set bit 15 = 0 of each
variable's data type register (X memory register). This will tell Turbo PMAC that the host is ready to
receive data and what the mode is for the data.
5. Set I55 to 1. This enables both the background variable data reporting function and the background
variable data writing function.
Single-User Mode Procedure: In operation, Turbo PMAC will try to copy data into the buffer each
background cycle -- between each scan of each PLC program. If bit 0 of the control word 0x1044 is set to
1, it will assume that the host has not finished reading the data from the last cycle, so it will skip this
cycle. If bit 0 is 0, it will copy all of the specified registers.
When Turbo PMAC is done copying the specified registers, it copies the low 16 bits of the servo timer
register (X:$000000) into the DPRAM at 0x1046 (X:$060411). Then it sets Bit 0 of the control word
0x1044 (Y:$060411) to let the host know that it has completed a cycle.
When the host wants to read this data, it should check to see that Bit 0 of the control word at 0x1044 (the
Data Ready bit) has been set. If it has, the host can begin reading and processing the data in the DPRAM.
When it is done, it should clear the Data Ready bit to let Turbo PMAC know that it can perform another
cycle.
Multi-User Mode Procedure: The operation of this mode is similar to the Single-User Mode described
above. The main difference is that the control word is no longer used as a global handshaking bit for
updating the buffer. It only enables or disables the multi-user mode. In multi-user mode the control word
is never modified by Turbo PMAC. Handshaking is now on an individual variable basis and is controlled
by bit 15 of the variable's data type specifier.
Each background cycle, between each scan of each uncompiled PLC program, Turbo PMAC will try to
copy data into each variable in the buffer. Bit 15 of each variable's data type specifier controls whether or
not Turbo PMAC is allowed to update that particular variable's value. Turbo PMAC will skip updating
any variable that has bit of its data type specifier set to 1. Any variable that has bit 15 set to 0 will be
updated.
When Turbo PMAC is done servicing the buffer, it copies the low 16 bits of the servo timer register
(X:$000000) into the DPRAM at 0x1046 (X:$060411). This is not dependent upon updating any
variables in the buffer.