Crystal_Init_Age8960.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:22k
源码类别:

MTK

开发平台:

C++ Builder

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *   Crystal_Init_Age8960.cpp
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   Maui META APP
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Crystal Initalize Agilent 8960 source
  48.  *
  49.  * Author:
  50.  * -------
  51.  *  Andy Ueng (mtk00490)
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * $Revision$
  58.  * $Modtime$
  59.  * $Log$
  60.  * 
  61.  *------------------------------------------------------------------------------
  62.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  63.  *============================================================================
  64.  ****************************************************************************/
  65. //---------------------------------------------------------------------------
  66. #include <vcl.h>
  67. #pragma hdrstop
  68. #include "man_dll.h"
  69. #include "form_RFTool.h"
  70. #include "Crystal_Init_Age8960.h"
  71. #include "meta_utils.h"
  72. #include "Crystal_INIFileHandle.h"
  73. // equipment
  74. #ifndef _AGECOMMON_H_
  75. #include "agecommon.h"
  76. #endif
  77. #include "cmu200.h"
  78. //---------------------------------------------------------------------------
  79. //#define ONE_SECOND 1
  80. //------------------------------------------------------------------------------
  81. CMU_VAR cmu_crystal_tx;
  82. static ViInt16 vi_Band_Crystal_tx;
  83. extern TfrmRFTool *frmRFTool;
  84. //=================================================================================
  85. //------------------------------------------------------------------------------
  86. void _fastcall Crystal_Init_Age8960::ShowMsg()
  87. {
  88.    ShowMessage( as_Msg );
  89. }
  90. //------------------------------------------------------------------------------
  91. //------------------------------------------------------------------------------
  92. void _fastcall Crystal_Init_Age8960::SyncShowMsg(AnsiString as)
  93. {
  94.    as_Msg = as;
  95.    Synchronize( ShowMsg );
  96. }
  97. //=========================================================================================
  98. __fastcall Crystal_Init_Age8960::Crystal_Init_Age8960(
  99.                                                         bool CreateSuspended,
  100.                                                         AnsiString as_ADDR,
  101.                                                         int i_TimeOut,
  102.                                                         signed short ss_Band,
  103.                                                         TNotifyEvent ne_OnTermHandler,
  104.                                                         ViSession &vs_Age196x,
  105.                                                         TMETA_crystal_cfg *crystal_cfg,
  106.                                                         AnsiString &as_TaModel
  107.                                                      )
  108.         : TThread(CreateSuspended)
  109. {
  110.     as_AGE8960_ADDR = as_ADDR;
  111.     i_AGE8960_TimeOut = i_TimeOut;
  112.     ss_CellBand = ss_Band;
  113.     ne_OnTerminate = ne_OnTermHandler;
  114.     pvi = &vs_Age196x;
  115.     cfg = crystal_cfg;
  116.     as_pAgeTaModel = &as_TaModel;
  117. }
  118. //---------------------------------------------------------------------------
  119. void __fastcall Crystal_Init_Age8960::Execute()
  120. {
  121. #if 0
  122.     if(frmRFTool->rb8960_TXErr->Checked)
  123.     {
  124.         if ((vistat = age1960_init( as_AGE8960_ADDR.c_str(), 0, 0, &vi)) != VI_SUCCESS)
  125.         {
  126.             Application->MessageBox( " Initialize Agilent 8960 fail 2", "Fail", MB_OK );
  127.             return;
  128.         }
  129.         //////////////////////////////////////////////////////////////////////////////
  130.         if ( (vistat = age_QueryTaModel( vi, as_pAgeTaModel )) != VI_SUCCESS)
  131.         {
  132.             Application->MessageBox( " Query Agilent 8960 TA Model fail ", "Fail", MB_OK );
  133.             return;
  134.         }
  135.         //////////////////////////////////////////////////////////////////////////////
  136.         Sleep(50);
  137.         if ( vi != VI_NULL)
  138.         {
  139.             if ( age1960_dcl(vi)!= VI_SUCCESS)
  140.             {
  141.                 Application->MessageBox( " Agilent 8960 DCL fail ", "Fail", MB_OK );
  142.                 return;
  143.             }
  144.         }
  145.         //////////////////////////////////////////////////////////////////////////////
  146.         Sleep(50);
  147.         if ( vi != VI_NULL)
  148.         {
  149.             if (vistat = age1960_reset( vi ) != VI_SUCCESS)
  150.             {
  151.                 Application->MessageBox( " Reset Agilent 8960 fail ", "Fail", MB_OK );
  152.                 return;
  153.             }
  154.         }
  155.        /////////////////////////////////////////////////////////////////////////////
  156.         if(! cfg->getTimeOut(  i_AGE8960_TimeOut ) )
  157.         {
  158.             Application->MessageBox( "Execution Failure : Get Time Out from file fail", "FAILURE", MB_OK );
  159.             return;
  160.         }
  161.         if ((vistat = age1960_timeOut (vi,i_AGE8960_TimeOut)) != VI_SUCCESS)
  162.         {
  163.             Application->MessageBox( " Agilent 8960 set timeout fail ", "Fail", MB_OK );
  164.             return;
  165.         }
  166.         /////////////////////////////////////////////////////////////////////////////
  167.         if((! cfg->getGSM400_CableLoss( d400 )) ||
  168.            (! cfg->getGSM850_CableLoss( d850 )) ||
  169.            (! cfg->getGSM900_CableLoss( d900 )) ||
  170.            (! cfg->getDCS1800_CableLoss( d1800 )) ||
  171.            (! cfg->getPCS1900_CableLoss( d1900 ))
  172.           )
  173.         {
  174.             Application->MessageBox( " Agilent 8960 read config file (cable loss) fail ", "Fail", MB_OK );
  175.             return;
  176.         }
  177.         const AMP_OFFSET_ITEMS = 10;
  178.         ViReal64  freqArray[AMP_OFFSET_ITEMS] = { 400000000.0,
  179.                                                   641000000.0,
  180.                                                   641100000.0,
  181.                                                   876000000.0,
  182.                                                   876100000.0,
  183.                                                   1312000000.0,
  184.                                                   1312100000.0,
  185.                                                   1880000000.0,
  186.                                                   1881000000.0,
  187.                                                   2000000000.0 };
  188.         ViReal64  offsetArray[AMP_OFFSET_ITEMS] = { d400,
  189.                                                     d400,
  190.                                                     d850,
  191.                                                     d850,
  192.                                                     d900,
  193.                                                     d900,
  194.                                                    d1800,
  195.                                                    d1800,
  196.                                                    d1900,
  197.                                                    d1900
  198.                                                  };
  199.         if ((vistat = age1960_amplitudeOffset (
  200.                                                 vi,
  201.                                                 freqArray,
  202.                                                 offsetArray,
  203.                                                 AMP_OFFSET_ITEMS
  204.                                                )) != VI_SUCCESS)
  205.         {
  206.             Application->MessageBox( " Agilent 8960 set cable loss fail ", "Fail", MB_OK );
  207.             return;
  208.         }
  209.         /////////////////////////////////////////////////////////////////////////////
  210.         if( as_pAgeTaModel->AnsiCompareIC( "E1968A" ) == 0 || as_pAgeTaModel->AnsiCompareIC( "E6701C" ) == 0 || as_pAgeTaModel->AnsiCompareIC( "E6701D" ) == 0)
  211.         {
  212.             if ((vistat = age1968A_operatingMode(
  213.                                                    vi,
  214.                                                   (ViInt16) OPERATING_MODE_GSM_BCH_TCH
  215.                                                 ))!= VI_SUCCESS)
  216.             {
  217.                 Application->MessageBox( " Agilent 8960 set operation mode fail ", "Fail", MB_OK );
  218.                 return;
  219.             }
  220.         }
  221.         else  // Agilent 1960A
  222.         {
  223.             if ((vistat = age1960_operatingMode(
  224.                                                   vi,
  225.                                                  (ViInt16) age1960_TEST_MODE
  226.                                                ))!= VI_SUCCESS)
  227.             {
  228.                 Application->MessageBox( " Agilent 8960 set operation mode fail ", "Fail", MB_OK );
  229.                 return;
  230.             }
  231.         }
  232.     }
  233.     else   // CMU200
  234.     {
  235.              //******************************************************************
  236.              double d900,Out900,d400,Out400,d850,Out850,d1800,Out1800,d1900,Out1900;
  237.              AnsiString as_CMU_ADDR;
  238.              int as_CMU_TimeOut;
  239.              AnsiString CMU_GSM_INP,CMU_GSM_OUT;
  240.              AnsiString as_RF_Equipment_ADDR;
  241.             //************************************************************
  242.              if((! cfg->getCMU200_INPUT_GSM400_CableLoss( d400 )) ||
  243.                (! cfg->getCMU200_INPUT_GSM850_CableLoss( d850 )) ||
  244.                (! cfg->getCMU200_INPUT_GSM900_CableLoss( d900 )) ||
  245.                (! cfg->getCMU200_INPUT_DCS1800_CableLoss( d1800 )) ||
  246.                (! cfg->getCMU200_INPUT_PCS1900_CableLoss( d1900 ))
  247.                                                       )
  248.              {
  249.              Application->MessageBox( " CMU200 read config file (cable loss) fail ", "Fail", MB_OK );
  250.              return;
  251.              }
  252.            //*************************************************************
  253.             //************************************************************
  254.              if((! cfg->getCMU200_OUTPUT_GSM400_CableLoss( Out400 )) ||
  255.                (! cfg->getCMU200_OUTPUT_GSM850_CableLoss( Out850 )) ||
  256.                (! cfg->getCMU200_OUTPUT_GSM900_CableLoss( Out900 )) ||
  257.                (! cfg->getCMU200_OUTPUT_DCS1800_CableLoss( Out1800 )) ||
  258.                (! cfg->getCMU200_OUTPUT_PCS1900_CableLoss( Out1900 ))
  259.                                                       )
  260.              {
  261.              Application->MessageBox( " CMU200 read config file (cable loss) fail ", "Fail", MB_OK );
  262.              return;
  263.              }
  264.            //*************************************************************
  265.              cfg->getCMU200_GPIB_Addr( as_RF_Equipment_ADDR );
  266.              cfg->getCMU200_TimeOut(as_CMU_TimeOut);
  267.              cmu_crystal_tx.loss_gsm_i=d900;
  268.              cmu_crystal_tx.loss_gsm_o=Out900;
  269.              cmu_crystal_tx.loss_dcs_i=d1800;
  270.              cmu_crystal_tx.loss_dcs_o=Out1800;
  271.              cmu_crystal_tx.loss_pcs_i=d1900;
  272.              cmu_crystal_tx.loss_pcs_o=Out1900;
  273.              //****************************************************************
  274.              //cmu.ADD=as_CMU_ADDR;
  275.              cmu_crystal_tx.ADD=as_RF_Equipment_ADDR.SubString(0, as_RF_Equipment_ADDR.Pos("::INSTR")-1);
  276.              cmu_crystal_tx.TMO= StrToInt(as_CMU_TimeOut);
  277.              cmu_crystal_tx.BAND="GSM";
  278.              if( !cmu_init_TX_FreqErr(&cmu_crystal_tx) )
  279.              {
  280.                   Application->MessageBox( "Initial CMU200 fail", "Fail", MB_OK );
  281.                   return;
  282.              }
  283.              Sleep(1500);
  284.     }
  285.     int_band = frmRFTool->cbxTXFreqErrBand->ItemIndex;
  286.     switch ( int_band )
  287.     {
  288.         case 0:
  289.             vi_Band = age1960_EGSM_BAND;
  290.             cmu_crystal_tx.BAND="GSM";
  291.             vi_Band_Crystal_tx=1;
  292.         break;
  293.         case 1:
  294.             vi_Band = age1960_DCS1800_BAND;
  295.             cmu_crystal_tx.BAND="DCS";
  296.             vi_Band_Crystal_tx=3;
  297.         break;
  298.         case 2:
  299.             vi_Band = age1960_PCS1900_BAND;
  300.             cmu_crystal_tx.BAND="PCS";
  301.             vi_Band_Crystal_tx=4;
  302.         break;
  303.     } // switch
  304.     //***********************************************
  305.     if(frmRFTool->rb8960_TXErr->Checked)
  306.     {
  307.         if ( age1960_cellBand(
  308.                                vi,
  309.                                age1960_CELL_1,
  310.                                vi_Band
  311.                              ) != VI_SUCCESS )
  312.         {
  313.     age1960_error_message(vi, vistat, errmsg);
  314.             AnsiString as_error_msg;
  315.             as_error_msg = (AnsiString) errmsg;
  316.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  317.             Application->MessageBox( " Agilent 8960 set cell band fail ", "Fail", MB_OK );
  318.             return;
  319.         }
  320.     }
  321.     else
  322.     {
  323.         if( !cmu_cellband(vi_Band_Crystal_tx, &cmu_crystal_tx) )
  324.         {
  325.             Application->MessageBox( " CMU200 set cell band fail ", "Fail", MB_OK );
  326.             return ;
  327.         } // if
  328.     }
  329.      /////////////////////////////////////////////////////////////////////////////
  330.     s_pm_arfcn = frmRFTool->edtTXFreqErrARFCN->Text.ToInt();
  331.     if(frmRFTool->rb8960_TXErr->Checked)
  332.     {
  333.         vistat = age1960_BCHARFCN(
  334.                                        vi,
  335.                                        age1960_CELL_1,
  336.                                        s_pm_arfcn,
  337.                                        age1960_CURRENT_BAND,
  338.                                        VI_TRUE
  339.                                      );
  340.         if ( vistat != VI_SUCCESS  )
  341.         {
  342.             age1960_error_message(vi, vistat, errmsg);
  343.             AnsiString as_error_msg;
  344.             as_error_msg = (AnsiString) errmsg;
  345.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  346.             Application->MessageBox( " Agilent 8960 set BCCH ARFCN fail ", "Fail", MB_OK );
  347.             return;
  348.         }
  349.     }
  350.     else
  351.     {
  352.         if( !cmu_bcharfcn(s_pm_arfcn, &cmu_crystal_tx) )
  353.         {
  354.             Application->MessageBox( " CMU200 set BCCH ARFCN fail ", "Fail", MB_OK );
  355.             return;
  356.         }
  357.     }
  358.     /////////////////////////////////////////////////////////////////////////////
  359.     d_P_DL = -60;
  360.     if(frmRFTool->rb8960_TXErr->Checked)
  361.     {
  362.         if ( age1960_cellPower(
  363.                                 vi,
  364.                                  age1960_CELL_1,
  365.                                 d_P_DL,
  366.                                 0
  367.                               ) != VI_SUCCESS)
  368.         {
  369.             age1960_error_message(vi, vistat, errmsg);
  370.             AnsiString as_error_msg;
  371.             as_error_msg = (AnsiString) errmsg;
  372.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  373.             Application->MessageBox( " Agilent 8960 set cell power fail ", "Fail", MB_OK );
  374.             return;
  375.         }
  376.     }
  377.     else
  378.     {
  379.         if( !cmu_cellpower(d_P_DL, &cmu_crystal_tx) )
  380.         {
  381.             Application->MessageBox( " CMU200 set cell power fail ", "Fail", MB_OK );
  382.             return;
  383.         } // if
  384.     }
  385.     /////////////////////////////////////////////////////////////////////////////
  386.     short s_ARFCN = frmRFTool->edtTXFreqErrARFCN->Text.ToInt();
  387.     if(frmRFTool->rbAg8960_CryAfc->Checked)
  388.     {
  389.         if ( age1960_TCHARFCN(
  390.                                vi,
  391.                                s_ARFCN,
  392.                                (short) 0, // current band
  393.                                VI_TRUE
  394.                              )!= VI_SUCCESS)
  395.         {
  396.             age1960_error_message(vi, vistat, errmsg);
  397.             AnsiString as_error_msg;
  398.             as_error_msg = (AnsiString) errmsg;
  399.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  400.             Application->MessageBox( " Agilent 8960 set TCH ARFCN fail ", "Fail", MB_OK );
  401.             return;
  402.         }
  403.     }
  404.     else
  405.     {
  406.         if( !cmu_tcharfcn(s_ARFCN, &cmu_crystal_tx) )
  407.         {
  408.             Application->MessageBox( " CMU200 set TCH ARFCN fail ", "Fail", MB_OK );
  409.             return;
  410.         }
  411.     }
  412.     /////////////////////////////////////////////////////////////////////////////
  413.     c_TSC = frmRFTool->cbxTXFreqErrTSC->Text.ToInt();
  414.     if(frmRFTool->rb8960_TXErr->Checked)
  415.     {
  416.         if( age1968A_ConfigTSC(vi, c_TSC, NULL) != VI_SUCCESS )
  417.         {
  418.             Application->MessageBox( " Agilent 8960 config TSC fail ", "Fail", MB_OK );
  419.             return;
  420.         }
  421.     }
  422.     /////////////////////////////////////////////////////////////////////////////
  423.     if(frmRFTool->rb8960_TXErr->Checked)
  424.     {
  425.         if ( age1960_MSTXLevel(
  426.                                     vi,
  427.                                     frmRFTool->edtTXFreqErrPCL->Text.ToInt(),
  428.                                     (short) 0,  // current band
  429.                                     VI_TRUE
  430.                                    )!= VI_SUCCESS)
  431.         {
  432.             age1960_error_message(vi, vistat, errmsg);
  433.             AnsiString as_error_msg;
  434.             as_error_msg = (AnsiString) errmsg;
  435.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  436.             Application->MessageBox( " Agilent 8960 MS TX level fail ", "Fail", MB_OK );
  437.             return;
  438.         }
  439.     }
  440.     else
  441.     {
  442.         if( !cmu_mxtxlevel(frmRFTool->edtTXFreqErrPCL->Text.ToInt(), &cmu_crystal_tx) )
  443.         {
  444.             Application->MessageBox( " CMU200 MS TX level fail ", "Fail", MB_OK );
  445.             return;
  446.         }
  447.     }
  448.    /////////////////////////////////////////////////////////////////////////////
  449.    if(frmRFTool->rb8960_TXErr->Checked)
  450.    {
  451.         if ( age1960_initMeasFcn(
  452.                                    vi,
  453.                                    age1960_PFER  // modified by Andy Ueng
  454.                                 ) != VI_SUCCESS)
  455.         {
  456.             age1960_error_message(vi, vistat, errmsg);
  457.             AnsiString as_error_msg;
  458.             as_error_msg = (AnsiString) errmsg;
  459.             Application->MessageBox( as_error_msg.c_str() , "Error", MB_OK );
  460.             Application->MessageBox( " Agilent 8960 initialize measure function (PFER) fail ", "Fail", MB_OK );
  461.             return;
  462.         }
  463.         /////////////////////////////////////////////////////////////////////////////
  464.         MeasFcnDone = -999; /* Set to unknown state to start       */
  465.        // if ( age1960_fetchPFER_Q(
  466.        //                           vi,
  467.        //                           &PFERIntegrity,
  468.        //                           &PFERRMSError,
  469.        //                           &PFERPeakError,
  470.        //                           &PFERFreqError
  471.        //                          )!= VI_SUCCESS)
  472.         if( age_FetchAvgFreqError( vi, &PFERFreqError ) != VI_SUCCESS )
  473.         {
  474.              Application->MessageBox( " Fetch average frequency error init error", "ERROR", MB_OK );
  475.              return;
  476.         }
  477.         else
  478.         {
  479.             // ShowMessage("age1960_fetchPFER_Q() init ok");
  480.         }
  481.     }
  482.     else
  483.     {
  484.         if( !cmu_mod_read(&cmu_crystal_tx, FREQ_ERR_AVERAGE, &PFERFreqError) )
  485.         {
  486.             Application->MessageBox( "CMU200_fetchPFER_Q() read error" , "Error", MB_OK );
  487.             return;
  488.         }
  489.    }
  490.     
  491.    frmRFTool->TimerTXFreq->Enabled =true;
  492.    frmRFTool->FirstTime = true;
  493.    // end of added
  494.    _VI_PTR pvi = vi;
  495.  // marked by Andy Ueng
  496.     this->OnTerminate = ne_OnTerminate;
  497.  //  (void)vistat;
  498.  // end of marked
  499.  #endif
  500. }
  501. //------------------------------------------------------------------------
  502. bool __fastcall Crystal_Init_Age8960::CheckError(ViStatus ErrorStatus)
  503. {
  504. /*------------------------------------------------*/
  505. /* Check for driver errors.                       */
  506. /* If an error occurred reset the instrument and  */
  507. /* return true else return false.                 */
  508. /*------------------------------------------------*/
  509.     ViChar      ErrorMessage[256];
  510.     ViChar      message[100];
  511.     if (VI_SUCCESS > ErrorStatus){
  512.         /* Query the error */
  513.         age1960_error_message(vi, ErrorStatus, ErrorMessage);
  514.         /* set the mouse pointer for the form back to the default */
  515.         Screen->Cursor =  crDefault;
  516.         /* Display the error */
  517.         sprintf(message,  "Instrument Error: %ld %s",ErrorStatus, ErrorMessage);
  518.         ShowMessage (message);
  519.         /* Send a device clear - to ensure communication with the instrument */
  520.         //age1960_dcl(vi);
  521.         /* reset the instrument */
  522.         age1960_reset(vi);
  523.         return  true;
  524.     }
  525.     return false;
  526. }
  527. //---------------------------------------------------------------------------