Programming the GPIB-LPT
Section Five
GPIB-LPT User Manual
5-8
© National Instruments Corporation
Setup and Initialization Routine
The setup and initialization routine initializes the interrupt vector (for interrupt level 5 or 7,
depending on configuration), sends out the first data byte to the GPIB-LPT, and unmasks the
interrupt. The ACK* pulse from this byte interrupts the processor so the next byte can be sent by
the interrupt handler. You must complete the following steps to set up and initialize an interrupt
vector:
a. Put the address of the interrupt handler routine at the appropriate interrupt vector address (5 or
7).
b. Unmask the interrupts for level 5 or 7 by clearing the appropriate bit in the PC interrupt
controller chip.
c. Set the bit IRQEN equal to 0 (initially disabling the GPIB-LPT interrupt).
d. Initialize a data pointer to the data being sent.
e. Return from the routine.
Interrupt Handler Routine
The interrupt handler routine is called every time an ACK* pulse (interrupt) is seen by the
processor. It disables the GPIB-LPT interrupt, calls the PRINT subroutine, and re-arms the
8259A Interrupt Controller chip. You must complete the following steps for the interrupt handler
routine:
a. Set the bit IRQEN equal 0.
b. Call the PRINT routine (the steps of the PRINT routine follow this routine).
c. Write the End Of Interrupt command to the PC interrupt controller chip.
d. Rearm the interrupt.
e. Return from the routine.
PRINT Routine
To send a character to the printer, use a PRINT routine which includes the following steps:
a. Have the character variable equal the data referenced by the data pointer.
b. If the character variable equals the terminator character, re-mask interrupt 5 or 7 and exit. If it
does not equal the terminator character, continue.
c. Write the character variable to the DATA Register.
d. Wait for the signal BUSY* to equal 1; if the timeout period expires, exit the routine. If the
timeout period does not expire, continue the routine.
e. Set the signals STROBE and IRQEN equal to 1.
f.
Wait 1 to 5
µ
sec.