Designing Dual-Priority Encoder Using LabView

Paluru Sunitha and Naga Sunil Manohar Bole

0
4244

In priority encoder, if two or more inputs are equal to 1 at the same time, the input having the highest priority will take precedence. In case of dual-priority encoder, the circuit identifies both the highest-priority and the second-highest-priority asserted signal among a set of input signals. Presented here is an eight-input dual-priority encoder designed using LabView versions 12. In LabView, Front Panel serves as the user interface and Block Diagram contains the graphical source code that defines the functionality of the virtual instrument (VI). Following are the steps required to design dual-priority encoder using NI’s LabView:

Step 1. Open LabView and press Ctrl+N followed by Ctrl+T keys to open the tiling Front Panel and Block Diagram.

Step 2. Go to Front Panel and from the menu bar select View->Controls ->Modern->Push Button (this is where we give input), drag and drop it on to Front Panel and label it as input I0. Similarly, select seven such inputs and label them as I1, I2, I3, I4, I5, I6 and I7. Arrange them in sequential order as shown in Fig. 1. Here, input I7 has the highest priority.

Explore Circuits and Projects Explore Videos and Tutorials

 

978_Fig-1
Fig. 1: Front Panel
7B9_Fig-2
Fig. 2: Block Diagram

Step 3. Select View->Controls-> Modern->Boolean-> Vertical Toggle switch and label it as En’, place it above the inputs. This is an active low enable input.

Step 4. Select Modern-> Decorations-> Flat Frame and adjust its size such that all the inputs are positioned on its left side for neat appearance. Double left click on the Front Panel and type ‘dual priority encoder’ and drag it inside the frame.

Step 5. Select Modern-> Boolean-> Round LED (this is where we see the output) and drop it on to Front Panel and label it as output A2. Similarly, select other three such outputs and label them as A1, A0 and AVALID. These will be used for the first-highest-priority encoder output. Following the same steps as above, label them as B2, B1, B0 and BVALID for the second-highest-priority encoder output. Arrange them in sequential order as shown in Fig. 1.

Step 6. Select Modern -> Decorations -> Recessed Frame and adjust its size such that the outputs (A2, A1, A0 and AVALID) are positioned inside the frame for neat appearance. Similarly, arrange the remaining outputs (B2, B1, B0 and BVALID) in another recessed frame.

Step 7. Use A[2:0] and AVALID to identify the highest-priority request, where AVALID is asserted only if at least one request input is asserted. Use B[2:0] and BVALID to identify the second-highest-priority request, where BVALID is asserted only if at least two request inputs are asserted.

Right click on the Front Panel, select Modern->Decoration->Thin Line with Arrow option and drag and drop on the Front Panel and place the arrow to each input line as shown in Fig. 1.

Step 8. Go to Block Diagram workspace (refer Fig. 2) and select View-> Functions -> Programming-> Structures-> Case Structure and drop it on to Block Diagram. (Note. Three Case Structures are used in this project; this will be considered as main Case Structure.) The labels in the menu at the top of the Case Structure will appear as True and False. First consider the True condition.

READ
Dual-Tone Horn

Step 9. Select Programming-> Boolean-> NOT gate and drop it on to Block Diagram. Place the cursor at output of vertical toggle switch (En’). You will see a hot spot. From there pull a wire and give it as input to NOT gate. The output of NOT gate is connected to the selector terminal ‘?’ of the Case Structure.

Step 10. Again, select Programming-> Boolean-> Bool to (0, 1) function and drop it on to Block Diagram. Connect the output of I7 to input of Bool to (0, 1) function.

61E_Fig-3
Fig. 3: Block Diagram after clean up
3ZZ_Fig-4
Fig. 4: All Tunnels closed

Step 11. Select Programming-> Comparison-> Equal ? function and drop it on to Block Diagram. Give the output of ‘Bool to (0, 1)’ to one of the inputs of ‘Equal ?’. Place cursor on the second input of ‘Equal ?’ and right click on it. Select Create->Constant and put value 1.

Step 12. Select Programming-> Comparison-> Select function and drop it on to Block Diagram. It has three input lines, namely, true (t), select (s) and false (f). Connect the output of ‘Equal ?’ to ‘s’ input of Select function.

Step 13. Repeat steps 10, 11 and 12 for remaining inputs (I6, I5…I1), except for I0.

Step 14. Place cursor on the true (t) input of Select function, right click on it and create a constant of value 7 for input I7. Similarly, do it for all inputs with constant value decreased by 1 for each input of Select function, which are arranged in descending order as shown in Fig. 2.

Step 15. Connect the output of Select function corresponding to I1 to false (f) input of Select function corresponding to I2. Similarly, connect the remaining outputs of Select function to false (f) input of the Select function, except for I7. Create a constant 0 for the false (f) input of Select function of input I1.

Step 16. Add two Case Structures as explained below. Select Programming-> Structures-> Case Structure, drag and drop it on to Block Diagram inside the main Case Structure. If labels in the menu appear as True and False, modify them to 0 and 1, respectively. Right click on case selector or menu, select ‘Add Case After’ option and label it as 2. Similarly, do the same for the other five cases and label them as 3, 4, 5, 6 and 7.

