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

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]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有