12-26-2011 02:21 PM
I have been working on learning MAX and DAQmx for the past week or so and have been running into problems when I run this small example VI which I have included along with the MAX configuration report and a copy of the error dialog box that I get when this VI is run. It would seem that in the MAX setup for the input panel in the test panel display the Dev/aio channel input should be OK since this was selected as an input for Dev3 in the configuration of the task. I also developed another task for Dev3 and configured that task for an output channel. The device that was configured was an NI PCI-6259 “Dev 3” device with the analog input channel set to Dev3/ai0, and the output channel was set to Dev/ao0. This seemed to make sense since this device can be used for input and output; however, when I run this simple code I get an error telling me to use different physical channels for each virtual channel. This seems strange since I have selected two different ports, aio & ao3, on the same device. My two tasks are also different as they were created in MAX as two separate items. So why am I still getting this error #200371. The VI, MAX configuration report, and the error dialog box are all included in the zip file. Any help on this problem will be much appreciated.
12-27-2011 06:29 PM
Hey Cuthbert,
This error occurs due to specifying the use of identical channels on separate tasks; e.g. If you have created a task in MAX which accesses a set of channels and also create/specify the same channels for use in LabVIEW. Basically, you're reserving the channels twice. If you delete your task inputs then the program should function properly. Below is an example of how to call DAQmx Tasks directly in LabVIEW.
http://decibel.ni.com/content/docs/DOC-2316
Regards,
Ryan S.
01-01-2012 11:39 PM
I have several tasks in MAX and they all use different channels and directions in each of my tasks that I’ve setup in MAX, so I don’t see where I have different tasks with duplicate channel specified for these tasks. And I do have a lot of tasks for several different devices. Also I have several different devices and interfaces setup in MAX, and each of these is for a separate hardware device. Each of these tasks and devices check out OK when I look into the functionality as shown in MAX. So I don’t see how I’m creating duplicate channels by the way I’ve configured MAX. As far as the block diagram is concerned I’ve dragged and dropped the tasks into the block diagram straight out of MAX. As a matter of fact I went back into LV and created a more simple VI and dropped the task in MAX straight into the “Start Task” vi and ran this thing. This seems rather strange since the task is brought in from MAX and tests ok in MAX.
I also put in a different task for a different device that I installed via MAX and now I get thefollowing error dialog box appears:
Error 200278:
Possible reason(s):
Attempted to read a sample beyond the final sample acquired. The acquisition has stopped; therefore, the sample specified by the combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped.
Attempted to Read Sample: 100
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0
Task Name: StrainTask_Dev1
I would sure like to know what is wrong with this code.
And in the attached zip file there is a copy of the MAX repprt so you can see how I am configured.
01-03-2012 03:58 PM
Hey Cuthbert,
The issue with programming and testing tasks in MAX is that you're most likely running the tasks individually. MAX is going to reserve the resource, run the task, and release the resource. So, tasks that may run perfectly independently, can conflict with one another. I recommend that you configure your channels programmatically, in LabVIEW, using the DAQmx Create Virtual Channel instead of in MAX. Also, I'd recommend looking at the included shipping examples that NI provides for starting out with Data Acquisition programming. To find these, open LabVIEW and go to Help >> Find Examples. Then, in the Example Finder, explore to Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage >> Acq&Graph Voltage-Int Clk.vi. This is a good example of an analog measurement VI. Similarly, to find a VI for analog output, navigate to Hardware Input and Output >> DAQmx >> Analog Generation >> Voltage >> Gen Voltage Update.vi. You could then combine these two VI's to the same block diagram so as to accomplish the same goal as the code you have provided. Hope this helps.
--Ryan S.
01-03-2012 10:55 PM
These examples worked as expected when I selected a device that I had made in MAX and selected from the physical channel list box which seemed to reflect what I had made in MAX. I also noted that the example had a clock source input from a list box. So I selected the clock source from the same device that I used in the physical channel list box and I assume that this set of listings for the clock source was something that was made from MAX. Anyway the two examples worked as expected and the code in them seemed to be pretty much the same that I have been coding in my examples.
01-05-2012 10:13 AM
Hey Cuthbert,
I'm glad to hear those examples worked for you. The major difference between those examples and your code is calling the tasks. In general, it's always best to create and format your tasks programmatically, as shown in the examples. Simply put, if you want to call tasks that are made in MAX, then I recommend doing it as previously shown with the start task. Otherwise, follow the examples and create your tasks programmatically with the create virtual channel function. Hope this helps!
--Ryan S.