Unformatted text preview: challenging problems in a tutorial setting or in a workshop environment. The labs can also be grouped to demonstrate special relationships of advanced devices on certain basic gates. For example, the CPU operation is dependent on the concept of registers and two input operations. This manual includes a complete set of LabVIEW VIs. The text is also included on the CD so that you can customize the material. National Instruments Corporation I-1 Fundamentals of Digital Electronics Lab 1 Gates
Gates are the fundamental building blocks of digital logic circuitry. These devices function by "opening" or "closing" to admit or reject the passage of a logical signal. From only a handful of basic gate types (AND, OR, XOR, and NOT), a vast array of gating functions can be created. The AND Gate
A basic AND gate consists of two inputs and an output. If the two inputs are A and B, the output (often called Q) is "on" only if both A and B are also "on." In digital electronics, the on state is often represented by a 1 and the off state by a 0. The relationship between the input signals and the output signals is often summarized in a truth table, which is a tabulation of all possible inputs and the resulting outputs. For the AND gate, there are four possible combinations of input states: A=0, B=0; A=0, B=1; A=1, B=0; and A=1, B=1. In the following truth table, these are listed in the left and middle columns. The AND gate output is listed in the right column.
Table 1-1. Truth Table for AND Gate A 0 0 1 1 B 0 1 0 1 Q=A AND B 0 0 0 1 National Instruments Corporation 1-1 Fundamentals of Digital Electronics Lab 1 Gates In LabVIEW, you can specify a digital logic input by toggling a Boolean switch; a Boolean LED indicator can indicate an output. Because the AND gate is provided as a basic built-in LabVIEW function, you can easily wire two switches to the gate inputs and an indicator LED to the output to produce a simple VI that demonstrates the AND gate. Figure 1-1. LabVIEW AND Function Wired to I/O Terminal Boxes Run AND gate.vi from the Chap 1.llb VI library. Push the two input buttons and note how the output indicator changes. Verify the above truth table. The OR and XOR Gates
The OR gate is also a two-input, single-output gate. Unlike the AND gate, the output is 1 when one input, or the other, or both are 1. The OR gate output is 0 only when both inputs are 0.
A B A B OR Q XOR Q Figure 1-2. Digital Symbols for the OR and XOR Gates A related gate is the XOR, or eXclusive OR gate, in which the output is 1 when one, and only one, of the inputs is 1. In other words, the XOR output is 1 if the inputs are different. Negation A A Figure 1-3. The NOT Gate An even simpler gate is the NOT gate. It has only one input and one output. The output is always the opposite (or negation) of the input. The NAND, NOR, and NXOR Gates
Negation is quite useful. In addition to the three two-input gates already discussed (AND, OR, and XOR), three more are commonly available. These are identical to AND, OR, and XOR, except that the gate output has been Fundamentals of Digital Electronics 1-2 National Instruments Corporation Lab 1 Gates negated. These gates are called the NAND ("not AND"), NOR ("not OR"), and NXOR ("not exclusive OR") gates. Their symbols are just the symbols of the unnegated gate with a small circle drawn at the output:
A B A B A B Q Q Q Figure 1-4. Negated AND, OR, and XOR Gates Run Truth table.vi. Choose a gate and try all combinations of A and B to complete the following truth tables.
Table 1-2. Truth Tables for the Digital Logic Basic Gates A 0 0 1 1 B 0 1 0 1 AND 0 0 0 1 OR XOR NAND NOR NXOR Building Gates from Other Gates
Given a handful of NAND gates, you can reproduce all other basic logic gates. For example, you can form the NOT gate by connecting both NAND input terminals to the same input: Figure 1-5. NOT Gate Built from a NAND Gate Similarly, you can easily build an AND gate from two NAND gates: Figure 1-6. AND Gate from Two NAND Gates National Instruments Corporation 1-3 Fundamentals of Digital Electronics Lab 1 Gates An OR requires three NAND gates: Figure 1-7. OR Gate from Three NAND Gates Construct a VI that demonstrates that an XOR gate can be constructed from four NAND gates. For reference, see XOR from NAND.vi in the Lab 1 VI library. Gates with More than Two Inputs
Although LabVIEW includes all the basic two-input gates, you may require more inputs. For example, the AND truth table above can be generalized to three inputs:
Table 1-3. Truth Table for a Three-Point Input AND Gate A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 A AND B AND C 0 0 0 0 0 0 0 1 From a pair of two-input AND gates, you can easily build a VI that implements the three-input AND: Figure 1-8. LabVIEW Program for a Three-Input AND Gate Open the VI called 3 AND.vi and notice the socket and icon, making this VI a full-fledged subVI. Fundamentals of Digital Electronics 1-4 National Instruments Corporation Lab 1 Gates Masking
As a simple application of how these basic logic gates can be combined, consider the concept of masking. To illustrate this concept, below is...
View Full Document
- Spring '09