09-30-2020 05:49 PM
I am trying to watch two channels. One channel (channel zero) is my trigger. The other channel is my data. What I need to do is start saving data from my data channel when my trigger goes over a certain value. What I have so far looks like this:
I may be over complicating this, I am a text based programmer learning NI.
I am having trouble creating an array with the values once the trigger exceeds 3. I am totally blank of any ideas on how to do so.
I only have one module - NI 9205 voltage so I am using a voltage signal for a trigger.
10-01-2020 02:38 AM
Hi flycast,
I saw you mention you want to acquired data in rate of 1/10 s but I didn't see the timing setting.
Btw, why after the DAQ start node is a for loop structure with terminal condition but wired also to the count terminal N? are you going to run the whole program only once?
10-01-2020 10:28 AM
@CL_lee wrote:
Hi flycast,
I saw you mention you want to acquired data in rate of 1/10 s but I didn't see the timing setting.
I'm assuming that the timing is set in the DAQmx Task in MAX.
@CL_lee wrote:
Btw, why after the DAQ start node is a for loop structure with terminal condition but wired also to the count terminal N? are you going to run the whole program only once?
I also don't understand this. I think this should just be a while loop, or no loop at all. Also, a method for stopping should be included - the Abort button at the top of the screen is there just for development purposes. A proper stop routing should be practiced.
You do not have to wire the Number of Iterations terminal of the FOR loop if you are using an autoindexing array.
Keep the wires straight as much as possible. This aids in the readability of the program just like indexing does in a text based language.
I think that all you really need to do is on the output to your inner FOR loop right click and select Conditional output. Then wire your boolean value to that terminal.
10-01-2020 10:50 AM
@CL_lee wrote:
Hi flycast,
I saw you mention you want to acquired data in rate of 1/10 s but I didn't see the timing setting.
Btw, why after the DAQ start node is a for loop structure with terminal condition but wired also to the count terminal N? are you going to run the whole program only once?
The timing is in the task.
I want to run the program 24/7/365 to monitor a piece of manufacturing equipment. The program is intended to watch up to 8 channels for different conditions and then run some tests (to be developed later) against some of the readings. I have the loop running once at this point to debug.
10-01-2020 11:02 AM
@johntrich1971 wrote:
@CL_lee wrote:
Hi flycast,
I saw you mention you want to acquired data in rate of 1/10 s but I didn't see the timing setting.
I'm assuming that the timing is set in the DAQmx Task in MAX.
@CL_lee wrote:
Btw, why after the DAQ start node is a for loop structure with terminal condition but wired also to the count terminal N? are you going to run the whole program only once?
I also don't understand this. I think this should just be a while loop, or no loop at all. Also, a method for stopping should be included - the Abort button at the top of the screen is there just for development purposes. A proper stop routing should be practiced.
You do not have to wire the Number of Iterations terminal of the FOR loop if you are using an autoindexing array.
Keep the wires straight as much as possible. This aids in the readability of the program just like indexing does in a text based language.
I think that all you really need to do is on the output to your inner FOR loop right click and select Conditional output. Then wire your Boolean value to that terminal.
I'll add a stop button. Good practice apparently.
Autoindexing array and for loops - Great!
It is really easy to get spaghetti going, especially when new to this.
I did not know about a conditional output. Great gem there!
10-01-2020 11:39 AM
@flycast wrote:
I'll add a stop button. Good practice apparently.
Autoindexing array and for loops - Great!
It is really easy to get spaghetti going, especially when new to this.
I did not know about a conditional output. Great gem there!
I've written some spaghetti code myself (thankfully a long time ago).
The stop button is the simple way. I also often use an Event structure and capture the Panel Close event (no button needed).
There are a lot of good resources to help give you a jump start in using LabVIEW. Some of them are listed at the top of this board.
10-01-2020 08:39 PM
@flycast wrote:
The timing is in the task.
I want to run the program 24/7/365 to monitor a piece of manufacturing equipment. The program is intended to watch up to 8 channels for different conditions and then run some tests (to be developed later) against some of the readings. I have the loop running once at this point to debug.
because you wire the count terminal with 1 so you get the loop running only once although your terminal condition set to always run.
Agree with john, the outer loop in your program is better change to while loop with a stop button.
In for loop, if both count terminal and auto-indexing is wired, it will choose the less iteration to run. This case is similar to when you auto-indexing 2 array, the number of iteration will follow the array with less element if both array are not having same number of element.
If you set terminal condition, when stop condition is triggered it will abort the loop although the count terminal iteration or the auto-indexing haven't finish.
Btw, in LabVIEW, it is better to let the data flow wire connection between the node in the program from left to right