发表于:2007-01-19 11:54:00
楼主
此程序的编程环境为LabWindows/CVI,使用产品为凌华公司出品PXI-9820。
小弟欲使用线程安全队列在线程间传递数据实并用次线程进行数据采集,主线程将采集数据转换为标准格式并在用户界面上显示、存为文件。
但运行下面的程序得到的结果却不正确。信号源发出的信号为100周峰峰值100mv的正弦信号。得到的数据却是0通道为类似N个连续的CW脉冲,1通道干脆没有数据。这是怎么回事。。。请教。拜谢了!!!
已经卡在这好久了。。。
/*------------------------------ DAQ things---------------------------------*/
void CVICALLBACK DAQ_ConfigPopup (int menuBar, int menuItem, void *callbackData, int panel)
{
DAQconfigpanel = LoadPanel ( 0, "ADPAN.uir", DAQCONFPAN);
InstallPopup (DAQconfigpanel);
if(daq_conf->config_seted == 1)
{
WD_Release_Card(daq_conf->card);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_RANGE,daq_conf->ADrange);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_TIMEBASE,daq_conf->timebase);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGSRC,daq_conf->trigsrc);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGMODE,daq_conf->trigmode);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGDELAYTICKS,daq_conf->delayticks);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_BUFFLEN,daq_conf->bufflength);
switch((int)daq_conf->channel)
{
case 0:
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL0,1);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL1,0);
break;
case 1:
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL1,1);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL0,0);
break;
case -1:
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL0,1);
SetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL1,1);
break;
}
}
}
int CVICALLBACK DAQConfigOK (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int a,b;
int err = 0;
char inform[30];
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL0,&a);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_CHANNEL1,&b);
if(a == 1&&b == 0)
daq_conf->channel = 0;
if(a == 0&&b == 1)
daq_conf->channel = 1;
if(a == 1&&b == 1)
daq_conf->channel = -1;
if(a == 0&&b == 0)
{MessagePopup("Erro","Erro in channel selection.");
return -1;}
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_RANGE,&daq_conf->ADrange);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_TIMEBASE,&daq_conf->timebase);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGSRC,&daq_conf->trigsrc);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGMODE,&daq_conf->trigmode);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_TRIGDELAYTICKS,&daq_conf->delayticks);
GetCtrlVal(DAQconfigpanel,DAQCONFPAN_BUFFLEN,&daq_conf->bufflength);
daq_conf->config_seted = 1;
if ((daq_conf->card = WD_Register_Card (PCI_9820, 0)) <0 ) <