发表于:2006-12-06 11:08:00
楼主
Static PT_MAIVoltageInptMAIVoltageIn;
PT_MAIConfigptMAIConfig;
DEVFEATURES DevFeatures;
PT_DeviceGetFeatures ptDevFeatures;
float voltage[3];
float *fvoltage;
fvoltage= voltage;
unshort gwGain[3];
Void CstartDlg:On Button1() //打开设备;
{ Errcde =DRV_Deviceopen(0,(LONG far*)&Driverhandle);
char szErrMsg[80];
if (Errcde!=success)
{strcpy(szErrMsg, “Device open error!”);
MessageBox((LPCSTR)szErrMsg, “Device open error!”,MB_ok);
return;}
PtDevFeatures.buffer=(LPDEVFEATURES)&DevFeatures); //取得设备设置
PtDevFeatures.size=sizeof(DEVFEATURES);
if(Errcde=DRV_DeviceGetFeatures(DriverHandle,(LPT_DeviceGetFeature)& ptDevFeature))!=success)
{ DRV_GetErrorMessage(Errcde, (LPSTR)szErrMsg);
MessageBox((LPCSTR)szErrMsg, “Device Message”, MB_ok);
DRV_Deviceclose((LONG far*)&DriveHandle);
return;}
PtMAIConfig. NumChan=3; //配置设备增益
PtMAIConfig. StartChan=1;
[color=#FF0000]PtMAIConfig. GainArray=DevFeatures.glGainlist[*gwGain].usGaincde;[/color]if ((Errcde=DRV_MAIConfig(DriverHandle, ( LPT_MAIConfig)& ptMAIConfig))!=0)
{ DRV_GetErrorMessage(Errcde, (LPSTR)szErrMsg);
MessageBox((LPCSTR)szErrMsg, “Device Message”, MB_ok);
DRV_Deviceclose((LONG far*)&DriveHandle);
return;}
PTMAIVoltageIn. NumChan=3;
PTMAIVoltageIn. StartChan=1;
[color=#008000]PTMAIVoltageIn. GainArray= PtMAIConfig. GainArray;[/color]PTMAIVoltageIn. TrigMode=0;
PTMAIVoltageIn. VoltageArray=(float far*)&voltage;
Void CstartDlg: On timer(UINT nlDEvent) //启动计时器
{ Set Timer (15000);}
char szErrMsg[80]; //采集数据
Cstring szBuffer;
strcpy(szErrMsg, “Device open error!”);
for (fvoltage= voltage; fvoltage<( voltage+3); fvoltage++)
{szBuffer.Format(“data=10.6%”,*fvoltage);}
if ((Errcde=DRV_MAIVoltageIn(DriverHandle,(LPT_MAIVoltageIn))&ptMAIVoltageIn))!=0)
{DRV_GerErrorMessage(Errcde, (LPSTR)szErrMsg);
MessageBox((LPCSTR)szErrMsg, “Device Message”, MB_ok);
DRV_Deviceclose((LONG far*)&DriveHandle);
return;}
void CstartDlg: on button2( ) //停止采集
{ kill timer(1);
DRV-Deviceclose ((LONG far*)&Driverhandle);}
Void Cstart: on OK()
{ if (DeviceHandle!=(LONG)NULL)
DRV_DeviceClose((LONG far*)&DeviceHandle);}
哪位高手能帮忙指正下程序的错误啊,先谢谢了,呵呵