about

 

 

LPT-16-O

16bit Output Interface for the Parallel Port

Connection

Through a DB25M connection to the Parallel Port.

Features

  • Easy connection to the PC without disassembling it.
  • Easily programmed
  • Easily expandable
  • Lack Power connection therefore a power supply is needed for the card.
  • The circuit was developed only to drive some relays and therefore only output is available

 

Schematic - click here

 

Note

The ULN2803 are there to sink more current than the 74LS573 can handle and to act as isolators to the output.

 

Function

Two latches provide 8 output ports each. They get there input ports from the parallel port data.

The two latches are each enabled from the Strobe (1) and the Autofeed (14) which are accessed from the control register.

The output of the latches is always enabled. The above schematic buffers the output of the latches using ULN2803 which are able to sink about 0.5A.

Power should be supplied from an external regulated voltage supply. Power connections are not shown.


Programming the card

The actual programming is shown below. It is basically outputting the data out to the latches, then enable one latch to read the input. You can mirror both latches by enabling both latches at the same time. Note that the latches are in total control of the status of the Strobe pin and the Autofeed pin.

On older computers and some BIOSes, the parallel port pins are pulled up and down during the booting process. This would result in the activating of lines from the card.

#include "dos.h"

#include "stdio.h"

void out16bit(unsigned char a, unsigned char b);

{

int base_address=0x378;
outportb(base_address+0,a); // a is now shown in the parallel port Data pins
outportb(base_address+2, 3); // C0 and C1 are low (active low)
outportb(base_address+2, 2) ; // C0 high and C1 low (first 74573 enables input latch)
outportb(base_address+2, 3); // C0 and C1 are low (active low)
outportb(base_address+0,b); // b is now shown in the parallel port Data pins
outportb(base_address+2, 3); // C0 and C1 are low (active low)
outportb(base_address+2, 1); // C0 low and C1 high (second 74573 enables input latch)
outportb(base_address+2, 3); // C0 and C1 are low (activelow)

}


Using the Parallel port

The Parallel port has a number of ports available to the developer namely :8 Input/Output data lines D0-D7 - using data register


4 Output ports C0-C3 - using the control register
5 Input ports S3-S7 - using the status register


Pinouts and functions are showed in the following table

 

Pin Number Parallel Port PinName Pin Register Name Comments
1 -Strobe C0 >0.5us to send
2 +Data 0 D0  
3 +Data 1 D1  
4 +Data 2 D2  
5 +Data 3 D3  
6 +Data 4 D4  
7 +Data 5 D5  
8 +Data 6 D6  
9 +Data 7 D7  
10 -ACK S6

Low Pulse ~5us,after accept

11 +Busy S7 High for Busy, offline or error
12 +Paperend S5 High for out of paper
13 +Selectin S4 High for printer selected
14 -AutoFd C1 Set low to autofeed one line
15 -Error S3 Low for error,offline or paperend
16 -Init C2 Set low pulse >50us to init
17 -Select C3 Set low to select printer
18-25 Ground    

Note that the Parallel port pin name denotes '+' active high and '-' active low

A good tutorial can be found at The Beyond Logic site

 

Programming the Parallel Port

Programming the parallel port is very easy.

First find the parallel port address that you are using :


378h - 37Fh Usual Address For LPT 1
278h - 27Fh Usual Address For LPT 2
3BCh - 3BFh other LPT

This will be your base address then you have access to the various registers as follows

Base Address + 0 Data Port

Base Address + 1 Status Port

Base Address + 2 Control Port


Now all you have to note is where the pins are active low or activehigh.



This pdf shows schematic as well as PCB masks.



Mail me for any queries or problems.

Back to the electronic page

   
Hosted by www.Geocities.ws

1