Note 5 Digital Electronic Devices Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 1
1. Binary and Hexadecimal Numbers Digital systems perform calculations and regulate their operation by using the binary base. As such digital circuits have two possible signals levels, usually 5 V and 0 V, to represent 1 and 0 binary numbers. Transistors are used for building digital circuits. The binary system is based on just two symbols or states: 0 and 1. These are called binary digits or bits. If a number is represented by this system, the digit position in the number indicates that the weight attached to each digit increases by a factor of 2 as we proceed from right to left.... 2 3 2 2 2 1 2 0 bit 3 bit 2 bit 1 bit 0 For example, the decimal number 15 in the binary system is 1111. In a binary number the bit 0 is the least significant bit (LSB) and the highest bit the most significant bit (MSB). The hexadecimal system can be used as a more efficient representation of a binary number and each hexadecimal digit corresponds to four binary digits. The hexadecimal system is based on 16 digits/symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(=10), B(=11), C(=12), D(=13), E(=14), F(=15). If a number is represented by this system, the digit position in the number indicates that the weight attached to each digit increases by a factor of 16 as we proceed from right to left.... 16 3 16 2 16 1 16 0 The following tables show part of the equivalence among Decimal, Binary, and Hexadecimal numbers. Decimal Binary Hexadecimal 1 1 1 2 10 2 3 11 3 4 100 4 5 101 5 6 110 6 7 111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E Decimal Binary Hexadecimal 15 1111 F 16 10000 10 17 10001 11 18 10010 12 19 10011 13 20 10100 14 21 10101 15 22 10110 16 23 10111 17 24 11000 18 25 11001 19 26 11010 1A 27 11011 1B 28 11100 1C Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 2
To convert from an integer decimal numeral to its binary equivalent, we can divide the number by 2 and write the reminder in the ones-place; and then divide the result by 2 and write the reminder in the next place to the left, (repeating this process until the result becomes 0). Example 1 Convert the decimal number of 217 to its binary equivalent. Example 2 Do the addition of 1001,1010 + 0011,1111. 2. Logic Devices AND, OR, NOT(inverter), NAND, and NOR are the most common logic gates in digital electronics. Usually, the gates have 2 inputs and one output. The gates, their symbol and their logic operations are summarized below. AND Gate: A HIGH output (1) results only if both the inputs to the AND gate are HIGH (1). If neither or only one input to the AND gate is HIGH, a LOW output results. The Boolean equation for the AND gate is: out = A B, and its truth table (i.e., a table used to represent the relationship between inputs and output of a logic gate) is given as follows. Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 3
OR Gate: A HIGH output (1) results if one or both the inputs to the gate are HIGH (1). If neither input is HIGH, a LOW output (0) results.the Boolean equation for the OR gate is: out = A + B, and its truth table is given as follows. NOT Gate: A HIGH output (1) results if the input is LOW (0). If the input is HIGH (1), a LOW output (0) results. The Boolean equation for the NOT gate is: out = A, and its truth table is given as follows. A out 0 1 1 0 NAND Gate: A LOW output results only if both the inputs to the gate are HIGH. If one or both inputs are LOW, a HIGH output results.the Boolean equation for the NAND gate is: out = A B, and its truth table is given as follows. Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 4
NOR Gate: A HIGH output (1) results if both the inputs to the gate are LOW (0). If one or both input is HIGH (1), a LOW output (0) results.the Boolean equation for the NOR gate is: out = A + B, and its truth table is given as follows. A B out 0 0 1 0 1 0 1 0 0 1 1 0 As an example, the following figure shows the view and element placement of the popular chip 7400. The chip contains four NAND logical gates. The two additional pins supply power (+5 V) and connect the ground, respectively. Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 5
Example 3 In a computer bus system, a decoder is a device for selecting components. Once a computer places the address of a device on the bus, the decoder that is attached to each device checks the address and gives logic 1 output if it is the addressed device. Thus, only one decoder gives logic 1 output in response to a unique address in the bus. The following figure shows an 8-bit address decoder circuit implemented with NOT and AND gates. What is the address of the component selected by this decoder? Example 4 The following figure shows a multiplexer, which is a device to connect one of the multiple input lines (i.e. Ch 1, Ch 2, Ch 3, and Ch 4) to the output line (i.e. Output) based on the address placed on the channel select (i.e. A and B). What are the digital codes on A and B in order to select Ch 1, Ch 2, Ch 3, and Ch 4, respectively? Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 6
3. Flip-Flops The flip-flop is a basic memory element which is made of an assembly of logic gates. There are a number of forms of flip-flops, including RS-Type Flip-Flop and D-Type Flip- Flop. RS-Type Flip-Flop A Reset-set flip-flop has two inputs (R and S) and two outputs (Q and Q ). The logic between the input and output terminals is as follows: if there is a rising edge (0 1) present in the S-input while R = 0, then Q = 1; and if there is a rising edge present in the R-input while S = 0, then Q = 0. S R Q Q Rising edge (0 1) 0 1 0 0 Rising edge (0 1) 0 1 1 1 Not allowed Others No change As a simple illustration of the use of a flip-flop, consider a simple alarm system shown in Figure 1. In this system, an alarm sounds when a beam is interrupted and remains sounding even when the beam is no longer interrupted. A phototransistor is used as the sensor and so connected that when it is illuminated it gives a 0V input to S but when the illumination ceases it gives about 5 V to S. When the light beam is interrupted, S becomes 1, the output from the flip-flop becomes 1 too, and the alarm sounds. The output will remain as 1 even when S change to 0. The alarm can only be stopped if the reset switch is momentarily opened to produce a 5 V input to R. Figure 1: Alarm system using a SR flip-flop Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 7
D-Type Flip-Flop A D-type flip-flop has two inputs (D and E/CLK) and two outputs (Q and Q). The Q- output takes on the state of the D-input (or the state of D-input is transferred to Q-output) when there is a rising edge (0 1) present in the E-input. Otherwise, Q-output maintains its previous state. E/CLK D Q Q Rising edge 0 0 1 Rising edge 1 1 0 Non-Rising X No change ('X' denotes a Don't care condition, meaning the signal is irrelevant) D-type flip-flops can be used in groups to form n-bit data buffers (Figure 2). Data are placed in the data bus (D 0, D 1, D n-1 ), and then E-line is pulsed to latch the data in the D-flip-flops. After that, the changes in the data bus do not affect the output of the D-flipflops (latched data) until a new pulse is present in the E-line again. Figure 2: n-bit data buffers using D-type flip-flops Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 8
4. D/A and A/D Converters A D/A converter converts digital numbers to analog signals (generally voltage signals). A A/D converter does the opposite, i.e. converting analog signals to digital numbers. The D/A and A/D converters are essential components in interfacing digital world to analog world. The quantization error is due to the finite resolution of a converter and is an unavoidable imperfection in all types of converter (Figure 3).The resolution of a converter is defined as the finest voltage that the converter can convert to or recognize. Suppose the voltage range of the converter is denoted by V range, the resolution of an n-bit D/A or A/D is then given by Resolution = V range n 2 1 Figure 3: Quantization error of D/A and A/D converters For the converter, the relationship between the analog voltage and digital number is D/A converter: Analog voltage = Digital number Resolution A/D converter: Digital number = round (Analog voltage/resolution) Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 9
Example 5 Given an 8-bit A/D converter with an input voltage range from 0 V to 10 V, find resolution of the converter and the binary number converted from an input voltage of 3V. If the A/D converter is 12-bit wide, do it again. Example 6 Consider the circuit shown below. The op-amp has an output saturation of ±12V; and the A/D converter is a 5-bit one with an analog span of 0 to 10V. Find the binary number obtained from the A/D converter. 10V 4.7 K 5K V 1 10M 5 K 1M _ V 2 V 3 + 1M 10M 5K 5-bit A/D 0-10V Department of Mechanical Engineering, University Of Saskatchewan, 57 Campus Drive, Saskatoon, SK S7N 5A9, Canada 10