LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Value change to trigger save data for 1s of 50 KHz sampling rate

Solved!
Go to solution

Hi there,

 

I have a VI with NI9215 and cDAQ-9178 chassis hardware. The function of the VI is to output a setpoint to RS232, and save 1 second of data each time the setpoint value is changed.

 

The procedure is

 

1) change the setpoint value to the flow controller

 

2) wait for 2 seconds.

 

3) save data from 4channels for only one second at the sampling rate of 50KHz.

 

Right now, the problem is the for the first edition of the program  , two seconds (rather than one) of data was saved and the popped up the error 200279.

 

1.jpg

 

 

 

 

 

 

 

II. Then I revised to the second edition of the producer and consumer structure which may increase the buffer speed.

 

The question is how to setup the trigger to initiate the data saving and limit the data saving for one second each time the setpoint value changes.

 

2.jpg

 

1) which edition is better for my application?

2) how to trigger the data saving?

3) how to save only one second of data? 

 

 

I also checked this posting and the elapsed time seems does not work for this case.

 

 

Any help would be greatly appreciated!

 

Melody

 

Download All
0 Kudos
Message 1 of 7
(2,538 Views)

Sorry, forgot to add the link.

 

http://forums.ni.com/t5/LabVIEW/determining-sampling-rate-and-saving-frequency-waveform-data/m-p/184...

 

The example in this list of the elapsed time seems does not work in my VI.

 

0 Kudos
Message 2 of 7
(2,534 Views)

Hi

 

Look into the vi attached and let me know if that works.

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 3 of 7
(2,520 Views)

Hi Freelance LV,

 

Thanks so much for your reply. I tried your method but still have some problems.

 

 

 

 

4.jpg

 

 

1) the VI save data from the beginning without the value change of the "setpoint".   The setpoint is a control which I will input from the front panel.

 

2) it does not stop once the save data started.

 

I never used the property node before and may not set up the property node right.

 

What I want is to

1) manually input a number for the "setpoint" in the front channel.

2) wait for 2 seconds.

3) automatically save 1 second of data @ 50KHz sampling rate.  

 

 

Appreciate any help!

 

Melody

0 Kudos
Message 4 of 7
(2,508 Views)
Solution
Accepted by topic author hygeia44

Hi

 

you have not used the property nodes correctly.

 

1. Replace the case structure in the first loop, with DAQmx functions, with an event stucture. Edit the event to fire for a valu change of Setpoint control.

 

Edit: As indicated in your first post, use the Event strucutre, but put it inside the while loop.

 

2. DO NOT wire the error output from the property node of Stop control. Replace it with a local variable for the stop button.

 

Try these and let me know.

 

Regards
Freelance_LV
TestAutomation Consultant
Message 5 of 7
(2,501 Views)

Hi Freelance LV,

 

Thank you for your reply.

 

1) the event structure works.

 

2) When I created a local variables for the stop button in the lower while loop and connected it to the data saving loop, it showed the error:

If a Boolean control has associated local variables, it cannot use latch mechanical action. The first local variable to read a Boolean control with latch action would reset its value to the default.

 

Any idea about that?

 

Thanks!

 

0 Kudos
Message 6 of 7
(2,489 Views)

 Thats right!

 

If the mechanical action is set to latch when pressed/released, the value of the control will reset as soon as it is read by the Event strcuture or a local variable. So, set the mech action to switch mode and then write a False value to the control after both the loops exit.

 

If you want to use a property node, do not wire the Error terminal of the node to the 'Stop' condition of the while loop. Select the Value property of the stop button, and wire the Value terminal to the stop condition.

 

Edit: Property node can be used to read the value if the boolean control mechanical action is in Switch mode. For Latch mode, the property node will have a Variant data type of 'value' property as you can see in your earlier post.

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 7 of 7
(2,467 Views)