Пример #1
0
        private void Time_Sweep_1()
        {
            bool bQuit   = false;
            bool bErrors = false;

            //开启功放
            bErrors = RF_Do(exe_params.DevInfo.RF_Addr1,
                            exe_params.RFPriority,
                            exe_params.TmeParam.P1, exe_params.TmeParam.F1,
                            true, false, true, true, ref rfStatus_1);


            //检查功放异常现象,包括功放通信超时
            bErrors = CheckRF_1(bErrors);

            if (bErrors)
            {
                NativeMessage.PostMessage(exe_params.WndHandle, MessageID.RF_ERROR, (uint)exe_params.DevInfo.RF_Addr1, 0);
                return;
            }

            //设置频谱分析的参数对象
            //RBW,ATT,Unit, Continued,由外部设置
            exe_params.SpeParam.StartFreq = exe_params.TmeParam.Rx - 0.15; //MHz
            exe_params.SpeParam.EndFreq   = exe_params.TmeParam.Rx + 0.15; //MHz

            //启动隔离度扫时进程
            for (int I = 0; I < exe_params.TmeParam.N; I++)
            {
                Monitor.Enter(ctrl);
                bQuit = ctrl.Quit;
                Monitor.Exit(ctrl);

                if (bQuit)
                {
                    break;
                }

                //采样查询,获取功放当前状态
                bErrors = RF_Do(exe_params.DevInfo.RF_Addr1,
                                exe_params.RFPriority,
                                exe_params.TmeParam.P1, exe_params.TmeParam.F1,
                                false, true, false, false, ref rfStatus_1);

                //检查功放异常现象,包括功放通信超时
                bErrors = CheckRF_1(bErrors);
                if (bErrors)
                {
                    NativeMessage.PostMessage(exe_params.WndHandle, MessageID.RF_ERROR, (uint)exe_params.DevInfo.RF_Addr1, 0);
                    break;
                }

                //启动频谱分析,并等待分析完成,
                //在接收频谱数据函数中,计算分析结果值
                //在模块窗体的消息函数中检查频谱异常
                ISpectrumObj.StartAnalysis(exe_params.SpeParam);

                //向WndHandle发送消息,告知完成一个点的分析
                NativeMessage.PostMessage(exe_params.WndHandle, MessageID.ISO_SUCCED, (uint)exe_params.DevInfo.RF_Addr1, 0);
            }
        }
Пример #2
0
        /// <summary>
        /// 功放一点频
        /// </summary>
        /// <param name="BandWidth">扫描带宽(MHz)</param>
        private void VSWR_Time_Sweep_1(float BandWidth)
        {
            bool bQuit   = false;
            bool bErrors = false;

            //开启功放
            bErrors = RF_Do(exe_params.DevInfo.RF_Addr1,
                            exe_params.RFPriority,
                            exe_params.TmeParam.P1, exe_params.TmeParam.F1,
                            true, false, true, true, ref rfStatus_1);

            //检查功放异常现象,包括功放通信超时
            bErrors = CheckRF_1(bErrors);
            if (bErrors)
            {
                NativeMessage.PostMessage(exe_params.WndHandle, MessageID.RF_ERROR, (uint)exe_params.DevInfo.RF_Addr1, 0);
                return;
            }

            //设置频谱分析的参数对象
            //RBW,ATT,Unit, Continued,由外部设置
            exe_params.SpeParam.StartFreq = exe_params.TmeParam.Rx - BandWidth; //MHz
            exe_params.SpeParam.EndFreq   = exe_params.TmeParam.Rx + BandWidth; //MHz

            //启动驻波比扫时进程
            for (int i = 0; i < exe_params.TmeParam.N; i++)
            {
                Monitor.Enter(ctrl);
                bQuit = ctrl.Quit;
                Monitor.Exit(ctrl);

                if (bQuit)
                {
                    break;
                }

                //采样查询,获取功放当前状态
                bErrors = RF_Do(exe_params.DevInfo.RF_Addr1,
                                exe_params.RFPriority,
                                exe_params.TmeParam.P1, exe_params.TmeParam.F1,
                                false, true, false, false, ref rfStatus_1);
                //检查功放异常现象,包括功放通信超时
                bErrors = CheckRF_1(bErrors);
                if (bErrors)
                {
                    NativeMessage.PostMessage(exe_params.WndHandle, MessageID.RF_ERROR, (uint)exe_params.DevInfo.RF_Addr1, 0);
                    break;
                }

                //启动频谱分析
                ISpectrumObj.StartAnalysis(exe_params.SpeParam);

                //封装扫描结果
                CurrentResultObj.Pstatus = rfStatus_1;
                CurrentResultObj.Sstatus = sweepValue;

                //向WndHandle发送消息,告知完成一个点的分析
                NativeMessage.PostMessage(exe_params.WndHandle, MessageID.VSW_SUCCED, 0, i);
            }

            ////向WndHandle发送消息,告知完成上所有的分析
            //NativeMessage.PostMessage(exe_params.WndHandle, MessageID.VSW_SWEEP_DONE, 0, 0);

            //关闭功放
            RF_Do(exe_params.DevInfo.RF_Addr1,
                  exe_params.RFPriority,
                  exe_params.TmeParam.P1, exe_params.TmeParam.F1,
                  false, false, false, false, ref rfStatus_1);
        }