ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

200077

Hi,

I am using NI_DAQmx tools in matlab to set up my AI channel. When I try to read to AI channel, the baseline of the sine wave shift continuously up and up (I used a function generator to produce the sine wave which the baseline is on zero). I met the similar problem before, when I was using the Data Acquisition ToolBox in matlab. I set the ai.inputtype='SingleEnded' to fix this problem. But right now, I am using the NI_DAQmx tools, how can I set the ground in the right way?

If anybody knows the way to solve this problem, could you please tell me?

Thank you so much! 

liming

0 Kudos
Message 1 of 6
(3,508 Views)

I try to read data to AI channel.

I am not sure how to use DAQmxAIAutoZeroMode. I always got error code 200077.

Here is my code.

[a,b,taskMasterAI]=calllib(

'myni','DAQmxCreateTask','',taskMasterAI)

taskAIChan1='/Dev2/ai0';

 

[a,b,c,d]=calllib(

-10,10,DAQmx_Val_Volts,

'myni','DAQmxCreateAIVoltageChan',taskMasterAI,taskAIChan1,'',DAQmx_Val_Cfg_Default,'')

 

nsample=1000;

[a,b]=calllib(

DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,nsample)

'myni','DAQmxCfgSampClkTiming',taskMasterAI,'',1000,

 

[a]=calllib(

'myni','DAQmxSetAIAutoZeroMode',taskMasterAI,'',

DAQmx_Val_Once)

[a]=calllib(

'myni','DAQmxStartTask',taskMasterAI)'doublePtr',readarray);'int32Ptr',0);'uint32Ptr',[])'myni','DAQmxReadAnalogF64',taskMasterAI,1000,10,DAQmx_Val_GroupByScanNumber,...

readarray_ptr,arraylength,sampread_ptr,empty_ptr)

 

)

 

After I execute the DAQmxAIAutoZeroMode, the error -200077 will appear.

I don't know what's wrong with my code.

If someone knows, please let me know.

Thanks!

numofchans=1;

nsample=1000;

readarray=ones(numofchans,nsample);

readarray=double(readarray);

readarray_ptr=libpointer(

sampread_ptr=libpointer(

empty_ptr=libpointer(

arraylength=uint32(numofchans*nsample);

 

[a,b,c]=calllib(

0 Kudos
Message 2 of 6
(3,483 Views)

The error 200077 is a DAQmx error stating that a requested value is not supported by a property.  Is there any text or explanation that accompanies the error?  It sounds like you are requesting something that is indeed not supported.

 

What is the NI device you are using?

 

A good place to look would be the DAQmx C Reference Help.  Search for the DAQmxCreateAIVoltageChan function.  You can then find the property for terminalConfig, and then note that you shouold set this value to DAQmx_Val_RSE instead of using  DAQmx_Val_Cfg_Default as you have specified.

 

I do not think that the device you are using will have/implement the Autozero function.

 

Best,

Adam
Academic Product Manager
National Intruments
0 Kudos
Message 3 of 6
(3,471 Views)

Hi Adam,

Thank you for your replying.

I am using PCI 6221 right now.

If this device has not the AutoZero function. How could I set the right ground for my analog input channel? I know I can set single ended ground or differential ground in labview. But right now I am using matlb to call DAQmx. I am not sure what I should do.

liming

0 Kudos
Message 4 of 6
(3,456 Views)

You should do what Adam told you to do about the channel config. DON'T specify DAQmx_Val_Cfg_Default like you are doing now and specify DAQmx_Val_RSE just like he said.

0 Kudos
Message 5 of 6
(3,450 Views)

Thank for everyone's reply. I got it.

0 Kudos
Message 6 of 6
(3,446 Views)