Back to Aleksandar Masnikosa HP Back to GeoCities

LED DIODES DISPLAY

Introduction

Parallel port description

Resolving problems

Technical Aspects

Programming

INTRODUCTION

The basic idea was to construct atractive and cheap gadget for a PC. As parallel port is the easiest way to comunicate with outer world I' ve decided to connect an array of LED diodes to it and experiment a little.

PARALLEL PORT DESCRIPTION

On standard 4-bit parallel port you have 12 outputs (D0-D7,strobe,autofeed,init. printer, select input) and 5 inputs (busy,select,paper end,error) 5-th input (acknowledge ACK) will generate IRQ on raising edge (changing from 0 to 1) if you enable IRQs by setting bit 4 of control port(0x27A,0x37A,0x3BE) and if you want to write ISRs you have to enable CPU reacting to IRQs from parallel port and you will do that by resetting(giving them a value of 0) bits 7 or 5 of port 0x21 depending on IRQ line your port is using. Here is a table of ports and inputs/ouputs:

Data Port bits
0x378,0x278,0x3BC
7 6 5 4 3 2 1 0
signals D7 D6 D5 D4 D3 D2 D1 D0
parallel connector pins 9 8 7 6 5 4 3 2
Input / Output O O O O O O O O

Tab 1:Data port bits and pins

Status Port bits
0x379,0x279,0x3BD
7 6 5 4 3 2-0
signals BUSY -ACKNOWLEDGE
PE
(paper end)
SELECT
(SLCT)
-ERROR -
parallel connector pins 11 10 12 13 15 N.C.*
Input / Output I I I I I -

Tab 2:Status port bits and pins

*N.C- not connected

Control port bits
0x37A,0x27A,0x3BE
7-5

4

3

2

1

0

signals N.C. IRQ ENABLE
-SELECT
INPUT
INITIALIZE
PRINTER
-AUTO FEED -STROBE
parallel connector pins N.C. N.C. 17 16 14 1
Input / Output - - O O O O

Tab 3:Control port bits and pins

