毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

VC++单片机虚拟仪器测试系统 第2页

更新时间:2010-5-5:  来源:毕业论文
VC++单片机虚拟仪器测试系统 第2页
函数信号发生器重点的编写函数
void CGENERATER::OnBtnOk()
{ ViStatus error;//对错误信息的存储 
 //获得调制方式的ID
 int nID_Select_Modul;
 nID_Select_Modul=GetCheckedRadioButton(IDC_RADIO_BW,IDC_RADIO_FM);//问题的关键就出现在这里--该函数没有执行--2005、4、28
                                                                     //问题解决了!!原来是单选按钮的ID的值的大小问题!!
                                                                  //在该函数中,小的在前,大的在后!!!--2005/4/29
   UpdateData(TRUE);
//******************************************测试代码---成功---2005/24/29
//   sprintf(buffer,"%d",nID_Select_Modul);
//   MessageBox(buffer);
//******************************************
   //进行判断处理
   switch(nID_Select_Modul)
   {   case IDC_RADIO_BW:
     viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:LOAD %s\n",m_nResistance);//输出端的设置
 viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:SYNC %s\n",m_nSignal);//设置同步信号
 CheckWaveRadioButton();//波形选择的判断--将波形的字符串存储在m_nBaseShape中
//**********************************判断用户选择的波形是否是方波
 if(GetCheckedRadioButton(IDC_RADIO_SIN,IDC_RADIO_DC)==IDC_RADIO_FWAVE)
 {
  viPrintf(/*funcgen*/theApp.m_Session,"FUNC %s\n",m_nBaseShape);
  viPrintf(/*funcgen*/theApp.m_Session,"FREQ %f\n",m_nFreq);
  viPrintf(/*funcgen*/theApp.m_Session,"VOLT %f\n",m_nAmpl);
  viPrintf(/*funcgen*/theApp.m_Session,"VOLT:OFFS %f\n",m_nOffs);
  viPrintf(/*funcgen*/theApp.m_Session,"FUNC:SQU:DCYC %f\n",m_nDcycle);
 }//******************************判断用户选择的是否是任意波
 else if(GetCheckedRadioButton(IDC_RADIO_SIN,IDC_RADIO_DC)==IDC_RADIO_ARBI)
 {error=viPrintf(/*funcgen*/theApp.m_Session,"APPL:USER %f,%f,%f\n",m_nFreq,m_nAmpl,m_nOffs);
  if(error!=VI_SUCCESS)
  { error_handler(/*funcgen*/theApp.m_Session,error);
      break;
  } viPrintf(/*funcgen*/theApp.m_Session,"FUNC:USER %s\n",WaveForm.m_Arbitrary); }
 else
 {  error=viPrintf(/*funcgen*/theApp.m_Session,"APPL:%s %f,%f,%f\n",m_nBaseShape,m_nFreq,m_nAmpl,m_nOffs);//这里的参数需要用户自己添加        if(error!=VI_SUCCESS)
  {    error_handler(/*funcgen*/theApp.m_Session,error);
      break; } }
    MessageBox("Successfully!");//给一个提示框--明示用户的操作
    break; 
  case IDC_RADIO_AM:      
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:LOAD %s\n",m_nResistance);//输出端的设置
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:SYNC %s\n",m_nSignal);//设置同步信号
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut OFF\n");
    CheckWaveRadioButton();//波形选择的判断--将波形的字符串存储在m_nBaseShape中
    error=viPrintf(/*funcgen*/theApp.m_Session,"APPL:%s %f,%f,%f\n",m_nBaseShape,m_nFreq,m_nAmpl,m_nOffs);//这里的参数和基波一样--即是载波
       if(error!=VI_SUCCESS)
  {      error_handler(/*funcgen*/theApp.m_Session,error);
      break;  }
    if("EXT"!=WaveForm.m_Source)    {
     viPrintf(/*funcgen*/theApp.m_Session,"AM:SOUR %s\n",WaveForm.m_Source);
        viPrintf(/*funcgen*/theApp.m_Session,"AM:INT:FUNC %s\n",WaveForm.m_WaveF);//这里输入调制波的波形
           viPrintf(/*funcgen*/theApp.m_Session,"AM:INT:FREQ %f\n",WaveForm.m_Freq);//这里输入调制波的频率
        viPrintf(/*funcgen*/theApp.m_Session,"AM:DEPT %f\n",WaveForm.m_A_Dept);//这里输入调制波的调制深度
        viPrintf(/*funcgen*/theApp.m_Session,"AM:STAT ON\n");//启动调制
        viPrintf(/*funcgen*/theApp.m_Session,"OUTPut ON\n");
     MessageBox("Successfully!"); 
     break;    }
    else
    {     break;    }
   case IDC_RADIO_FM:
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:LOAD %s\n",m_nResistance);//输出端的设置
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut:SYNC %s\n",m_nSignal);//设置同步信号
    viPrintf(/*funcgen*/theApp.m_Session,"OUTPut OFF\n");//是否必要???---有待核实---2005、4、28
    CheckWaveRadioButton();//波形选择的判断--将波形的字符串存储在m_nBaseShape中
    error=viPrintf(/*funcgen*/theApp.m_Session,"APPL:%s %f,%f,%f\n",m_nBaseShape,m_nFreq,m_nAmpl,m_nOffs);//这里的参数和基波一样--即是载波
    if(error!=VI_SUCCESS)
  {      error_handler(/*funcgen*/theApp.m_Session,error);
      break;  }
      if("EXT"!=WaveForm.m_Source)
    {    viPrintf(/*funcgen*/theApp.m_Session,"FM:SOUR %s\n",WaveForm.m_Source);
       viPrintf(/*funcgen*/theApp.m_Session,"FM:INT:FUNC %s\n",WaveForm.m_WaveF);//这里输入调制波的波形
          viPrintf(/*funcgen*/theApp.m_Session,"FM:INT:FREQ

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

VC++单片机虚拟仪器测试系统 第2页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。