National instruments corporation 12 3 fundamentals of

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: plement A. Figure 12-4. LabVIEW VI to Load A with 5 Then Complement A The first instruction, Load A with 5, is accomplished with the AND function and a mask of (1111 1111). The binary value for 5 (0000 0101) is placed into the initialization register, and the mask $FF into R1. ANDing these registers loads R1 with 5 and places its value into the accumulator. Complement is the XOR function with a mask of $FF. Load and run the VI,, to see the operations. The complement of A appears in the label Accumulator*. Addition The ALU not only executes logic operations, but also the arithmetic operations. Recall from Lab 3 that binary addition adds the individual bits using the XOR function and calculates any carry with an AND function. Together, these two functions can be wired as a half adder (that is, bit 1 + bit 2 = a sum + a carry (if any)). To propagate bit addition to the next bit place, a full adder is used, which sums the two input bits plus any carry from the previous bit place. The VI named adds addition to the ALU operations. The full adder shown below adds the two input bits plus a previous carry using the Boolean shift register. A new instruction, Fundamentals of Digital Electronics 12-4 National Instruments Corporation Lab 12 Central Processing Unit {ADD +1,A}, can now be added to the list of operations and added to the Case structure. Figure 12-5. ALU Operation: ADD with Carry Binary Counter Consider a software program to generate the binary patterns of an 8-bit binary counter. It might be coded as "after clearing the accumulator, add one to the accumulator again and again" for n times. In a linear programming language, the program might read Start Loop CLEAR A INCA REPEAT Loop N : reset all bits in the accumulator to zero : add +1 to accumulator : repeat last instruction n times ANDing a register with $00 will reset that register, CLEAR A. In the CPU list of instructions, the AND operation is case number 1. INC A is the ADD +1,A instruction, CPU operation number 3. The simulation VI is shown below. Figure 12-6. LabVIEW VI of an 8-Bit Binary Counter Note that the carry has not been wired. The INCREMENT instruction does not affect the carry. By wiring the carry, the instruction would correctly be National Instruments Corporation 12-5 Fundamentals of Digital Electronics Lab 12 Central Processing Unit written as ADD +1,A. Load and run the simulation VI,, and watch yet again the binary counter. A Wait loop has been added so that the user can easily see the action as the VI is run. Figure 12-7. Front Panel for a LabVIEW Simulation of an 8-Bit Binary Counter LabVIEW Challenge Design a LabVIEW program to simulate the addition of two 16-bit numbers. Lab 12 Library VIs (Listed in the Order Presented) (LabVIEW simulation arithmetic and logic unit, AND, OR, and XOR) (ALU simulation with concise programming format) (ALU simulation with AND,OR, XOR, and ADD operations) (LabVIEW CPU simulation: load A with 5, complement A) (LabVIEW CPU simulation of a binary counter: clear A, ADD 1 to A) Half (subVI used in CPU add operation) Full (subVI used in CPU add operation) Fundamentals of Digital Electronics 12-6 National Instruments Corporation Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. Title: Edition Date: Part Number: Principles of Digital Electronics March 1998 321948A-01 Please comment on the completeness, clarity, and organization of the manual. ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ If you find errors in the manual, please record the page numbers and describe the errors. ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ Thank you for your help. Name _______________________________________________________________________________________ Title ________________________________________________________________________________________ Company ____________________________________________________________________________________ Address _____________________________________________________________________________________ ____________________________________________________________________________________________ E-mail Address _______________________________________________________________________________ Phone ( ___ )____________________________________ Fax ( ___ ) ___________________________________ Mail to: Technical Publications National Instruments Corporation 6504 Bridge Point Parkway Austin, Texas 78730-5039 Fax to: Technical Publications National Instruments Corporation 512 795 6837...
View Full Document

This note was uploaded on 12/01/2009 for the course S ss taught by Professor S during the Spring '09 term at Universidad Autonoma de Nuevo Leon - School of Business.

Ask a homework question - tutors are online