示例#1
0
        private void OnCenterFreqChanged(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                double center = Convert.ToDouble(CenterFreq.Text);
                m_objRFE.UpdateDeviceConfig(center - freqSpan / 2, center + freqSpan / 2);

                currentData.Clear();
                peakHoldData.Clear();
                ScanPlot.Series[0].Points.Clear();
                ScanPlot.Series[1].Points.Clear();
                ScanPlot.Refresh();
            }
        }
示例#2
0
        private void OnSpanChanged(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (Span.Text != "" && Convert.ToDouble(Span.Text) > 0.9d)
                {
                    freqSpan = Convert.ToDouble(Span.Text);
                }
                else
                {
                    freqSpan = 1d;
                }
                currentData.Clear();
                peakHoldData.Clear();
                ScanPlot.Series[0].Points.Clear();
                ScanPlot.Series[1].Points.Clear();
                ScanPlot.Refresh();

                m_objRFE.UpdateDeviceConfig(Convert.ToDouble(CenterFreq.Text) - freqSpan / 2, Convert.ToDouble(CenterFreq.Text) + freqSpan / 2);
            }
        }
示例#3
0
        private void OnRFE_UpdateData(object sender, EventArgs e)
        {
            labelSweeps.Text = "Sweeps: " + m_objRFE.SweepData.Count.ToString();


            RFESweepData objData = m_objRFE.SweepData.GetData(m_objRFE.SweepData.Count - 1);

            if (objData != null)
            {
                UInt16 nPeak = objData.GetPeakStep();
                labelFrequency.Text = objData.GetFrequencyMHZ(nPeak).ToString("f3") + " MHZ";
                labelAmplitude.Text = objData.GetAmplitudeDBM(nPeak).ToString("f2") + " dBm";


                for (ushort i = 0; i < objData.TotalSteps; i++)
                {
                    DataPoint point = new DataPoint();
                    point.freq = objData.GetFrequencyMHZ(i);
                    point.amp  = objData.GetAmplitudeDBM(i);

                    if (currentData.Count < objData.TotalSteps)
                    {
                        currentData.Add(point);
                    }
                    else
                    {
                        currentData[i] = point;
                    }

                    if (peakHoldData.Count < objData.TotalSteps)
                    {
                        peakHoldData.Add(point);
                    }
                    else
                    {
                        if (point.amp > peakHoldData[i].amp)
                        {
                            peakHoldData[i] = point;
                        }
                    }
                }

                for (ushort i = 0; i < objData.TotalSteps; i++)
                {
                    if (ScanPlot.Series[0].Points.Count < currentData.Count)
                    {
                        ScanPlot.Series[0].Points.AddXY(currentData[i].freq, currentData[i].amp);
                    }
                    else
                    {
                        ScanPlot.Series[0].Points[i].SetValueXY(currentData[i].freq, currentData[i].amp);
                    }
                    if (ScanPlot.Series[1].Points.Count < peakHoldData.Count)
                    {
                        ScanPlot.Series[1].Points.AddXY(peakHoldData[i].freq, peakHoldData[i].amp);
                    }
                    else
                    {
                        ScanPlot.Series[1].Points[i].SetValueXY(peakHoldData[i].freq, peakHoldData[i].amp);
                    }
                }
                ScanPlot.Refresh();
            }
        }