click the below images for zooming
Fig.5. LPT port expander schematic diagram. |
For controlling the functional signals of PPI-8255, as usual DP port used for data interchange (LPT port must have bidirectional capabilities for this purpose), PS port not used (spare), PC port used all for supporting the activated of PPI-8255 signals. Because this IC has 6 functional signals, while PC only preserve 4-bits, so we must make a tricky circuit to accomodate the operational. Fortunately these 4-bits PC meet our purpose. Tabel-2. Shows the operational function of PPI-8255.
A1 | A0 | Reset | Description | |||
X | X | X | X | 0 | 1 | DP side is tri-state (Hi-Z) |
X | X | X | X | 1 | X | All ports as input ports (reset) |
0 | 0 | 1 | 0 | 0 | 0 | DP side to port-A (write port-A) |
0 | 1 | 0 | 1 | 0 | 0 | Port-B to DP side (read port-B) |
1 | 0 | 1 | 0 | 0 | 0 | DP side to port-C (write port-C) |
1 | 1 | 1 | 0 | 0 | 0 | DP side to port-CW (write port-CW) |
1 | 1 | 0 | 1 | 0 | 0 | Not allowed for 8255A-5, but accepted for 82C55 type (read port-CW) |
I already selected the PC bits to these signals (infact that these PC-bits free to used for, but the software must be co-related, if you don't want to be bother of, just follow on). PC-5 bit as usual used for bidirectional enable (this is standard LPT port function), PC-3 bit used for WR signal (note that PC-3 is inverting input), PC-2 bit used for RD signal (this is normal input), While PC-1 and PC-0 used for addressing port (to make the simplicity). PC-1 bit used for selecting address A1 (note that PC-1 is inverting input) and PC-0 used for selecting address A0 (this also an inverting input). The others functions, reset and Chip Select (CS) enable by used the combination of PC-3 and PC-2 bits using gate combination. Tabel-3. Shows this combination bits to meet the operation of PPI-8255 (like tabel-2) .
DP-7 ~ DP-0 | 8-bit bidirectional data port | |||||||
PC-7 (Unused) | PC-6 (Unused) | PC-5 (Bidirectional Enable) | PC-4 (IRQ Enable) | PC-3 (Inv.) Used for | PC-2 Used for | PC-1 (Inv.) Used for A1 | PC-0 (Inv.) Used for A0 | Control port |
X | X | 0 | 0 | 0 | 1 | X | X | Stand-by mode (Hi-Z) |
X | X | 0 | 0 | 1 | 0 | X | X | Reset |
X | X | 0 | 0 | 1 | 1 | 1 | 1 | Writing port-A |
X | X | 1 | 0 | 0 | 0 | 1 | 0 | Reading port-B |
X | X | 0 | 0 | 1 | 1 | 0 | 1 | Writing port-C |
X | X | 0 | 0 | 1 | 1 | 0 | 0 | |
(not allowed for 8255A-5 but accepted for 82C55 type) |
One of the PCB design layout shown in fig.6. This also using a single side PCB, so it has a lot of jumper wire. You can make another design if you want, but this one works well (my prototype).
Fig.6. LPT port expander PCB layout. |
Parts List :
IC's :
Programmable Peripheral Interface PPI-8255 family ...................... 1 pcs Hex inverter (74LS04) .................................................. 1 pcs Quad AND gates (74LS08) ................................................ 1 pcs
Capacitors :
220 uF/16V ............................................................. 1 pcs 100 nF (for IC decoupling - optional) .................................. 3 pcs
Others :
DB-25 Socket female .................................................... 1 pcs Connector 10-pin (sip) ................................................. 3 pairsBefore using the card, the PPI-8255 must be reset first, and then initialized by given the correct Control Word configuration. Because many possible combination mode ever happened to this card so it is quiet difficult to show how to programming this card. Here I only show the combination mode-0 for all of the ports. If you already have built the project of 36-bits led display driver, you can put it to the output port-A through port-C. A sample in assembly program show the demo for the possible combination of mode-0. Here is the sample in pascal program shows the combination of port-A and port-C as output port and port-B as input port, all operate in mode-0. I used this combination in IC tester program.
TYPE
LPT_Port = (LPT_1, LPT_2, LPT_3, No_LPT);
Mode_PPI = (Port_A, Port_B, Port_C, Port_CW, Port_Hi_Z, PPI_Rst);
CONST
PC_Port : ARRAY[0..2] OF WORD =
($03F8,$02F8,$0278); { 'COM1','COM2','LPT1' }
DP : ARRAY[LPT_Port] OF WORD = ($3BC, $378, $278, $3BC); { Data Port }
PS : ARRAY[LPT_Port] OF WORD = ($3BD, $379, $279, $3BD); { Status Port }
PC : ARRAY[LPT_Port] OF WORD = ($3BE, $37A, $27A, $3BE); { Control Port }
Port_PPI : ARRAY[Mode_PPI] OF WORD = ($000F, { Port-A PPI as output port}
$0022, { Port-B PPI as input port}
$000D, { Port-C PPI as output port}
$000C, { Port-CW PPI as output port}
$0004, { Port-Hi-Z PPI }
$0008); { Reset PPI }
Port_A_PPI = $03; { Note that Port-A through Port-CW }
Port_B_PPI = $02; { are inverting to PC-0 and PC-1 }
Port_C_PPI = $01;
Port_CW_PPI = $00;
PROCEDURE Inisialisasi_PPI;
BEGIN
PORT[PC[LPT]] := Port_PPI[PPI_Rst]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[PPI_Rst]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_CW_PPI;
PORT[DP[LPT]] := Set_Mode_PPI;
PORT[PC[LPT]] := Port_PPI[Port_CW]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_CW_PPI;
PORT[DP[LPT]] := Set_Dec_Port_C[Steady_State];
PORT[PC[LPT]] := Port_PPI[Port_C]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_C_PPI;
END;
PROCEDURE Write_Port_A(Datanya : BYTE);
BEGIN
PORT[DP[LPT]] := Datanya;
PORT[PC[LPT]] := Port_PPI[Port_A]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_A_PPI;
END;
PROCEDURE Write_Port_C(Datanya : BYTE);
BEGIN
PORT[DP[LPT]] := Datanya;
PORT[PC[LPT]] := Port_PPI[Port_C]; { Give a pulse }
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_C_PPI;
END;
FUNCTION Read_Port_B : BYTE;
VAR
Temp : BYTE;
BEGIN
PORT[PC[LPT]] := Port_PPI[Port_B]; { Give a pulse }
Temp := PORT[DP[LPT]];
PORT[PC[LPT]] := Port_PPI[Port_Hi_Z]+Port_B_PPI;
Baca_Port_B := Temp;
END;
|
PCB Mounting. I put my prototype on a piece of board like showing in the fig-7. 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.7. LPT port expander prototype card. |
My prototype used a simple regulated power supply from 7805 IC regulator. The complete circuit and layout are shown in fig-8. and the parts list are as follow :
Additional Parts List :
IC's :
Voltage Regulator 7805 ................................................. 1 pcs
Capacitors :
1000 uF/16V ............................................................ 1 pcs 470 uF/25V ............................................................. 1 pcs
Others :
Diode 1N4007 or Brigde diode ........................................... 4 pcs On/Off Switch .......................................................... 1 pcs Transformer p=220V/s=9V, 100mA ......................................... 1 pcs Indicator Lamp 5V ...................................................... 1 pcs
Fig.8. LPT expander card power supply schematic diagram and PCB layout. |
Fig-9. Shows the application for 36-bit leds display driver run the card in mode-0. You can make some experiment for another mode or combination of them by yourself.
Fig-9. LPT Expander card application, running the 36-bit leds display driver in mode-0. |
Last word for expander circuit, this idea comes from the reader, Eugene Lisovy (4RESTER), instead of using two chip for decoding reset and cs signal for PPI using 74LS04 & 74LS08 (we just used only half each), better used one chip, ie.: CD4555 (Dual Decoder/Demultiplexer 1 to 4 channels), it has the same function. Schematic diagram for this chip function is here. Thank's very much Eugene!!! for your excellent suggestion!
Experiment is the best teaching for us to learn. For some people, this is true. A reader above, still searched the capabilities of this expander circuits. He didn't stop to dig the flexibility to run it. I think that his idea must be consider, because it will bring to the new improvement. Besides that, may be his idea is useful for another people too. Here is his experiments :
Now I'm working with project, embedded system, using PC-main board with integrated Video Card & Sound Card. I'm using schematic of LPT PORT EXPANDER, with decoding of LPT->8255 on CD4555. But! For me very important, to 8255 will be RESETED after cold & warm reset! After some experiments I finded easy way!
Looking to attached schematic diagram, that's based on my modification, who I already sent to you a long time ago. But now we have:
Looking to attached schematic diagram, that's based on my modification, who I already sent to you a long time ago. But now we have:
- all function of control of 8255 is also available
- after cold & warm reboot 8255 stable reseted & still in reset state up to OS (Windows also!) will be total launched!
Looking to 1st table in attached schematic diagram. Here I'm descript state of LPT's pins 1,14,16,17 in different levels of restarting (cold & warm is same) computers. As You can see: immediately after rebooting pins 1 & 14 set to HIGH("1") & still unchanged up to total launching windows, & still HIGH up to any Windows software change it. But PINs 16 & 17 is very unstable! Because Windows use this PINs to detect Plug&Play devices on LPT (like LPT_Printer, LPT_Scanner, LPT_to_IDE, e.t.c).
Now we know, good idea use condition: LPT_PIN_1="HIGH" + LPT_PIN_14="HIGH" as reset for LPT_PORT_EXPANDER, based on 8255. Command combination described in 2nd table in attached schematic diagram.
Now we know, good idea use condition: LPT_PIN_1="HIGH" + LPT_PIN_14="HIGH" as reset for LPT_PORT_EXPANDER, based on 8255. Command combination described in 2nd table in attached schematic diagram.
Nice Blog Post !
ReplyDeleteThanks for sharing...
ReplyDelete