|
감사해여~!
몇일쨰 보고 있는데 이해가 좀 더디네여 ㅎㅎ
ㄳㄳ~!!
김형준 님이 쓰신 글 :
: 느낌이 예전에 토크관련 질문올리신 분 같은데... 질문의 내용들이 좀... 많이 바쁘신것 같군요...
:
: AverageData 함수는 DAQ 보드에서 평균값얻는 함수 입니다.
: 설정한 채널과 갯수 만큼 돌면서 평균값을 구하는군요.
: 이렇게 하면 여러 채널 읽을경우
: 1. 시간이 많이 걸리고 채널사이의 동기가 안되고
: 2. 데이타 외곡도 생길 우려가 있어
: 잘 사용안하는데...
: 보통 필요한 채널을 묶어 scan을 사용합니다.
:
: 두번째 함수는 모르겠군요.
:
:
: ㅇ 님이 쓰신 글 :
: : double AverageData(USHORT ch, int count)
: : {
: : static PT_AIVoltageIn ptAIVoltageIn;
: : static PT_AIConfig ptAIConfig;
: : float dVoltage, total = 0.0;
: : double ad_value = 0.0;
: :
: : ptAIConfig.DasChan = ch;
: : if(ch != 0) ptAIConfig.DasGain = 0; //+/- 10V
: : else ptAIConfig.DasGain = 1; //+/- 5V
: :
: : DRV_AIConfig(DriverHandle, (LPT_AIConfig)&ptAIConfig);
: :
: : for(int i = 0; i < count; i++) {
: : dVoltage = 0.0;
: : ptAIVoltageIn.chan = ptAIConfig.DasChan; // input channel
: : ptAIVoltageIn.gain = ptAIConfig.DasGain ; // input range
: : ptAIVoltageIn.TrigMode = 0; // 0 : internal trigger, 1 : external trigger
: : ptAIVoltageIn.voltage = &dVoltage;
: : DRV_AIVoltageIn(DriverHandle, (LPT_AIVoltageIn)&ptAIVoltageIn);
: : total += dVoltage;
: : }
: :
: : ad_value = total / count;
: : return ad_value;
: : }
: : //---------------------------------------------------------------------------
: : double ConvertData(USHORT ch, int avg)
: : {
: : double value;
: : double temp[5];
: :
: : value = AverageData(ch, avg);
: :
: : temp[0] = adj_valx[action_direct][ch] - init_valx[action_direct][ch];
: : if(temp[0] == 0) temp[0] = 0.01;
: :
: : temp[1] = adj_valy[action_direct][ch] - init_valy[action_direct][ch];
: : temp[2] = temp[1] / temp[0];
: : temp[3] = (temp[2] * value) - (temp[2] * init_valx[action_direct][ch]);
: : temp[4] = temp[3] + init_valy[action_direct][ch];
: : if(temp[4] <= 0) temp[4] = 0;
: :
: : return temp[4];
: : }
: : 이해가 안되네여.. 대충 설명좀..
|