Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

*** Help me*** Why SG04'd data displayed as 0.0000

SG04 does work in DAQmax Explorer. However, following show all data as 0.00000, how to display correct data?

iStatus = DAQmxStartTask (0);
DAQmxCfgSampClkTiming (
0, //TaskHandle taskHandle,
"", //const char source[],
1000, //float64 rate,
DAQmx_Val_Rising, //int32 activeEdge,
DAQmx_Val_ContSamps, //int32 sampleMode, DAQmx_Val_FiniteSamps
1000); //uInt64 sampsPerChanToAcquire);

iStatus=DAQmxCreateAIStrainGageChan
(0, //TaskHandle taskHandle,
"SCC1Mod1/ai0", //const char hysicalChannel[],
"ai0", //const char nameToAssignToChannel[], ???
-0.001, //float64 minVal,
0.001, //float64 maxVal,
1, //int32 units,
DAQmx_Val_FullBridgeI, //int32 strainConfig,
DAQmx_Val_Internal, //int32 excitSource,
2.5, //float64 excitVal,
2.0, //float64 gageFactor,
0.0, //float64 initialBridgeVoltage,
120, //float64 nominalGageResistance,
0.285, //float64 poissonRatio,
0.0, //float64 leadWireResistance,
NULL //const char customScaleName[]
);

for (int i=0; i<1024; i++)
{
iStatus=DAQmxReadAnalogF64 (
0, //TaskHandle taskHandle,
1024, //int32 numSampsPerChan,
10000, //float64 timeout,
DAQmx_Val_GroupByScanNumber, //bool32 fillMode, ???
data, //float64 readArray[],
10000, //uInt32 arraySizeInSamps,
NULL, //int32 *sampsPerChanRead, ???
NULL //bool32 *reserved
);

sprintf(buff,"%f",data[i]);
GetDlgItem(IDC_BUFFER)->SetWindowText(buff);
GetDlgItem(IDC_BUFFER)-> UpdateWindow();
}

please send me an email to hollychen16@yahoo.ca

Thanks you for your help!
0 Kudos
Message 1 of 3
(3,043 Views)
Hi mwibm,

You need to first create a task in your code. Please use the example program mentioned in the thread below as a starting point for your application:

http://forums.ni.com/ni/board/message?board.id=300&message.id=1720

Best Regards,
Lesley
0 Kudos
Message 2 of 3
(3,035 Views)
Hi mwibm,

Can you post your complete code so we can better understand the problem? At the moment, are you encountering the link error related to the DAQmxChannelAttribute, or the data returned from the example program still 0.000? What are you trying to do beyond strain data acquisition example? How does your code differ from the example? If you can provide more details on your application, the code, and precisely where the error is occurring, we can better resolve the issue.

Thanks,
Lesley
0 Kudos
Message 3 of 3
(3,027 Views)