10-22-2008 03:20 PM
My last project from three years ago utilized Visual Studio 6.0. I am now using VS 2005.and created a "NI MFC DAQmx DLL".
I used the wizard to create a CNiDAQmxTask class called CDAQmx1124VOutTask for the 1124 card. The class now contains six different voltage channels in the Configure function. How do I write to a single channel?
Boy, C++ examples for solutions using the DAQmx Assistent are non-existent. All I find are C# examples, or native DAQmx funtions.
The best I have been able to come up with is this that will compile.
CDAQmx1124VOutTask m_1124VOut;
m_1124VOut.Start();
CNiDAQmxAnalogSingleChannelWriter* writer = new CNiDAQmxAnalogSingleChannelWriter(m_1124VOut.Stream);
writer->WriteSingleSample(TRUE, 12.);
delete writer;
Which output on the card will end up writing the 12 volts? Do I need to have the DAQmx Assistant create a new CNiDAQmxTask
for each output on the card? Any help or example links would be greatly appreciated.
TIA
Eric
10-23-2008 06:32 PM
Hello Eric,
The question of which output on the 1124 card will write the 12 volts depends on how you configured the DAQmx Task. If you specified all six channels, then you would need to create an array of data that is 6 elements in length. The first element in that array would be written to AO channel 0. The second element in the data array would be written to AO channel 1, and so on. So this answers the question about needing to create separate tasks for each individual channel. It would suffice to specify all of the physical channels in one task, and then specify the voltage updates to each channel based on the entries in the array. You can find examples by going to the following (or a similar) location in the directory structure of your computer (Windows OS assumed).
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\MStudioVC2005\Analog Out\Generate Voltage
Best wishes,
Wallace F.