|
int CVICALLBACK shuipingshiji (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int i;
long error;
long id=-1,*idnum=&id;
long demo=0,numChannels=4,disableCal=0;
long transferMode=0;
long channels[4]={0,1,2,3};
long gains[4]={0,0,0,0};
float voltages[4096][4]={0};
long stateIOout[4096]={0};
long ov,*overVoltage=&ov;
long stateIOin=0 ;
long updateIO=0 ;
long ledOn=1;
long triggerIO=0;
long triggerState=0;
int32 samplesread=100;
float64 readarray[1000];
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (panelHandle, PANEL_SHUIPINGSHIJI, &spsj);
switch(spsj)
{
case 0:sr=256;numScans=1024; break;
case 1:sr=512;numScans=1024; break;
case 2:sr=1024;numScans=1024; break;
case 3:sr=1024;numScans=512; break;
case 4:sr=1024;numScans=256; break;
case 5:sr=1020;numScans=102; break;
case 6:sr=1000;numScans=50; break;
case 7:sr=1000;numScans=25; break;
case 8:sr=1000;numScans=10; break;
case 9:sr=1000;numScans=5; break;
}
DAQmxReadAnalogF64(taskHandle, 1000, 10.0, DAQmx_Val_GroupByScanNumber,readarray, 1000, &samplesread, NULL);
//此daq一直报错,
for(i=0;i<numScans;i++) wave1=voltages[0];
for(i=0;i<numScans;i++) wave2=voltages[1];
for(i=0;i<numScans;i++) wave3=voltages[2];
for(i=0;i<numScans;i++) wave4=voltages[3];
for(i=0;i<numScans;i++)
{
wave11=wave1;
wave22=wave2;
wave33=wave3;
wave44=wave4;
}
zt();
break;
}
return 0;
}
|
|