This preview shows page 1. Sign up to view the full content.
Unformatted text preview: the AND truth table with relabeled column headings.
Table 1-4. Truth Table for AND Gate with One Input as a Mask A 0 1 0 1 Mask 0 0 1 1 A AND B 0 Effect A is blocked Gate is "closed" 0 0 A is unchanged 1 Gate is "open" The truth table makes the point that the AND gate can be used as an electronic switch. This point is easily demonstrated in LabVIEW: Figure 1-9. AND Gate Used as an Electronic Switch Load and run E-switch.vi to observe the electronic switch in action. You can view the truth tables of other gates from a masking point of view as well. In the following table, reset means "forced to 0" while set means "forced to 1":
Table 1-5. Truth Table for AND, OR and XOR Gates with One Input as a Mask A 0 1 0 1 Mask 0 AND A is reset OR XOR A is unchanged A is unchanged 0 1 A is unchanged 1 A is set A is inverted In summary, there are three useful functions here. To set a state, use OR with a mask of 1. To reset a state, use AND with a mask of 0. To invert a state, use XOR with a mask of 1. National Instruments Corporation 1-5 Fundamentals of Digital Electronics Lab 1 Gates Application: Data Selector
Another simple application of basic gates is the data selector, in which a single digital input selects one of two digital streams: Figure 1-10. A Digital Data Selector Built with Basic Gates LabVIEW includes a built-in function, called Select, to emulate this operation. Thus, you could rewire the above as: Figure 1-11. LabVIEW's Version of a Digital Data Selector Name that Gate
The gates in this section form the foundation of much of digital electronics. A complete familiarity with the truth tables is extremely useful. As a review, test your skills with the Name that gate VI. Lab 1 Library VIs (Listed in the Order Presented) AND gate.vi (two-input AND operation) Truth table.vi (for AND, OR, XOR, NAND, NOR, and NXOR) XOR from NAND.vi 3 AND.vi (three-input AND operation) Masking.vi (demonstration) E-switch.vi (electronic switch) Data select.vi (data selector using basic logic gates) Data select2.vi (data selector using the LabVIEW Select function) Oscillator.vi (subVI used in Data select.vi) Name that gate.vi (test your knowledge) Fundamentals of Digital Electronics 1-6 National Instruments Corporation Lab 2 Encoders and Decoders
An encoder converts an input device state into a binary representation of ones or zeros. Consider a rotary switch with 10 positions used to input the numbers 0 through 9. Each switch position is to be encoded by a unique binary sequence. For example, switch position 7 might be encoded as 0111. A decoder performs the opposite conversion, from binary codes into output codes. Consider the case of a single die. On each of its six sides, one of the following patterns appears, representing the numbers 1-6. Figure 2-1. The Six Sides of a Die These patterns are traditional. They can be thought of as seven lights arranged in an "H" pattern: Figure 2-2. Dot Arrangement Used in Dice Codes By turning on the appropriate lights, you can create any of the six patterns on the face of a die. National Instruments Corporation 2-1 Fundamentals of Digital Electronics Lab 2 Encoders and Decoders On closer inspection, there are only four unique patterns from which the pattern for any face can be formed. Call these base patterns A, B, C, and D: A B C D Figure 2-3. Four Base Patterns Used in Dice Codes If you write down the truth table, for the presence or absence of these base patterns as a function of die face, the meaning of these base states becomes clear.
Table 2-1. Base States Used for Each Die Number Die Face 1 2 3 4 5 6 A B C D The base pattern A is used by all odd numbers (1, 3, and 5). Pattern B is in the representation of all of the numbers except 1. Base pattern C is found in the numbers 4, 5, and 6. Pattern D is used only when representing 6. The Die
To build a virtual die, place seven LED indicators in the "H" pattern on the front panel, together with four switches. On the diagram page, the LED terminals are wired to display the four unique patterns A, B, C, and D. The four switches on the front panel can now simulate turning on and off the base patterns. Figure 2-4. LabVIEW Front Panel for Virtual Die Display Fundamentals of Digital Electronics 2-2 National Instruments Corporation Lab 2 Encoders and Decoders Figure 2-5. LabVIEW Block Diagram to Implement Virtual Die Display Load the VI Display.vi and observe the operation of the virtual die. Modulo 6 Counter
A modulo 6 counter is any counter with six unique states that repeat in sequence. You can build a simple modulo 6 counter using a three-element shift register with the last element output inverted and feedback into the first element input. (Such a counter is often called a switched tail ring counter.) Open a new LabVIEW VI. Place three LED indicators on the front panel. These will show the output state of the shift register elements called Q1, Q2, and Q3. On the block diagram, use a shift register with three elements,...
View Full Document
- Spring '09