LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Analog In's while simultaneous Analog outs

I would like to aquire 11 Analog Input channels, and write them to a spreadsheet.  Two of the Analog Input channels I would like to monitor during the data aquistion.  If one channel goes above 2.5 volts, I would like to trigger one of the analog outputs.  Then if the other channel goes above 3.5 volts, I would like to trigger the other analog output.  Basically I am monitoring two seperature pressure transducers, and if one hits a certain pressure I want to vent it back to tank with a solenoid, then if the other hits a certain pressure I want to vent off a seperate solenoid.  What would you call this type of VI?  Does anyone have any examples that would give me a good starting point?  Thanks for any help
0 Kudos
Message 1 of 10
(4,611 Views)

Hello TMDATA,

I do not know what I would call that type of VI, but there are many examples that can help you get started in the NI Example Finder which you can open by going to Help >> Find Examples.  For an example of analog input, I would look at the folder Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage.  If you want to do a continuous acquisition where you set the rate of the acquisition, you could look at Cont Acq & Graph Voltage - Int Clk. 

For analog output I would look at the Analog Generation >> Voltage folder.  If you just need to output a DC voltage, Gen Voltage Update will do the trick.  There are also examples for generating a waveform. 

In order to trigger the analog output off of the analog input, you could check for the case when the analog input is greater or equal to your value, and then start the analog output operation. 

If you are going to use the Gen Voltage Update example, be sure to put the DAQmx Create Channel and Clear Task outside of your while loop.  Also, note that while your task is running the analog output voltage will stay at what value you have set it at, so when you want to turn off your solenoid, you will need to set the voltage back to 0V. 

Also, you have not noted what hardware you are using.  I am going with the assumption that you are using hardware that is supported by DAQmx.  To verify that this is true, you can check what driver supports your device at ni.com/support/daq/versions. 

Regards,

Laura

 
0 Kudos
Message 2 of 10
(4,589 Views)
Thanks for the help, those examples are going to work fine and Yes the hardware supports DaqMX.  I would like the Analog out to shut off if the voltage goes below the set voltage of the greater than or equal to.  Everything is inside a while loop.  I strip both channels from the array, and then there are two greater than or equal to, followed by two case structures that if the channel is greater than or equal to it is true, and the Gen Voltage Update is active.  If it is false I need to clear the analog out or set it to zero correct?  I am a little confused what portion of the Gen Voltage Update needs to be inside of the case structure, and what needs to be outside of the while loop so the Analog out shuts off after the vi is stopped.  Thanks for the help
0 Kudos
Message 3 of 10
(4,587 Views)

Hello TMData,

In the false case of your case structure when you want your analog output to shut off, I would write 0 volts using the DAQmx Write VI. 

In order to properly create and clear your task, you should keep the DAQmx Create Channel and DAQmx Clear Task VIs outside of the while loop.  The DAQmx Create Channel VI should be on the left side of the while loop and DAQmx Clear Task should be on the right side of the while loop, much like the analog input example you were looking at.  Be sure to keep the task and error clusters are connected between all of the VIs for the analog output task. 

Hope this helps,

Laura

0 Kudos
Message 4 of 10
(4,572 Views)
I still cant get the analog out to shut off once I hit stop.  I tried moving everything around and still nothing.  I have the vi working correctly other than the ouput will stay on.  I attached a screen shot, hopefull you can tell me what is wrong.
0 Kudos
Message 5 of 10
(4,552 Views)

Hello TMData,

To turn off the analog output, I would write 0V to your analog output line after the stop button has been pressed.  It would be best to do this outside of the while loop, but before you call the clear task VI.  This way, when your user presses the stop button, the analog output will always go to 0V.

Hope this helps,

Laura

0 Kudos
Message 6 of 10
(4,532 Views)
Can you send me an example using Daqmx using of a continuous analog output of a single voltage that goes to zero when you press stop.  All the example in Labview all stay on once you stop the vi.  I have tried everything I can think of, and I either get Labview to crash or the analog output just stays on.  Thanks for all your help
0 Kudos
Message 7 of 10
(4,519 Views)

Hello TMDATA,

I have modified a shipping example to write 0 V right before the task clears.  Remember that when you stop the program you should click the button on the front panel that says "Stop" so that the program exits correctly.  You should not use the abort execution button in the toolbar because you will just kill your program and it will not exit the while loop correctly, so the analog output line will not be set to 0V.

Regards,

Laura

0 Kudos
Message 8 of 10
(4,498 Views)
Thanks for the Help Laura.  That was exactly how I created the vi but it would crash everytime I tried to run it, and it would give me some AO error I ended up recreating the whole vi over again, and it still crashed.  So I recreated everything once again, and it finally worked.  So far from what I have used on Labview 8, I dont like it.  It seems like it has too many "bugs." Thanks again for the help.
0 Kudos
Message 9 of 10
(4,471 Views)
 

Hello TMDATA,

I am glad to hear that your VI is working now.  You might be interested in knowing that a LabVIEW 8.0.1 update is now available to install.  You can take a look at all of the fixes it provides in the readme file.  If you do install it, you will have to mass compile after that and the mass compile can take a little while.  I would start the mass compile right before leaving for the day.

Regards,

Laura

0 Kudos
Message 10 of 10
(4,466 Views)