LPT PORT EXTENDER
Because of the standard LPT printer parallel port can only send data and can not receive data, so I decided to make this
LPT port extender card to improve the capability of that matter. Standard LPT have 8-bit DP (Data Port), 5-bit PS (Status Port) and 4-bit PC (Control Port). This bits divided by 8+4 bits of output bits and 5 bits of input bits. To get the 8-bit input and output port, we used a nibble of this real input and output port to simulate of a byte of input and output port (bi-directional port) by the control bits of course we used 2 bits of the DP port.
Here are the implementation :
-
Nibble Output = 4-bit PC (PC-0 ~ PC-3, Note that PC-0, PC-1, PC3 are inverted output. First & second nibble are controlled by the software).
-
Nibble Input = 4-bit PS (PS-4 ~ PS-7, Note that PS-7 is inverted input. First & second nibble are also controlled by the software too).
-
Control bits = 2 bits of DP (DP-6 ~ controlled for lo-nibble & hi-nibble, DP-7 ~ controlled data direction).
click the image for zooming
|
Fig.1. LPT port extender schematic diagram.
|
Parts List :
Hex Inverter (74LS04) ............................1 pcs
Quad NAND gates (74LS00) ......................... 1 pcs
Quad Latch (74LS173) ............................. 2 pcs
Octal 3-State buffer (74LS244) ................... 1 pcs
100 nF ........................................... 5 pcs
DB-25 Socket male/female .........................1 pair
Cable (0.25 sq x 19c) ............................3 m
Figure 1. shows the schematic diagram for this LPT extender. The condition of the logic state are show in this tabel :
Direction
|
Lo/Hi-Nibble
|
Data (Q)
|
74LS173
|
74LS244
|
Description
|
(DP-7)
|
(DP-6)
|
Lo/Hi-Nibble
|
Lo-Nibble
|
Hi-Nibble
|
Lo-Nibble
|
Hi-Nibble
|
0 | 0 | 0/1 | 0/1 | Q' | Hi-Z | Hi-Z | Lo-Nibble Data Out |
0 | 1 | 0/1 | Q' | 0/1 | Hi-Z | Hi-Z | Hi-Nibble Data Out |
1 | 0 | 0/1 | Hi-Z | Hi-Z | 0/1 | Hi-Z | Lo-Nibble Data In |
1 | 1 | 0/1 | Hi-Z | Hi-Z | Hi-Z | 0/1 | Hi-Nibble Data In |
Tabel.1. Logic state of the LPT port extender.
One of the PCB design layout shown in fig.2. This use single side PCB, so it has a lot of jumper wire. You can make another design if you want, but this one is work well (my prototype).
|
Fig.2. LPT port extender PCB layout.
|
Here is the software example written in Pascal language style :
TYPE
LPT_Port = (LPT_1, LPT_2, LPT_3, No_LPT);
CONST
DP : ARRAY[LPT_Port] OF WORD = ($3BC, $278, $378, $3BC); { Data Port }
PS : ARRAY[LPT_Port] OF WORD = ($3BD, $279, $379, $3BD); { Status Port }
PC : ARRAY[LPT_Port] OF WORD = ($3BE, $27A, $37A, $3BE); { Control Port }
VAR
Port_DP : WORD;
Port_PC : WORD;
Port_PS : WORD;
LPT : LPT_Port;
PROCEDURE Out_Port(Data : BYTE);
VAR
Temp : BYTE;
BEGIN
Temp := PORT[Port_DP];
PORT[Port_PC] := (Data AND $0F);
PORT[Port_DP] := (Temp AND $3F);
PORT[Port_PC] := ((Data SHR 4) AND $0F);
PORT[Port_DP] := ((Temp AND $3F) OR $40);
END;
FUNCTION In_Port : BYTE;
VAR
Temp : BYTE;
Data : BYTE;
BEGIN
Data := 0;
Temp := PORT[Port_DP];
Temp := Temp AND $3F;
PORT[Port_DP] := (Temp OR $80);
Data := ((PORT[Port_PS] AND $F0) SHR 4);
PORT[Port_DP] := (Temp OR $C0);
Data := (Data OR (PORT[Port_PS] AND $F0));
In_Port := Data;
END;
|
To access the port just simple, use the statement Data_Read := In_Port; to read in the data and Out_Port(Data_Write); to write out the data, and so on ... and so on ....
PCB Mounting. It is very simple to put the whole unit on a piece of board like showing in the figure.3. But all of this depends of your design idea. I prefer to place all of it on the board and not in the box, because it will be more easy to make some test to the circuit or to make some measuring voltages or logics.
|
Fig.3. LPT port extender PCB mounting.
|
|
Fig.4. LPT port extender prototype card.
|
No comments:
Post a Comment