Day 06: Making Decisions

NI Self-Paced Online Training

Today we look at how to perform different segments of code depending on the value in a certain wire.  The primary structure used for making these kinds of decisions, called a case structure, is the focus of Module 10, Executing Code Based on a Condition, in LabVIEW Core 1.  The case structure will become an essential component used in some important design patterns such as the Action Engine and the State Machine that we will study soon.

Access LabVIEW Core 1 Course  

  • Core 1: 10. Executing Code Based on a Condition

In addition, we continue our study of the DAQmx API, specifically looking at how to deal with situations involving multiple channels.  The first part of this module will describe how you can add multiple channels in the same task, either by specifying a range of channels using one Create Virtual Channel subVI or by stringing multiple Create Virtual Channel subVIs together the same task.  The last half of the module describes situations where you might have multiple tasks running simultaneously on the same device.  While this is a bit advanced for what we are doing now it is important to study it and see it throughout the semester as this a point-of-emphasis in the CLAD exam.  For these situations, pay particular attention to the amount of time that each task will require on each iteration of the loop.  These times must be the same.  

Access Using NI-DAQmx Course  

  • DAQmx: 2. Programming Multiple Channels
Decisions in LabVIEW

The following pages provide some additional background on how decisions are made in LabVIEW.  First, we discuss a new data type called an enumeration or enumerated data type.  Then we look at some examples of using the Select Function or the case structure.

The following video shows an application of using a tpe-defined enumerated control and a case structure to select the units to report the temperature from our ongoing example application using the TMP-36  sensor.

LabVIEW Badge Program

Today we will take a quick look at the NI Badge program.  We discussed this on the first day with the syllabus.  NI offers a large number of online exams that recognize users for their mastery of LabVIEW programming and data acquisition topics.  We will attempt a total of 8 badges.  You will receive 2% credit to your final grade for each badge exam passed by a stated deadline, or 1% credit for exams passed beyond the deadline.  I have set the deadline for the first badge exam as shown below and on the calendar.  Be sure to attempt the exam before our next class and ask any questions that you might have before the badge exam deadline.

Using the DAQmx API

Today in class we will continue to work on assignment 2 this time focusing on developing a subVI to scale the measured thermistor voltage to a temperature in the selected units.

Print Friendly, PDF & Email