NOTE:The "-" sign in front of STROBE, INITIALIZE PRINTER and SELECT INPUT outputs means that the logical value on the corresponding pin would be inverted (rather than their describes signal's active states). Simply: if bits 0,1 or 3 of the control port are set (equal to 1, logical TRUE) then the voltage on the corresponding pins would not be +5V but 0V and if they are reset (equal to 0, logical FALSE) the voltage on corresponding bits would be +5V. On the other side, bit 2 of this port just like bits 0 to 7 of the data port represent normal state of the corresponding pins on parallel connector. BUSY as input signal behaves similar to STROBE, INIT PRINTER and SELECT INPUT outputs. Its value read from status port bit 7 represent the opposite logical state than it is on the pin 11 of parallel port conector- if you connect pin 11 to +5V voltage and read vaue from status port- yo will get a 0 rather than 1(which represent logical true) it is the same just the other way around: if you connect bit 11 to 0V you will read 1 from bit 7 of status port.


RESOLVING PROBLEMS

As we have 12 outputs we can directly (without additional hardware) control 12 lines, giving them ON/OFF states. So if we connect 12 diodes with common cathode and their anodes connected each on one output all we can have is 3X4 or 2X6 array-not good for displaying anything but binary numbers or state of certain bits. On the other side the nature of the display itself and of the human eye gives us certain advantages.

Let's recall the abilities of human eye - 25 frames per second, display doesn't control any hardware that requires constant on or off voltages - so here we are. If we could connect diodes in some other way then explained above(with common anode or cathode) thus taking advantages mentioned earlier we could create interesting device. The keyboard and connections of displays on digital watches crossing your minds yet?

If we connect all cathodes in every row together on the one, and all anodes in every column together on the other side, connecting them to 12 outputs of parallel port we could have the array of 6X6 or 7X5 diodes. Knowing the fact that all the figures from 0..9 and capital letters of english alphabet could be represented with a 5X5 array, logical conclusion is 7x5(fig.1).

       cathodes
      1 2 3 4 5 6 7
      | | | | | | |  
 a 1 -O-O-O-O-O-O-O
 n    | | | | | | |
 o 2 -O-O-O-O-O-O-O
 d    | | | | | | |
 e 3 -O-O-O-O-O-O-O
 s    | | | | | | |
   4 -O-O-O-O-O-O-O 
      | | | | | | | 
   5 -O-O-O-O-O-O-O 

fig. 1:7x5 LED-diode display

Question: What if we want to turn on diode with coordinates 1,1(row, col. respectively)?

Answer : We would connect 1st column of cathodes to 0V (GND or -) voltage and first row of anodes with +5V?

Question: What if we want to turn both 1,1 and 3,3 diodes?

Answer: Corresponding to previous answer we would connect 1st and 3rd column to 0V and 1st and 3rd row with +5V.

Question: Hey, what would happen with 1,3 and 3,1 diodes - they would be turned on also?

Answer:Naturally but not necesserely. We could use the scanning algorythm and inertion of human eye. First we would connect 1st row to +5V and then connect 1st column to 0V(fig 2), then we would disconnect 1st row (or connect it to +0V which is the same because diode conducts current only in one way) thus turning off every diode in 1st row . Immediately after that we would connect 3rd row to +5V, and 3rd column to 0V(fig.3). Assuming that we do all that in less than 1/25 of second we would fool our eyes as well as anybody's giving them illusion of simultaneous turning on both diodes.

      1 2 3 4 5 6 7
      0V    
       | | | | | | | 
+5V 1 -X-O-O-O-O-O-O
       | | | | | | |
    2 -O-O-O-O-O-O-O
       | | | | | | |
    3 -O-O-O-O-O-O-O
       | | | | | | |
    4 -O-O-O-O-O-O-O 
       | | | | | | | 
    5 -O-O-O-O-O-O-O 

fig. 2

      1 2 3 4 5 6 7
           0V  
       | | | | | | | 
 0V 1 -O-O-O-O-O-O-O
       | | | | | | |
    2 -O-O-O-O-O-O-O
       | | | | | | |
+5V 3 -O-O-X-O-O-O-O
       | | | | | | |
    4 -O-O-O-O-O-O-O 
       | | | | | | | 
    5 -O-O-O-O-O-O-O 

fig. 3


TECHNICAL ASPECTS

Knowing all of the above we can approach some technical aspects of device. First the voltages. standard LED draws about 100mA and considering that we don't want to damage parallel port and/or burn out diodes we will connect in serial with every column output one resistor o about 150 ohms. One 25-pin sub D male connector is also needed together with approximately 1 m(3 ft) of parallel cable(the one that comes in colors)with 13 wires or any other 13 wires if you don't have parallel cable. As for the mechanical construction of the display you can print a board or use a universal experimenting board. I myself used a plastic panel. First I've drilled holes 5mm in diameter (depending on diodes used), then put them one by one and soldering them.

output line D6 D5 D4 D3 D2 D1 D0
RESISTORS (150 Ohms)


STROBE

 | | | | | | |
 R R R R R R R
 | | | | | | |
-O-O-O-O-O-O-O
 | | | | | | |
-O-O-O-O-O-O-O
 | | | | | | |
-O-O-O-O-O-O-O
 | | | | | | |
-O-O-O-O-O-O-O
 | | | | | | |
-O-O-O-O-O-O-O
AUTO FEED
INIT. PRINT.
SLCT. INPUT
D7

fig4: Connections with parallel port

NOTE:It appears that botom row(5th) shines better than others due to the fact it is connected to D7 line of data port (which is probably best made because it is most often used).


PROGRAMMING

As for programming this device it is the deus ex machina. Without propper software all you could see would be 7 or 5 diodes lit at one time and giving considerably less light than they do with program. Not much to say- if you want to turn on a diode you must set its corresponding column bit to 0 and its corresponding row bit to 1 (if controlled with D7 or INITIALIZE PRINTER) line or 0 (if controlled with STROBE, AUTO FEED or SELECT INPUT ) for they are inverted [see above] notes

SOME PRACTICAL ADVICES

Be sure your program works in loop - otherwise you would be able to see only one line at a time. For examle:

var i,j:integer;
     ch:char;
uses crt;
begin 
  repeat
    for i:=0 to 4 do
      for j:=0 to 6 do
          CellOn(i,j);
    if KeyPressed then ch:=ReadKey;
  until ch=#27;    {ASCII for escape}
end;

If you want to use display for numbers and letters it is better to use HorizontalScan because it lites one row at a time thus giving more speed to program acquiring more possibilities. It is useful for displaying figures and letters.

program NumberDisplayTest;
uses DisPara;
var i,j,Number,waitcnt,Pause:byte;
    TestScanArr:TScanLine;
    ch:char;
begin
   Pause:=0;
   for i:=0 to 6 do TestScanArr[i]:=0;
   DisplayOff;
   ClrScr;
   TextMode(511);
   repeat
     if KeyPressed then
     begin
       ch:=ReadKey;
       case ch of
         'q':if Number>0   then dec(Number);
         'a':if Number<$23 then inc(Number);
         'w':if Pause>0   then dec(Pause);
         's':if Pause<$ff then inc(Pause);
       end;
     end;
     if Number>9 then Number:=0;
     begin
       for waitcnt:=0 to 0 do   {experiment with TO values}
       for i:=0 to 4 do
       begin
         for j:=0 to 4 do       {this one scan horizontally through array}
         begin
           if NumberImagesArray[Number,i,j+0]=1 then
           begin
             GotoXY(1+(Number*5+j) mod 75,(Number div 15)*6+i+2);
             Write('*');
             GotoXY(10,40);write('Pause:=',Pause:5);
             TestScanArray[j+0]:=1;
           end
           else
           begin
             TestScanArr[j+0]:=0;
             GotoXY(1+(Number*5+j) mod 75,(Number div 15)*6+i+2);
             Write(' ');
           end;
           Delay(Pause);
         end;
         HorizontalScan(TestScanArray,i);
       end;
     end
  until ch=#27;
  DisplayOff;

end.

Use TheWorldIsYoursScan for advanced applications like scrolling in

horizontal or vertical ways. You can even make certain diodes blink

(giving them attribute in the TScreenArray type of your variable).

At this point I would like to encourage you to contact me if you are interested in building this device. It is very very cheap - here in Yougoslavia I've spent 15 DM ($8) for it and I believe that it is as cheap as anywhere in the world. If you have suggestions considering functions and/or procedures that could enter DisPara unit please let me know. The information given here is free of charge or any uncommercial use as long as you contact me and let me know what it will be used for. Also let me know if you have ideas concerning other parallel port devices especially if you made one.


WARNING: All of the facts given above represent standard parallel port(4 bit) and cannot be applied to other types of ports and/or protocols (8 bit bi-directional port, EPP, ECP, etc.) without changes. The author of this document can not be responsible of any damage caused by implementation of this document or misunderstanding the facts given above.

Back to Aleksandar Masnikosa HP Back to GeoCities


Aleksandar Masnikosa

My Email

1