Step 17. Connect the output of the Select function of I7 to selector terminal ‘?’ of the inner upper Case Structure.

Step 18. Select case 0 and then select Programming->Boolean-> False Constant and connect the output of False Constant (labeled as F) to the Round LED A2, which is placed outside the Case Structures. An open box called Tunnel will be created on both main and upper Case Structure boundaries.

READ
Cordless Multidoor Alarm

Step 19. Place the curser on the output wire of F. You will find a hot spot. Click on it and draw two more wires to connect to A1 and A0, respectively. Thus we have connected F to A2, A1 and A0 to represent the binary number for the case 0. That is, the binary number for decimal number zero for [A2 A1 A0] is [0 0 0]. Now, if case 1 is selected, the binary representation of outputs A2 A1 A0 will be 0 0 1. Here, F should be connected to A2 and A1 for the 0s. For 1 we will consider the True (T) Constant by selecting Programming->Boolean-> True Constant option. That is, connect T to A0. For case 2, the binary output of [A2 A1 A0] is [0 1 0] and for case 3 the output is [0 1 1], and so on.

Step 20. Similarly, connect False (F) and True (T) constants to outputs (A2, A1, A0) for remaining cases to represent the corresponding binary number. We can follow the same technique for the inner lower Case Structure.

Step 21. Select another Select function and place in the main Case Structure. Connect output of ‘Equal ?’ correspond to input I7 to the ‘s’ input of Select function. These are used to select the second-highest-priority request. Similarly, do it for the remaining inputs, except for I0.

Step 22. Connect ‘t’ inputs of Select functions from the output of previous Select functions as shown in Fig. 2, except first Select function of I7.

Step 23. Connect output of Select function corresponding to I1 to the ‘f’ input of the Select function corresponding to I2. Similarly, repeat the same connection at the Select functions corresponding to I3 through I6 inputs, except for I7. And then create a constant 0 at ‘f’ input of Select function corresponding to input I0.

33A_Fig-5
Fig. 5: Output with both first and second-highest priority
F2F_Fig-6
Fig. 6: Output with only first-highest priority

Step 24. Select another Case Structure and drop it on to Block Diagram inside the main Case Structure. If labels appear as True and False, modify them to 0 and 1, respectively and then add six more cases and label them as 2, 3, 4, 5, 6 and 7.

Step 25. Connect the output of the second Select function of I7 to selector terminal ‘?’ of the inner lower Case Structure. And then repeat steps 18 and 19 for outputs B2, B1 and B0.

Step 26. Select Programming-> Numeric-> Compound Arithmetic and drop it on to Block Diagram. Extend it so that it has eight inputs. Now, connect the eight outputs from Boolean (0, 1) functions to the eight inputs of Compound Arithmetic. Change the mode of Compound Arithmetic to ‘Add’ by right clicking on it and select Change Mode-> Add option. This will add a ‘+’ sign to it to make it an adder function.

READ
Keypad Control for Multiple Appliances

Step 27. Select Programming-> Comparison->Greater ? and drop it on to Block Diagram inside the main Case Structure. Give the output of Compound Arithmetic adder to the first input ‘x’ of Greater ?. Place cursor on the second input ‘y’ and right clicking on it create a constant of value 1.

Step 28. Connect the output of Greater ? to Round LED BVALID and draw another wire from output of Compound Arithmetic adder to input of another comparison function ‘Greater Than 0?’ Give the output of it to another Round LED AVALID.

Step 29. Press Ctrl+b keys to remove broken wires and press Ctrl+u keys to clean up the diagram on the Block Diagram as shown in Fig. 3.

Step 30. Change the case to False condition in main Case Structure and connect all the Tunnels on right side of Case Structure to False (F) constant. Then all the Tunnels will be closed as shown in Fig. 4.

Step 31. Return to Front Panel. Save the VI and press the Run Continuously button to check for the operation of dual-priority encoder. Give different inputs and check the outputs for identifying the first-highest and second-highest priority request.

Checking the output
Fig. 5 shows the result for dual-priority encoder operations for first-highest and second-highest priority requests when the inputs I7, I5, I3 and I0 are asserted. Here, I7 has the highest priority, after that the next-highest priority will be given to I5. Hence, all the output LEDs A2, A1 and A0 glow, which is equivalent to 111 (also a binary representation of 7) in the highest-priority box. In the second-highest-priority box, B2 and B0 are on and B1 is off, which is equivalent to 101 (also a binary representation of 5). The output LEDs both AVALID and BVALID are asserted, because more than one input is asserted.

Fig. 6 shows the result when only one input I2 is asserted. Here, output LEDs A2, A1 and A0 show the highest-priority request 2 as 010 (binary representation of 2) and the output LEDs B2, B1 and B0 are turned off. The output LED AVALID only is asserted, because we asserted only single input and there is no second-highest-priority request. Here, note that the circuit will be on only when the enable input (En’) is in off condition, because it is an active low enable input.

Download Source Code: click here


The authors Paluru Sunitha and Naga Sunil Manohar Bole were third-year B.Tech (electronics and communication) students from Maharaj Vijayaram Gajapathi Raj College of Engineering, Vizianagaram when they sent this project, under the guidance of Associate Professor M. Satyanarayana, last year

LEAVE A REPLY