请教高手帮我看看这个程序

sfandlh 2007-01-08 06:40:55
这是一个简单的程序,利用windows lab cvi 设计一个能产生正弦波,方波,三角波和随即型号的虚拟波形生成器,并显示波形。但是程序调试总是出错,实在弄不明白,故在此请教高人赐教。谢谢
#include <ansi_c.h>
#include <cvirte.h> /* Needed if linking in external compiler; harmless otherwise */
#include <userint.h>
#include "bxq.h"

static int panelHandle;
double datapoints[100];

int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "bxq.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
return 0;
}

int CVICALLBACK AcquireData (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{ int trace_color,shape;
if(event==EVENT_COMMIT){
GetCtrlVal(panelHandle,PANEL_WFM,&shape);
switch(shape){

case0:
GenerateWave(1) ; /* missing prototype */
break;
case1:
GenerateWave(2) ; /* missing prototype */
break;
case2:
GenerateWave(3) ; /* missing prototype */
break;
case3:
GenerateWave(4) ; /* missing prototype */
break;
}
GetCtrlVal(panelHandle,PANEL_COLOR,&trace_color) ; /* warning:Switch statement with no cases */
DeleteGraphPlot(panelHandle,PANEL_GRAPH,-1,1);
PlotY(panelHandle,PANEL_GRAPH,datapoints,100,VAL_DOUBLE,
VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,trace_color);
}
return (0);

}
GenerateWave(int shape)
{ int i;

switch(shape){
case 1:
for(i=0;i<100;i++)
datapoints[i]=50*sin((((2*3.1415926536)/100)*i))+50;
break;
case 2:
for(i=0;i<33;i++)
datapoints[i]=33.0;
for(i=33;i<67;i++)
datapoints[i]=67.0;
for(i=67;i<100;i++)
datapoints[i]=33.0;
break;
case 3:
for(i=0;i<25;i++){
datapoints[i]=i*4;
datapoints[i+25]=100-(i*4);
datapoints[i+50]=i*4;
datapoints[i+75]=100-(i*4);
}
break;
case 4:
for(i=0;i<100;i++)
datapoints[i]=rand()/32767.0*100.0;
break;
}

int CVICALLBACK Shutdown (int panelHandle, int control, int event, /* illegal statement termination */
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}
...全文
490 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
我也想知道,正在找這方面的資料~~~~~
UltraBejing 2008-05-01
  • 打赏
  • 举报
回复
接分是王道!
阿Deee 2007-03-28
  • 打赏
  • 举报
回复
什么问题
jinanjiang 2007-03-16
  • 打赏
  • 举报
回复
up
「已注销」 2007-02-16
  • 打赏
  • 举报
回复
up
rocy520 2007-02-05
  • 打赏
  • 举报
回复
帮LZ顶
hertcloud 2007-01-22
  • 打赏
  • 举报
回复
出的什么错?
byhum 2007-01-09
  • 打赏
  • 举报
回复
帮LZ顶
wshuangminlg 2007-01-09
  • 打赏
  • 举报
回复
帮LZ顶

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