10-09-2009 09:58 AM
Hi,
I am trying to display dynamic data from a DAQmx in 2 different ways. I am new to LabView so I hope I am explaining this right. I have attached a .vi at the bottom to help explain my question.
I need to display dynamic data in two different ways. I need dynamic data to be shown in the text indicator Numeric 2 or to be shown in the waveform graph. I need to be able to switch between the two. Eventually I will log data with the waveform graph but for now I just need to know how to get the dynamic data into different parts of my program.
You can see I attempted to read the dynamic data into numeric 2 in the outer loop and then read numeric 2 in the inner loop. I assume while the inner loop exicute the outer loop does not so numeric 2 is never updated. I also tried to create a new daq assistant pointing to the same DAQmx channel but that results in an error.
Ideally this will run as a state machine where, upon starting, the program will constantly read the channel and display it in numeric 2. When the user hits start the waveform graph will be
populated and that data will be recorded. When the user hits stop the data will be displayed constantly in numeric 2 again. Easy enough.
Please point me in the right direction, solving this problem will allow me to finish my first LabView program!
Thanks.
Kyle
10-09-2009 10:38 AM - edited 10-09-2009 10:39 AM
The simple way:
10-09-2009 10:56 AM
10-09-2009 01:01 PM
Thank you!
Although I am not using the tab control as each of you suggested I was able to slap myself on the forehead and come up with a solution. I have attached it below with a function generator so you can see how it works. I sure you vet's will say, 'thats simple' but for some reason I could not come up with it on my own.
Thanks again for the help!
10-09-2009 01:17 PM
Place the numeric in the false case. No reason at all for two different case statements. Even if you wanted two case statements for some wierd reason, the use of the local variable is just wrong.
10-09-2009 01:29 PM
OK made the change. Is that a style issue or a program issue. Again, I am very new to all of this and have not havd the NI traing. I don't really get how this style of programming works vs. a C/C++ or VB.NET program yet.
Thanks again.
10-09-2009 01:32 PM - edited 10-09-2009 01:34 PM
Now for some added fun on a Friday, use Property Nodes to Disable & Gray Out the indicators that are not currently updating. The Express VI as a loop latency timer is overkill also, just use the Wait (ms) function. You're doing fine, good luck.
Edit: I would recommend the book LabVIEW For Everyone. On Amazon and maybe at your bookstore.
10-09-2009 02:04 PM
Think of a simple case statement as an If/Else. What you did with two case statements was have
If button = True
Write to chart
Else
(nothing)
If button = False
Write to numeric
Else
(nothing)
The second If/Else would not be required if you used the Else in the first to handle the false condition.
The local variable you had is a classic example of a race condition. Never use a local unless you really understand dataflow and how local violate this.
10-09-2009 03:08 PM
OK. I get the IF/ELSE <--> CASE analogy perfectly. Kudos!
If I should not use local variables how would I exicute a SWITCH type statement?
Or how would I store a number in memory and increment it with a button press? How would I read it out later?
If this is in the documentation dont waste your time answering, I'll get to it sooner or later. I do not need a SWITCH for my current program, I am just curious!
Kyle
10-09-2009 03:16 PM
A select function on the Comparison palette gives you a simple either/or true/false function.
To "store a number in memory" look at shift registers. Place a number in a shift register, and it will be available in later loop iterations at the left hand side terminal where you can do what you want with it including incrementing it.