06-10-2014 04:14 PM
When dealing with DAQMX and having 15 analog in channels (all current) and 15 DO out channels (for relay on/off) which way is the "correct" way to program this? see the snippets below. Not sure if i need code A 15 times with a "read function" in my loop or code 2 inside my loop with 15 index arrays attached to it. Code 2 seems easier and cleaner but i would also be configuring everytime. or with the daq assistant out side the loop with the read function inside and index arrays attached to it.
Need some clarification about this since Im not real familiar with DAQMX. Im using a cDaq 9172 with 2 NI 9203's and 2 NI 9472's
Thanks in advance
Myke
06-11-2014 04:44 AM
Avoid DAQ Assistant when you can simply use the DAQmx API. The proper way to do this is to have your initialization code before your loop and then close out the task after your loop. Inside of your loop, use the DAQmx Read set to N Channels. It is better to read it all in one shot.
Be sure to look at the DAQmx Examples. In LabVIEW, go to Help->Find Examples. Do a search for Analog Input and you should be able to find a nice example.
06-11-2014 08:12 AM - edited 06-11-2014 08:20 AM
Thanks crossrulz. That's what I was thinking. I'm trying to optimize the best I can for my knowledge limits where this stuff is concerned. Have a look at what I have so far. Obviously there are wires missing and I'm not done with it yet but i believe I've captured what you said. Using index arrays to hit my data on the the individual channels. there is a while loop around everything i have here. I hope you can view the snippet. its kinda big.