10-21-2012 11:16 PM
I have had this board working ok until I connected it to some other equipment.
the first 3 inputs are connected to load cell amps and the fourth to measure the output of the test machine appling load to the load cells.
Its when I conect to this test machine the voltages go all over the place.
I have the inputs wired in differential mode.
I got into Test panels and selected differential then ran the program, then selected create a task so I could select four inputs and all the channels read ok.
So what I think I need is some way to configure my code to set the USB6210 to be in differential mode.
I have searched the NI examples and can not find an example.
this is the code I use to set up the USB6210
int32 error=0;
TaskHandle taskHandle=0;
char chan[256];
float64 min=-10.0,max=10.0,rate=10000;
uInt32 sampsPerChan=100;
int32 numRead,a;
uInt32 numChannels;
float64 *data=NULL;
int log;
char errBuff[2048]={'\0'};
uInt32 i;
float Floatnum;
char NumString[30];
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai1,Dev1/ai2,Dev1/ai3,Dev1/ai4","",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChan));
DAQmxErrChk (DAQmxGetTaskAttribute(taskHandle,DAQmx_Task_NumChans,&numChannels));
if( (data=malloc(sampsPerChan*numChannels*sizeof(float64)))==NULL )
{
MessagePopup("Error","Not enough memory");
goto Error;
}
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
Solved! Go to Solution.
10-22-2012 02:04 AM
You may have to use:
DAQmxSetChanAttribute (taskHandle, "", DAQmx_AI_TermCfg, DAQmx_Val_Diff, 0);
This will affect all channels in the task.