Design half adder circuit in labview : tutorial 31

An electronic or digital circuit that performs addition of two binary numbers and is a type of adder is known as a Half Adder. Two single binary digits are adder in a half adder and it is able to return the output plus a carry value. A simple half adder has two inputs, called A and B, and two outputs S (sum) and C (carry). The common representation uses a XOR logic gate and an AND logic gate.

How to design half adder circuit in labview

• Lets’ design a VI, that will do simple half adder operation, in LabView. First of all create a VI as we have discussed in tutorial 1 and save it for future use as we have been doing in all the previous tutorials.
• Now we have to set to Boolean inputs for the input values A and B to be added and two Boolean outputs to display sum and carry. For Boolean inputs we will use Boolean control i.e. a push button. On the front panel click right and from the control palette select Boolean and then select Push button as shown in the figure below,

Figure 1: Boolean control placement

• Place two such push buttons for two binary single digit inputs. Now, in order to place indicator for the binary output indication we have to place LEDs. On the front panel click right and from the control palette select Boolean and then select Square LED as shown in the figure below

Figure 2: Boolean indicator

• Place two indicators also to display sum and carry on the output. The resulting controls and indicators are shown in the figure below,

Figure 3: Controls and indicators

• Never forget to name the blocks accordingly. Now move to the block diagram for XOR and AND gate placement. From the function palette on the block diagram window select Boolean and then select Exclusive Or as shown in the figure below,

Figure 4: Exclusive Or placement

• This block will return the sum of the half adder output. At the input of this block connect the two Boolean controls created previously and at the output of it, connect the Boolean indicator i.e. the square LED you created and named as sum previously, as shown in the figure below,

Figure 5: Summing block

• To do the carry operation we have to use AND gate. From the function palette on the block diagram window select Boolean and then select AND as shown in the figure below,

Figure 6: AND block placement

• This block will return the carry of the half adder output. At the input of this block connect the two Boolean controls created previously and at the output of it, connect the Boolean indicator i.e. the square LED you created and named as carry previously, as shown in the figure below,

Figure 7: Carry block diagram

• The complete block diagram of a Half adder is shown in the figure below,

Figure 8: Block diagram

The output of the half adder should be according to the table given below,

 A B Sum Carry 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1
• Now on the front panel, set the values of both A and B as 0 and run the VI, both the LEDs will remain of as according to the above table, as shown in the figure below,

Figure 9: Output 1

• Now change the value of A to 1 and keep the value of B to zero and again run the VI, according to the table the sum LED will turn ON and the carry will remain OFF, as shown in the figure below,

Figure 10: Output 2

• Now change the value of A to 0 and the value of B to 1 and again run the VI, according to the table the sum LED will turn ON and the carry will remain OFF, as shown in the figure below,

Figure 11: Output 3

• Set the values of both A and B to 1 and again run the VI, the carry LED will now turn ON and the sum LED will turn OFF and the output will again be in accordance with the above table, as shown in the figure below,

Figure 12: Output 4

<<Previous tutorial                                                 Next tutorial>>