User's Manual

PMAC User Manual
Writing a Host Communications Program 255
The EQUn lines can be used to signal the host that the actual position of an axis has reached a certain
point so that the appropriate action can be taken. Alternately, these are the best way to have a PMAC
motion or PLC program interrupt the host during the program flow.
Setting Up
Proper setup of the interrupt structure, both in hardware and software, is essential to a properly working
interrupt scheme. Some tasks need be done only once in development; others must be done every time
the system is powered on.
Finding an Open Interrupt Line
The first thing that must be done is to select an interrupt line on the PC that can be used. The important
thing is to find one that will not be used for other purposes during the time when the PC is working with
PMAC using this interrupt. PMAC can interrupt on lines IRQ2, IRQ3, IRQ4, IRQ5, and IRQ7 on all
PCs, and on lines IRQ10, IRQ11, IRQ12, IRQ14, and IRQ15 on PC-AT type computers. Different
versions of so-called compatible computers use these interrupts for different things; consult the users
manual for your own model to see what interrupt line is used for what function. Below is a table of
"standard" uses for these interrupt lines. It is often possible to borrow a COM or LPT interrupt for the
duration of a PMAC-interfacing program if that port will not be used.
Hardware Considerations
Once the line is chosen, the electrical properties of the interrupt line must be considered. Also here is an
area where compatible PCs often are not really compatible. Some use no pull-up resistors for these lines
on the backplane, and those that do use pull-up resistors use different values. PMAC PC is shipped
standard with a 470 ohm pull-down resistor (connecting D3 and R25, just above the AT connector).
While this is sufficient to achieve an adequate low state on most PCs and clones, on some varieties with
low-value pull-up resistors, a lower value pull-down may be required to get a valid low state. Obviously,
probing of the interrupt line may be required to verify proper operation — extender cards are a big help in
this regard.
Standard Uses for Open Interrupt Lines
Line Int # PC Use PC-AT Use
IRQ2 0AH LPT2 IRQ8-15
IRQ3 0BH COM2 COM2
IRQ4 0CH COM1 COM1
IRQ5 0DH Hard Disk LPT2
IRQ7 0FH LPT1 LPT1
IRQ10 72H xxx available
IRQ11 73H xxx available*
IRQ12 74H xxx available*
IRQ14 76H xxx Hard Disk
IRQ15 77H xxx available
*IBM has reserved these for as yet unimplemented functions
Initializing the PC’s PIC
In software, the PC’s 8259 PIC must be set up (each time the PMAC application program is run) to react
properly to an interrupt from PMAC. This setup consists of two parts: vectoring and unmasking. Vectoring
tells the PC where to go (at what address are the instructions to execute) when it receives the interrupt.
Unmasking enables the interrupt. The TurboC 2.0 environment provides useful tools to make this process
relatively easy and is used as an example here; there are, of course, many other ways to do this.