• No results found

Testing the Parallel Port

3.3 Parallel Port Interface

We will often need to check the correct operation of our programs during their software development cycle. The interface board has circuitry that allows us to test the functionality of the entire parallel port and thus provide feedback on program execution. A block diagram of this circuit is shown in Figure 3-6.

The signals from the parallel port are connected through the interface cable to the interface board D25 connector. From here, eight of the signals connect with a Buffer integrated circuit. These signals are generated by writing data to the BASE address. A second Buffer IC on the interface board is used to send five signals to the PC’s BASE+1 Address, via pcb tracks connected to the D25 connector. A further four signals controlled by the BASE+2 address, pass through the D25 connector to individual resistors. This part of the port can both output data or input data.

Permanent damage often occurs when output pins of IC’s are accidentally connected together without any means of limiting the resulting currents. Resistors are connected in series with BASE+2 signal lines to limit the currents and minimise damage should any of these lines from the PC be improperly connected to other outputs on the interface board.

Note that the two 8 way Buffer ICs shown in Figure 3-6 also have pull-up resistors fitted to their input pins (resistors not shown). Their function is explained in the Parallel Port Interface section of Appendix A.

Ground Output Voltage Input Voltage Voltage Regulator (Stabiliser) 0V ~ +12V 0V +5V

Figure 3-6 Parallel Port Interface & LED Driver Block Diagram.

The circuitry shown in Figure 3-6 has small pins with dots at their ends. These dot symbols represent printed circuit board pins that allow interconnection between other circuits on the board. This is made possible by using an interconnecting lead (shown in Figure 3-7) to connect between pins. You can fabricate these leads as required by following the instructions given in Appendix A.

Each connection made with an interconnecting lead connects an output pin of a circuit to an input pin of another circuit. DO NOT at any time connect outputs pins to other outputs pins. Doing so will most likely damage the components involved.

Figure 3-7 Interconnecting Lead.

25 cm INTERFACE Board 8 wires (pcb tracks) 8 way Buffer IC 8 interconnect leads 8 way Driver IC 8 Resistors/LEDs 5 wires (pcb tracks) 8 way Buffer IC Pcb Interconnect Pins BASE+2 (In/Out)

To BASE+1 (Input to PC

)

From BASE

(Output from PC)

Vcc

LED Driver Circuit Parallel Port Interface

D25 Connector (Female)

Also shown on the diagram of Figure 3-6, is a resistor and light emitting diode (LED), representative of a group of eight such devices. This circuit is used to indicate the state of data coming from the PC or the interface board itself. Check the data generated within the interface board by connecting the relevant output pins of the circuit to individual resistor and LED pairs.

To test programs that read data into the PC through the parallel port, the interface board has a number of pcb pins permanently connected to either +5V or GND. This arrangement allows us to test any of the four or five input bits of the PC parallel port that use BASE+1 and BASE+2 addresses respectively.

Proceed to assemble the parallel port hardware and test for correct operation. Appendix A contains the schematic diagram, hardware assembly and test instructions for this circuitry. Several interconnect leads will need to be made for test purposes.

3.3.1 LED Driver Circuit

Figure 3-6 shows eight logic outputs (that originate from the parallel port) connected to a Buffer via pcb tracks. Unfortunately, like most digital logic circuits, a single logic output from the parallel port circuit does not have the capacity to pass sufficient current through a LED; hence the need for the Driver IC. Each output pin from the Buffer is connected to an individual pcb pin. The interconnect lead wires connect the Buffer output pins to the input pins of the LED Driver IC. The Driver used on this board has the part number ULN2803A. It houses a bank of internal transistors, each one well suited to accept the limited current from a logic output pin and then to drive a LED. Most LEDs require between 5mA and 20mA of current through them to glow with adequate brightness. The ULN2803A Driver switches current flow independently through each of the eight LEDs and resistors, and operates as follows:

1. When a Driver input pin (on the left side of the Driver) is taken to a high

voltage level, the corresponding output pin is switched internally to ground voltage. This allows current to flow from Vcc (equal to +5V), through the LED, and resistor, and through the Driver output pin to ground, causing the LED to glow.

2. When the Driver input is driven to a low voltage level, the corresponding output pin connection path to GND will become highly resistive. This reduces current flow through the LED and resistor to extremely low levels and extinguishes the glow of the LED.

3.3.2 LED Operation

A minimum amount of current needs to flow through a light emitting diode (LED) for it to light. LEDs, like most diodes, conduct significant levels of current in one direction only during normal operation. The current flows from the anode (denoted by a triangle) to the cathode (denoted by a bar) as shown in Figure 3-8.

Figure 3-8 Conventional Current through a LED.

For current to flow in this direction, the anode must have a more positive voltage applied than the voltage at the cathode (known as forward voltage, VF). This

difference in applied voltage (VF) typically needs to be approximately 2V for most

LEDs and approximately 0.7V for ordinary diodes, if they are to conduct.

Figure 3-9 Typical LED characteristic curve (without a series resistor).

A characteristic curve for a LED is shown in Figure 3-9. This curve shows the current through the LED and voltage across the LED for its normal range of operation, indicated by the bold portion of the curve at the right side of the current axis. When using the LED in its normal operating range, an increase in current through the LED will increase its light output. When the current exceeds the maximum limit for the LED (indicated by the value IF), the device will be

destroyed. A current limiting resistor, shown in Figure 3-10, is used to control the current and prevent failure due to excessive current.

Note that if we reverse the voltage applied across the LED, we will reach the LEDs

reverse breakdown voltage (VBR, shown as –5V in Figure 3-9). Once the reverse

breakdown voltage has been exceeded, reverse current will increase to the point at which the device is destroyed (IR).

anode cathode i VBR -5V VF(LED) 2V IF IR Current (I) Voltage (V) Normal Operating Range of LEDs

When we generate sufficient forward voltage to make the LED conduct, we say we have biased the device to operate. As mentioned previously, the LED will be destroyed if we do not use a resistor to limit the current flowing through it. The amount of current flowing through a resistor depends on the voltage across it. Since the LED and resistor are connected as shown in Figure 3-10, they share the same current. This circuit arrangement is known as a series circuit. Current through this circuit is analysed as follows.

If we know the voltage across the resistor we can work out the current flowing through it (and the LED) since Current = Voltage/Resistance.

Figure 3-10 Current flow through the Series Circuit.

We know that the voltage across a conducting LED is approximately 2V and we also know that the total voltage across the series circuit from VCC to Ground is 5V. Therefore, the voltage across the resistor is:

5V – 2V = 3V

The current (I) through a resistor is given by voltage across the resistor, divided by its resistance in Ohms (:):

i.e. I = 3V / 330 : = 0.009 A (amperes are denoted by the symbol A.) The currents flowing in electronic circuits are often small fractions of an ampere and so the units of milliamps (mA) which is 1/1000th of an amp are commonly

used. Thus we have 0.009 amps which is 9 milliamps flowing through the LED and resistor.

Proceed to assemble and then test the hardware for the LED Driver circuit along with at least eight interconnecting leads, as explained in Appendix A.