Digital Fundamentals Input/Output Connections Supplement Prepared by Mike Crompton (Revised 24 September 2008 ) Inputs to logic circuits may come from mechanical switches. Outputs are often displayed with either single LEDs (light emitting diodes) or seven-segment LED displays. The voltage levels for a Hi and a Lo at the inputs and outputs of gates are also important. The simple circuit shown at right illustrates an example of Ohm’s Law that can be puzzling. If we measure the voltage when the wire is NOT connected (i.e. an open circuit) we would see the supply voltage, in this case 5V. This is because there is NO VOLTAGE DROP across the resistor. The formula (Ohm’s Law) to calculate voltage drop is V = I x R. Since the circuit is open there is no current flow so (I) 0A x 1000Ω (R) = 0Volts drop so we will see the total of the supply voltage. By comparison if we measure the voltage when the wire is connected (a short circuit) we will get 0V. The voltage across a short circuit is always 0V because of the same law. V = I x R and with a short circuit R is 0Ω so V is 0V. These results are not what is normally expected, but Ohm’s and series laws confirm it. When the switch is open no current flows therefore there is no voltage drop across the resistor. Since the sum of the individual voltage drops equals VSUPPLY and there is no voltage across R, all the voltage must be across the switch. When the switch is closed it represents zero resistance and since V = I x R the voltage across the switch is 0.005 x 0 = 0V. We tend to think of an open switch being ‘Off’ and a closed switch as being ‘On’, but in this case the open switch would put +5V (a 1) on the I/P to a gate and a closed switch 0V (a 0). Individual Light Emitting Diodes are available in a variety of colours. They can only pass current through them and light up when the correct polarity of voltage is applied to their terminals. For the LED to light the anode must be more positive than the cathode. The anode is the large black triangle in the diagram at right and the cathode is the ‘minus’ sign at the bottom. Which lead is which on the actual LED is also shown in the diagram. When lit the LED represents almost no resistance so an excessive amount of current will flow and burn out the LED if precautions are not taken. The resistor in the diagram must be included but its value can change somewhat (100Ω is a popular value). It’s purpose is to limit the amount of current flowing through the LED. There are two ways to connect a LED to the output of a gate (both work to a degree but one is the preferred way). The configuration at right is called "current sourcing" because the current (conventional current flow not electron current flow) for the LED comes from the power supply into (through) the gate and then out of the gate to the LED. i.e. The gate is the ‘source’ of power for the LED. A 74LS-- gate can only "source" about 0.4 mA without losing output voltage due to voltage drop within the gate 2 The method shown at right of driving the LED is called "current sinking" since the LED current (conventional) flows from the 5V supply into the gate output and then “sinks” to ground through the gate. A 74LS-- gate can typically "sink" about 8 mA (20 times more). This technique (sinking) is preferred over the previous (sourcing). A second inverter would be required at the gate output to allow the LED to light when the gate O/P is Hi. I/Ps to a logic gate should not be left unconnected or ‘Floating’. In many cases a floating I/P will automatically register a Hi (1) which is probably the exact opposite of what was intended. This can happen when a switch is connected to the I/P. When open the switch leaves the I/P open allowing it to ‘float’. To prevent this the gate I/P is connected directly to the +5V supply through a ‘Pull Up’ resistor. (Usually a 1kΩ). A switch is then connected with one terminal to ground and the other terminal to the gate I/P. When the switch is open there is no current flow through the resistor and, as described above, there is therefore no voltage drop and the gate I/P is instantly ‘pulled up’ to +5V (a 1). If the switch is closed it puts the Gate I/P directly to ground which of course is 0V (a 0). The circuit at right shows the ‘pull up’ configuration. Another variation of this method of connection uses a ‘Pull Down’ resistor. The gate I/P is connected directly to ground through the 1kΩ resistor, one switch connection goes directly to the +5V the other is connected to the gate I/P. When the switch is open the gate I/P is ‘pulled down’ to ground 0V (a 0) and when closed it is connected directly to the +5V (a 1). This is shown at right. The Logic Trainers must comply with the preferred method of connecting output LEDs, also input switches to prevent gate I/Ps from momentarily ‘floating’. The internal wiring and components of the trainers are configured to satisfy these requirements. At right is a diagram showing the actual circuitry inside the trainer. In the ‘real life’ experiments of the Digital Electronics Labs, an incorrect circuit may function for a period of time after which the chip can become overheated and ‘blow’. No professional logic circuit designer would fail to follow these conventions when creating logic circuits, so this must also apply equally to students building circuits in the lab exercises. 3