Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 27, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Learn LabVIEW DSP in 3 Hours - Example 4: Incorporating DIO (DIP Switches and LEDs)

7 ratings | 1.71 out of 5
Print

LabVIEW DSP has new features like LabVIEW Project

To learn more about this feature follow the link below for step-by-step instructions.

Using the LabVIEW Project with LabView DSP Module

 

Complete the following steps to change the VI from a previous example to play back either filtered or unfiltered signal depending on the state of the on-board DIP switch.

  1. Open Example 3.vi that you built in previous example and save it as Example 4.vi.
  2. Remove the Filtered? button from the front panel.
  3. In the block diagram place a Digital Input node from Functions»Elemental I/O palette. Double click on the node, select On-board DIP switch under General tab and choose DIP switch 1 under Configuration tab. This configuration is default for Digital Input node. Wire the Digital Input node to the conditional input of the Select function.


    Figure 1. Block Diagram of Example 4.vi (incorporating DIP Switches)

  4. Run the VI. Toggle the 1st DIP switch on the board to select between filtered and unfiltered signals sent to the Analog Output.

Complete the following steps to create a subVI that turns on the on-board LEDs depending on the strength/volume of the input signal.
  1. In the front panel place a Vertical Pointer Slide from Controls»Numeric palette and label it Level Scale Gain. Set the maximum scale range of the slider to 0.01.
  2. Place a Vertical Fill Slide from Controls»Numeric palette and label it Energy. Set the maximum scale range of the slider to 1000. Change the control to an indicator by right clicking on it and selecting Change to Indicator.
  3. Modify the block diagram as shown in the following figure


    [+] Enlarge Image
    Figure 2. Block Diagram of Example 4.vi (incorporating LEDs)

    1. Place an RMS.vi located at Functions»Signal Processing»Time Domain palette. Wire the output from Analog Input to RMS X input and wire the rms value output from the RMS VI to Energy.
    2. Place a Multiply function form Functions»Numeric palette and connect rms value and Level Scale Gain as inputs.
    3. Place a Greater? function located at Functions»Boolean palette and wire the output from the Multiply function as its first input. Create a constant for the second input of the Greater? function.
    4. Place a Digital Output node from Functions»Elemental I/O palette. Double click on the node to configure it. Select-On Board LED under the General tab and choose the first LED under Configuration. Note that these are also default settings for the Digital Output node. Type “LED 1” under the Name field. Then wire the output from the Greater? function to LED 1.
    5. Repeat steps c and d seven more times and change the constant values for the Greater? function as shown in the figure above. Configure the Digital Output nodes for LEDs 2 to 7 and change their names accordingly.

  4. Save and run the VI.
  5. Adjust the Level Scale Gain value and whistle/talk into the left microphone. The on-board LEDs will be turned on and off depending on the volume (energy) of the input sound .
  6. Draw a rectangle (using the left button of the mouse) around the portion of the block diagram to select the items shown in the following figure.


    [+] Enlarge Image
    Figure 3. Block Diagram of Example 4.vi (creating a SubVI)

  7. From the Edit menu select Create SubVI to create a subVI that takes an array of input values with a Level Scale Gain value and returns an rms (energy) value.
  8. Close Example 4.vi and when prompted, save the subVI as Volume LED.vi.


To get the solution VIs for this example refer to Learn LabVIEW DSP in 3 Hours - Solutions To Examples document linked below.



7 ratings | 1.71 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).