B&B Electronics Parallel Printer Card PIOC Manuale Utente Pagina 14

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 17
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 13
Interfacing the Standard Parallel Port http://www.senet.com.au/~cpeacock
Interfacing the Standard Parallel Port Page 14
At compile time, the above source may generate a few warnings, condition always true,
condition always false, unreachable code etc. These are perfectly O.K. They are generated as some of
the condition structures test which IRQ you are using, and as the IRQ is defined as a constant some
outcomes will never change. While they would of been better implemented as a preprocessor
directive, I’ve done this so you can cut and paste the source code in your own programs which may
use command line arguments, user input etc instead of a defined IRQ.
To understand how this example works, the reader must have an assumed knowledge and
understanding of Interrupts and Interrupt Service Routines (ISR). If not, see Using Interrupts
1
for a
quick introduction.
The first part of the mainline routine calculates the Interrupt Vector, PIC Addr & Mask in
order to use the Parallel Port’s Interrupt Facility. After the Interrupt Service Routine (ISR) has been
set up and the Programmable Interrupt Controller (PIC) set, we must enable the interrupt on the
Parallel Port. This is done by setting bit 4 of the Parallel Port’s Control Register using
outportb(CONTROL, inportb(CONTROL) | 0x10);
Before enabling the interrupts, we wrote 0xFF to the Parallel Port to enable the 8 data lines
into a known state. At this point of the program, all the data lines should be high. The interrupt service
routine simply sets a flag (interflag), thus we can determine when an IRQ occurs. We are now in a
position to write 0x00 to the data port, which causes a high to low transition on the Parallel Port’s
Acknowledge line as it’s connected to one of the data lines.
If the interrupt occurs on the high to low transition, the interrupt flag (interflag) should be set.
We now test this, and if this is so the program informs the user. However if it is not set, then an
interrupt has not yet occurred. We now write 0xFF to the data port, which will cause a low to high
transition on the nAck line and check the interrupt flag again. If set, then the interrupt occurs on the
low to high transition.
However if the interrupt flag is still reset, then this would suggest that the interrupts are not
working. Make sure your IRQ and Base Address is correct and also check the wiring of the plug.
Parallel Port Modes in BIOS
Today, most Parallel Ports are mulimode ports. They are normally software configurable to
one of many modes from BIOS. The typical modes are,
Printer Mode (Sometimes called Default or Normal Modes))
Standard & Bi-directional (SPP) Mode
EPP1.7 and SPP Mode
EPP1.9 and SPP Mode
ECP Mode
ECP and EPP1.7 Mode
ECP and EPP1.9 Mode
Vedere la pagina 13
1 2 ... 9 10 11 12 13 14 15 16 17

Commenti su questo manuale

Nessun commento