Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6211 setup for DA

Solved!
Go to solution

I am trying to use a USB-6211 in a very simple Visual Studio C++ system. The ultimate intention is to continuousely output data to the two channels at 180 samples per second. At this point, I have the following commands setup:

 

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,
    devcmd,    //physical channel
    "",    //name assigned
    -10.0,    //min output value
    10.0,    //max output value
    DAQmx_Val_Volts,    //units of output
    ""    //custom scale name
    ));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,
    "",    //source (default to OnboardClock)
    180.0,    //rate in samples per second
    DAQmx_Val_Rising,    //active edge
    DAQmx_Val_FiniteSamps,    //a finite number of samples (to be changed)
    samples_to_write    //samples to aquire
    ));
DAQmxErrChk (DAQmxStartTask(taskHandle));

 

On the last command I get the message:

 

Non-bufferered hardware-timed operations are not supported for this device and Channel type. I can not make any sense out of this. Any suggestions?

0 Kudos
Message 1 of 7
(6,357 Views)

Hi mhubel,

 

Are you getting any specific error code associated with this message? 

Regional Account Manager
NI
0 Kudos
Message 2 of 7
(6,346 Views)

The full error message is:

 

 DAQmx Error: Non-buffered hardware-timed operations are not supported
 for this device and Channel Type.

Set the Buffer Size to greater than 0, do not configure Sample Clock timing, or
set Sample Timing Type to On Demand.
Task Name: _unnamedTask<0>

Status Code: -201025

 

Note that the buffer is be set by samples_to_write which is set to 1800

 

If you wish to look at I have included the offending routine as an attachment. This message is generated by line 35, the DAQmxStartTask

 

0 Kudos
Message 3 of 7
(6,332 Views)

Hi mhubel, 

 

It seems you may be attempting to do a non buffered hardware write, which is not supported by USB devices.  One way to fix this is to create a buffer before you start writing.  Please refer to the below KB for more information.

 

http://digital.ni.com/public.nsf/allkb/EC1968728E660B288625780700570D06?OpenDocument

Regional Account Manager
NI
0 Kudos
Message 4 of 7
(6,328 Views)

I effectively removed the DAQmxStartTask as is implied and it appears to work. This seems counter intutitive. I will never have the time to really understand the whole NI structure as I only use two very simple devices in a simple application. I mostly wish there was a much more direct way to talk to these devices without all the "help" of the whole NI system.

Still the buffering does not work on subsequent calls.

I have spend too much time on this simple issue. It is time to give up and build a D-A that is simple to access.

0 Kudos
Message 5 of 7
(6,324 Views)
Solution
Accepted by topic author mhubel

One of your support people helped on the phone. It seems that a somewhat obscure command

 

DAQmxSetWriteRegenMode(taskHandle, DAQmx_Val_DoNotAllowRegen)

 

is required to get buffering to work properly. This is a very poorly documented command and there is no real indication that it is required.

0 Kudos
Message 6 of 7
(6,317 Views)

That's great to hear you got some good immediate support and I apologize about the poor documentation, I am going to go ahead and add this information to the Knowledge Base.

 

Happy Programming

Regional Account Manager
NI
0 Kudos
Message 7 of 7
(6,302 Views)