08-29-2008 01:55 PM
I am trying to read three analogue input channels via the NI-USB-6009 with LabVIEW8.5, using the DAQmx controller. I read "proper" values from these channels when I read them with Measurement & Automation Explorer but not when I read them through LabVIEW. I have pared down my program to only use the DAQ Assistant to read the channels, with the same settings as in M&A Explorer. Sometimes the values are read and displayed correctly. However, if I stop and restart the program, I will sometimes obtain different values. It appears as if the channels are being swapped and multiplied by some constant. Stopping and restarting the program again, I either get back into the same wrong stream of values or into the correct stream. The values are consistent within one execution of the program (continuous acquisition) and change only (sometimes) when the program is stopped and restarted. Can anyone provide a work-around for this?
09-02-2008 08:09 AM
Well, your problem is either with the settings of the DAQ Assistant, or with any indicators you've created to see your results. First, look at the Indicator, either in the Front Panel, or BLock diagram: Right-click it and have a look at the properties. Now, I'm not sure whatkind of indicator you've got without any sample of your code, but assuming it's a graph of some sort, I think somewhere you'll see a Tab called "Scale?" Have a look there and check to see if the offset on multiplier for either the x or y axis is an incorrect value for you. In a couple instances, I have seen the multiplier change for me, so if that's the case for you, create a property node for the indicator (Right-click and "Create Property Node"), select the X and/or Y multiplier/offset values, and place a control or constant to set the value. You can stick the Property node anywhere, but I'd put it on the left-hand side somewhere at the "start" of the code in the Block Diagram, just because I tend to keep the "initialization" steps there.
Now, I'm not too familiar with using the Express VIs, so I am unsure if there are any input terminals on it once you've set it up, but if there are, I'd say create constants or controls for any input values you don't want changing on you. If the Assistant has an input for a Task, then all you've got to do is crate one to wire to it.
All you do is open up MAX, look at the panel on the left for "Data Neighborhood," expand it with the plus sign, Right-click on "NI-DAQmx tasks" and select "Create New NI-DAQmx Task." There you go through [basically] the same dialog as you would for the DAQ Assistant; picking the channels, the frequency and the number of samples, etc. Set and save the settings you need, and label the task. Now you've got your task settings saved and they shouldn't spontaneously change on you; I notice that when the devices are not connected or turned off, the DAQ Assistant goes "blank," so maybe it resets to default values sometimes if you're turning off the devices, or disconnecting? In LabVIEW, you can place the Task Constant in the Block Diagram (Measurement I/O >> NI-DAQmx >> Task Const), then use the drop down menu on the constant to select the name of the task you created.
In case the DAQ Assistant doesn't
have an input for wiring your task to, I would suggest looking at some
examples found in the Example Finder to setup your program using the
NI-DAQmx VIs; the VIs in that NI-DAQmx category.
I hope that helps point you in the right direction.
Cheers,
Dan