LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI continuous send output voltage after press stop button

Hello everyone!!

We are using NI 9263 to generate a constant voltage to control our device.

It seems work well when vi is running.

After press stop button, it should stop send voltage from NI 9263. But for our vi, it continuous generate voltage.

 

I try to put 'DAQmx Write' into my while loop but if so, it won't send voltage to my output.

 

Could anyone helps us with this problem??

Thank you all !!

0 Kudos
Message 1 of 14
(5,933 Views)

I'm not familiar with either the device and the DAQmx VIs, but I would assume it's enough to do one "write" to set a specific voltage, and not repeatedly send the same voltage. Then you should make sure to set the voltage to 0 when you press the stop button.

I couldn't look at your VI since I don't have access to a LabVIEW version newer than 2012 right now.

Regards

0 Kudos
Message 2 of 14
(5,916 Views)

@AmeHyesung wrote:

Hello everyone!!

We are using NI 9263 to generate a constant voltage to control our device.

It seems work well when vi is running.

After press stop button, it should stop send voltage from NI 9263. But for our vi, it continuous generate voltage.

 

I try to put 'DAQmx Write' into my while loop but if so, it won't send voltage to my output.

 

Could anyone helps us with this problem??

Thank you all !!


 

There are some wires are running backward, and there are duplicated code parts, which could be in a subVI...

Also, you should avoid using Express VIs in real application, and also do not use dynamic data type.

 

It would be recommended to take some training in LabView, you miss the basics in LabView. You have a while loop, and INSIDE the while loop you set output voltages to a certain level, and IMMEDIATELLY you set it back to zero. After the while loop ends, then you have to set the voltages to zero. So simply remove the DAQmx Write VIs with zero input from the while loop, and place them after the while loop, and before the DAQmx Clear VIs.

 

0 Kudos
Message 3 of 14
(5,909 Views)

here is the PrtSc for my output part for your reference.

1.jpg

2.jpg

 

I donno how to set the voltage to 0. That is my problem : )

0 Kudos
Message 4 of 14
(5,905 Views)

Erm I assume you mean like this?

1.jpg

2.jpg

I did this way at first but it also continuons send voltage after press stop button...

0 Kudos
Message 5 of 14
(5,895 Views)

Regarding to your screenshot, now it should be OK, you set all the 4 AO voltages to zero when you finish the while loop.

 

Express VIs: eliminate them! Use the same DAQmx programming as for the AO voltage channels. Your Express AI VI is configured as I see, to measure Voltage, Current, Voltage_0, and Current_0 channels. You read 10 samples with 10Hz rate, so your iteration speed will be about 1 second. This Express VI does already times your while loop, delete the "Wait (ms)" function from the while loop, which you set for 100 msec. It does not make sense in this case.

 

You can convert your DAQ Assistant Express VI into proper DAQmx code, and use it. Set the DAQmx Read for Nchan/Nsamples, you will get a 2D array which has 4 rows (your 4 input signals) and 10 columns (the 10 samples per channel). After this you can play with this 2D array, you can split it, etc... In this way you eliminate the "evil" dynamic data, and the need of the additional Express VIs.

 

Just feel free to post any new changes on your code, or your questions! This is the way to learn LabView 😉 Trial and error, and asking on the forum...

 

EDIT:

"I did this way at first but it also continuons send voltage after press stop button..."

 

Could you describe what this means? 🙂 If you press the stop button, the 4 AO voltage channel should be set zero. Check it with a multimeter, I do not know your actual HW config...

 

EDIT2: if you post your VI again, please set your HW channels to the physical channels which you actually use, and save them as default via the edit menu. After posting your VI we can see your HW channels. I see that, you use a cDAQ hardware for the analogue inputs. What HW do you use to generate the voltage outputs? On your front panel I see the same Dev1/ao0 default value for all the four AO physical ch controls...

0 Kudos
Message 6 of 14
(5,892 Views)

At first I did put the 'DAQmx Write ' between while loop and 'DAQmx Clear Task'. I know it should work like when I press stop button, it will send 0 to my output.

But in actual, it still send 5V as I set, and I mearsure this with a DMM.

I'm wondering is it becaue my output NI 9263.

 

I will try to follow you suggestion. Thank you !!! 

0 Kudos
Message 7 of 14
(5,871 Views)

@AmeHyesung wrote:

At first I did put the 'DAQmx Write ' between while loop and 'DAQmx Clear Task'. I know it should work like when I press stop button, it will send 0 to my output.

But in actual, it still send 5V as I set, and I mearsure this with a DMM.

I'm wondering is it becaue my output NI 9263.

 

I will try to follow you suggestion. Thank you !!! 


Sorry, now I see that you mentioned you have the 4 channel AO card NI 9263 in your first post.

It is indeed strange that after setting all the 4 AO channels to zero, you can still measure 5 volts on its outputs...You do measured the voltage on all 4 AO channels after stopping the VI (did it stop properly, without error? if error happens, it may happen it will not set outputs to zero) on the output pins of the NI 9263 card?

0 Kudos
Message 8 of 14
(5,863 Views)

Thank you Blokk~!!! 

I've already solved this question!! I think I made a stupid mistake...

Could you help me with anothher problem???

http://forums.ni.com/t5/LabVIEW/time-column-got-error-with-write-to-measurement-file/m-p/3052413

0 Kudos
Message 9 of 14
(5,798 Views)

you can say thanks by marking the useful answer as a solution, and giving "kudos" 🙂

 

And please share it what the actual problem was, and how you solved it? It may help other people searching on the forum later who has similar or same problem...

 

You generated an error inside the while loop which did not let the DAQmx Write function after the loop? Or something else?

(if so, that is also why it is good to put a condition check into such while loop, so if you get error it will stop the loop)

 

I will have a look on your other post, recently not much time I have 🙂

0 Kudos
Message 10 of 14
(5,786 Views)