From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-06-2020 12:49 PM
I've created 10 channels for transducer and flowmeter inputs using a simulated PXIe-6361. I want to display the reading on a waveform graph. I also want to add the option to start data logging whenever the user chooses at a selected rate. I can't seem to keep the waveform graph sample rate and the logging data rate separate. When I try to split the task into two separate loops, the program doesn't work as intended. I've looked at the examples and browsed the forums and it got me pretty far but now I'm stuck!
The main issues are:
1) I want to be able to display and change rate of the data that shows in the waveform graph.
2) I want an option (button) to enable data logging (TDMS) at a user selected rate whenever they choose.
Any help is appreciated!
Solved! Go to Solution.
05-06-2020 01:59 PM - edited 05-06-2020 02:08 PM
Hi osharifi,
the first I saw after opening the block diagram is this code:
Why are there 2 different terminals, both labelled "Logging"? (Would you create code in a text-based language with two variables named exactly the same?)
Why is there a local variable "Logging" right next to the terminal of its control? Why don't you use more wire?
Why do you need 4 different LED indicators to show the logging state???
After that I started to scroll around and realized: the block diagram is huge! And it's peppered with local variables: ever heard of "THINK DATAFLOW!"?
@osharifi wrote:
I can't seem to keep the waveform graph sample rate and the logging data rate separate. When I try to split the task into two separate loops, the program doesn't work as intended.
You cannot do, what you are trying to do in your VI:
- splitting the DAQmx task reference to be used in two parallel loops, both reading from that task
- additionally trying to change the sample rate of this single DAQmx task in both loops…
A DAQmx task is (kind of) a shared resource, you cannot operate on that resource in parallel!!!
The simple solution is to create a proper producer-consumer scheme:
(Even simpler (+quick&dirty) would be to display the data in the producer loop in a graph and read from a local variable of that graph in your file saving loop…)
05-06-2020 02:59 PM
Thanks, GerdW!
I used the four LEDs to show logging state on all tabs. Moving the one LED on top of the tab control created some weird black lines around the LED which didn't look good.
I'm not too familiar with the Producer-Consumer architecture so I have one question: Will the Producer and Consumer each have sample clocks in them?
05-06-2020 03:59 PM - edited 05-06-2020 04:00 PM
FYI the weird black lines that you see mean the control or indicator is floating (not connected to the tab control or what every you are floating over). Secondly if you run the application the black line will go away and no one will be able to see that this is a floating control or initiator.