# Seven segment display in labview : tutorial 25

In this tutorial I will help you to design a VI that will display the number of your demand on a seven segment LED display. You will provide a constant value as input and at VI will display your entered constant on a seven segment display. Using all the knowledge you have gained so far, you will be designing a simple VI as a sample project in this tutorial. At the end of the tutorial you are provided with an exercise to do it by yourself, and in the next tutorials I will assume that you have done those exercises and I will not explain the concept regarding them.

### Seven segment display in labview  example

• Create a blank VI as you did in tutorial 1 and save it for future use as you have been doing in all the previous tutorials. On the front panel click right and from the control palette just appeared select Boolean and then select Square LED as shown in the figure below,

Figure 1: Square LED

• Place 7 such LEDs and adjust their sizes so that they look like a seven segment display. If you are not familiar with the shape of a seven segment display then google it. See the figure below as I have placed 7 LEDs in the shape of seven segment display

Figure 2: Seven segment arrangement

• Now on the block diagram window click right and from the function palette select structures and then select Case structures as shown in the figure below,

Figure 3: Case structure placement

• Drag it over some portion of the block diagram window. By default the cases of a case structure are set to true and false, but in our case we need It to be numeric cases i.e. 0,1,2,….9 as we are interested in displaying numbers on LEDs. From the function palette select Numeric and then select constant as shown in the figure below,

Figure 4: Constant placement

• Connect this constant to the case selector node of the case structure as shown in the figure below,

Figure 5: Numeric condition

• This will change the type of the case structures’ cases from Boolean to numeric as you will see shortly. On the block diagram select all the respective blocks of 7 LEDs you used previously on the front panel for the creation of 7 segment display and click right after selecting the blocks. From the dropdown menu select Local variables as shown in the figure below,

Figure 6: Local variables

• This will create 7 local variables of 7 LEDs, place them inside the case 0 of your case structure as shown in the figure below,

Figure 7: Case 0 of case structure

• Now from the above window select at the top of the case structure select 1. It will allow you to design a block diagram that should be implemented when the case input numeric value is 1. Again copy all the LED blocks and create 7 local variables as we have done before and place them all in the case 1 block of case structures as shown in the figure below,

Figure 8: Case 1 of case structures

• Now to add a case for the remaining numbers, click right on the boundary of the case structure and from the drop down menu select Add case after as shown in the figure below,

• This will add a case after 1 i.e. case 2. Again create local variables of all the LEDs and place them inside the case 2 block. Do the same for all the remaining digits up to 9. Now open the case 0 and click right on the local variable you place in it. From the dropdown select Create and then select constant as shown in the figure below,

Figure 10: Creating constant

• This will create a Boolean constant at the input of the LED block, do the same with all the remaining LED blocks in case 0 as shown in the figure below,

Figure 11: Constants creation in case 0

• Now move to case 1 and create constant to every Boolean LEDs’ local variable already present in that case as shown in the figure below,

Figure 12: Constants creation in case 1

• Do the same with all the 10 cases of LEDs you created before.
• Now from the seven segments arrangement you designed earlier in this tutorial, draw a pattern of LEDs which needs to be turn on in case 0. i.e. for case 0, the input will be 0 and the seven segment must display 0 on the LEDs. To do so, all LEDs except 4 in the display should be turned ON. Hence except 4 make all the constants on the remaining LEDs as true, as shown in the figure below,

Figure 13: Case 0 LED pattern

• For case 1, only LED 3 and 7 should be ON all the remaining LEDs should be off so the corresponding pattern of LEDs is shown in the figure below,

Figure 14: Case 1 LED pattern

• Do the same for case 2, Turn on LEDs 2 3 4 5 an 6 and keep the remaining LEDs off as shown in the figure below,

Figure 15: Case 2 LED pattern

• Do the same with all the remaining digits as you have done for 0 1 nd 2 and now run the VI changing the input constant to the case selector constant as shown in the figure below,

Figure 16: Output with 9 as input

• Your select pattern when input variable is 9 will be displayed on the seven segment LED pattern as is obvious from the above figure,
• Try another input constant i.e. 7 as an example; this will display 7 in the seven segment display output as shown in the figure below,

Figure 17: Output with 7 as input

Exercise:

• Run a loop and display all the digits from 0 to 9 on the seven segment with a time difference of 1 sec between two consecutive digits, and at the end of the loop display a loop completion message.

<< Previous tutorial                                      Next tutorial>>