User's Manual
PMAC2 User Manual
Using the Position Compare Feature on PMAC2 87
USING THE POSITION COMPARE FEATURE ON PMAC2
Software-Configurable Hardware Registers
The position compare feature on PMAC2 provides a very fast and very accurate compare output function
based on the actual position counter. This feature has been significantly enhanced from PMAC1.
The position compare function is implemented in software-configurable hardware registers in the
DSPGATE1 ASIC. The software configuration gives the function its flexibility; the hardware circuitry
gives the function its speed.
Each encoder counter in PMAC2 has a position compare function. Furthermore, the first encoder counter
in each ASIC (Encoder 1 and Encoder 5 on PMAC2) can use the position compare circuitry from any of
the other channels on the ASIC, so Encoder 1 and Encoder 5 can utilize up to 4 independent compare
circuits.
The position compare outputs are brought out on the J8 JEQU connector through a 24V driver IC. The
output for Channel n is labeled EQUn. The factory-default IC is a ULN2803A sinking (open-collector)
driver IC. This IC is socketed, so it can easily be replaced with a UDN2981A sourcing (open-emitter)
driver IC. These ICs can be used to drive external hardware, such as the triggers for scanning and
measurement equipment.
On the PMAC2 PC, the compare outputs for Channel 1 and Channel 5 (if present) can also be used to
interrupt the host computer over the PC bus. On the PMAC2 Lite the compare outputs for Channel 1 and
Channel 2 can be used to interrupt the host computer over the PC bus.
In addition, there is a memory-mapped status bit for the output that PMAC2 software can access with M-
variables for its own use.
The position compare circuitry for each channel is based on three memory-mapped registers:
• Compare A
• Compare B
• Compare Auto-Increment
There are three control bits for each channel:
• Compare Channel Select
• Compare Direct-Write (Initial State) Value
• Compare Direct-Write Enable
The is one status bit for each channel:
• Compare Output Status
The channel-select bit is an I-variable: I9n1 for Channel n. Typically, the registers and other control bits
are accessed with M-variables. There are suggested M-variables for all of these. For Encoder 1, the
suggested definitions are:
M108->Y:$C007,0,24,S ; Position Compare A Value (counts)
M109->X:$C007,0,24,S ; Position Compare B Value (counts)
M110->X:$C006,0,24,S ; Compare Auto-Increment Value (counts)
M111->X:$C005,11 ; Position Compare Write Enable
M112->X:$C005,12 ; Position Compare Direct Write
; (Initial State) Value
M113->X:$C000,9 ; Position Compare Output Status
Refer to the Suggested M-variable list in the Software Reference Manual for equivalent definitions for
other channels.