Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a data from SCC-SG04?

I am using SCC-2345 with SCC-SG04 connected to NI-6221 in Windows 2000 in VC6.
There is an example in NI'CD (Cont Strain Samples) shown below:
...
float64 data[1000];
....

DAQmxErrChk (Configure_StrainSamps...);
DAQmxErrChk (Start_StrainSamps(taskHandle));
...
DAQmxErrChk (Read_StrainSamps(taskHandle,data,1000,&read));
...

Question 1: How to get data from Read_StrainSamps? I tried to get one data by
DAQmxErrChk (Read_StrainSamps(taskHandle,&value,1000,&read)); // &value?
printf("%f\n",value);
but it can only give one data, how to get all data as defined data[1000] and output to a file? Can I write as below and output all data?
DAQmxErrChk (Read_StrainSamps(taskHandle,&data,1000,&read)); // &data??

Question 2: What is the meaning of parameters in Read_StrainSamps(taskHandle, data, 1000, &read)? I can not find its definition in anyplace.

Question 3: For SG04, I used 4 straingauge with 120Ohm, is it okay for not 350ohm?
0 Kudos
Message 1 of 6
(4,069 Views)
Please help me!!! Thanks. Bill.
0 Kudos
Message 2 of 6
(4,062 Views)
Hi,

I am not sure of the code you are using because it doesn't match up to the examples. Nonetheless:

1) You need to be use data instead of &data to retrieve these values

2) Read_StrainSamples is not a function, and I do not know where you got this from. I am looking at .C file from the Cont Strain Sample example, and it is not being used. Make sure you are using the example from here:
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Strain\Cont Strain Samples

3)That should be fine as long as you change the gage resistance value. For more information on these devices, you can look at the manual:
http://digital.ni.com/manuals.nsf/websearch/876393DF257DB5B086256E55005A51CE?opendocument

Have a Great Day!

George
Message 3 of 6
(4,052 Views)
Hi, George, many thanks!

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

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();
}


Question (2)
Suppose sampling rate is 1000 samples per second, number of 1024 data acquired every time, SG04 has two channels (0,1), how to let chan0 and chan1 get the data at the same time, i.e., DataChan0[i] and DataChan1[i] acquire data the the same time? What is their relationship with data[i] as defined above?
0 Kudos
Message 4 of 6
(4,041 Views)
Please help me!!! Thanks.
0 Kudos
Message 5 of 6
(4,034 Views)
Hi,

First, go ahead and run the example found here:

C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Strain\Cont Strain Samples

Then, to add multiple channels to a task, you can change the channel string to "SCC1Mod1/ai0:1" This will include channels 0 and 1. if you wanted channels 0,1, and 2, you would use SCC1Mod1/ai0:2.

For information on particular functions, you can view the DAQmx C reference help (found in the National Instruments folder under NI-DAQ). This is the best source for figuring out how particular functions work. There are examples and great descriptions of each function.

Have a Great Day!

George
0 Kudos
Message 6 of 6
(4,018 Views)