⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instrumentcal.h

📁 USB 上位机程序 VNA使用,网络分析仪原理使用仪器
💻 H
📖 第 1 页 / 共 4 页
字号:
			this->label7->Name = S"label7";
			this->label7->Size = System::Drawing::Size(414, 48);
			this->label7->TabIndex = 17;
			this->label7->Text = S"Connect approximately one meter long 50-ohm cable, shorted at far end, to Tx conn" 
				S"ector.";
			// 
			// TxLowAmpButton
			// 
			this->TxLowAmpButton->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->TxLowAmpButton->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->TxLowAmpButton->Location = System::Drawing::Point(520, 256);
			this->TxLowAmpButton->Name = S"TxLowAmpButton";
			this->TxLowAmpButton->Size = System::Drawing::Size(176, 48);
			this->TxLowAmpButton->TabIndex = 18;
			this->TxLowAmpButton->Text = S"Trans Amplitude Detector Calibration";
			this->TxLowAmpButton->Click += new System::EventHandler(this, &InstrumentCal::TxLowAmpButton_Click);
			// 
			// label8
			// 
			this->label8->BackColor = System::Drawing::Color::Transparent;
			this->label8->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->label8->Location = System::Drawing::Point(96, 264);
			this->label8->Name = S"label8";
			this->label8->Size = System::Drawing::Size(408, 45);
			this->label8->TabIndex = 19;
			this->label8->Text = S"Connect 40 dB attenuator (50 ohm type) from Rx to Tx. (May use three-meter cable " 
				S"and setup from previous step).";
			// 
			// TxLowAmpStat
			// 
			this->TxLowAmpStat->BackColor = System::Drawing::Color::Transparent;
			this->TxLowAmpStat->Location = System::Drawing::Point(16, 256);
			this->TxLowAmpStat->Name = S"TxLowAmpStat";
			this->TxLowAmpStat->Size = System::Drawing::Size(48, 48);
			this->TxLowAmpStat->TabIndex = 20;
			this->TxLowAmpStat->Visible = false;
			// 
			// FrequencyCalButton
			// 
			this->FrequencyCalButton->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->FrequencyCalButton->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->FrequencyCalButton->Location = System::Drawing::Point(512, 384);
			this->FrequencyCalButton->Name = S"FrequencyCalButton";
			this->FrequencyCalButton->Size = System::Drawing::Size(176, 48);
			this->FrequencyCalButton->TabIndex = 21;
			this->FrequencyCalButton->Text = S"Internal Crystal Frequency Calibration";
			this->FrequencyCalButton->Click += new System::EventHandler(this, &InstrumentCal::FrequencyCalButton_Click);
			// 
			// label3
			// 
			this->label3->BackColor = System::Drawing::Color::Transparent;
			this->label3->Location = System::Drawing::Point(96, 368);
			this->label3->Name = S"label3";
			this->label3->Size = System::Drawing::Size(408, 24);
			this->label3->TabIndex = 22;
			this->label3->Text = S"1. Connect frequency counter to TX.";
			// 
			// FrequencyCalStat
			// 
			this->FrequencyCalStat->BackColor = System::Drawing::Color::Transparent;
			this->FrequencyCalStat->Location = System::Drawing::Point(16, 384);
			this->FrequencyCalStat->Name = S"FrequencyCalStat";
			this->FrequencyCalStat->Size = System::Drawing::Size(56, 49);
			this->FrequencyCalStat->TabIndex = 23;
			this->FrequencyCalStat->Visible = false;
			// 
			// MeasFreqTextBox
			// 
			this->MeasFreqTextBox->Location = System::Drawing::Point(256, 456);
			this->MeasFreqTextBox->Name = S"MeasFreqTextBox";
			this->MeasFreqTextBox->Size = System::Drawing::Size(111, 23);
			this->MeasFreqTextBox->TabIndex = 24;
			this->MeasFreqTextBox->Text = S"100000000";
			// 
			// label9
			// 
			this->label9->BackColor = System::Drawing::Color::Transparent;
			this->label9->Location = System::Drawing::Point(96, 456);
			this->label9->Name = S"label9";
			this->label9->Size = System::Drawing::Size(153, 23);
			this->label9->TabIndex = 25;
			this->label9->Text = S"Measured Frequency";
			// 
			// FreqEnterButton
			// 
			this->FreqEnterButton->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->FreqEnterButton->Location = System::Drawing::Point(376, 456);
			this->FreqEnterButton->Name = S"FreqEnterButton";
			this->FreqEnterButton->Size = System::Drawing::Size(56, 24);
			this->FreqEnterButton->TabIndex = 26;
			this->FreqEnterButton->Text = S"Enter";
			this->FreqEnterButton->Click += new System::EventHandler(this, &InstrumentCal::FreqEnterButton_Click);
			// 
			// label10
			// 
			this->label10->BackColor = System::Drawing::Color::Transparent;
			this->label10->Location = System::Drawing::Point(96, 384);
			this->label10->Name = S"label10";
			this->label10->Size = System::Drawing::Size(408, 16);
			this->label10->TabIndex = 27;
			this->label10->Text = S"2. Click \"Internal Crystal Frequency Calibration\" button.";
			// 
			// label11
			// 
			this->label11->BackColor = System::Drawing::Color::Transparent;
			this->label11->Location = System::Drawing::Point(96, 408);
			this->label11->Name = S"label11";
			this->label11->Size = System::Drawing::Size(408, 32);
			this->label11->TabIndex = 28;
			this->label11->Text = S"3. Measure and enter frequency to nearest hertz (approximately 100 MHz).";
			// 
			// label12
			// 
			this->label12->BackColor = System::Drawing::Color::Transparent;
			this->label12->Location = System::Drawing::Point(96, 440);
			this->label12->Name = S"label12";
			this->label12->Size = System::Drawing::Size(408, 16);
			this->label12->TabIndex = 29;
			this->label12->Text = S"4. Click \"Enter\" button.";
			// 
			// DirectivityCalButton
			// 
			this->DirectivityCalButton->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->DirectivityCalButton->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->DirectivityCalButton->Location = System::Drawing::Point(520, 304);
			this->DirectivityCalButton->Name = S"DirectivityCalButton";
			this->DirectivityCalButton->Size = System::Drawing::Size(176, 48);
			this->DirectivityCalButton->TabIndex = 31;
			this->DirectivityCalButton->Text = S"Coupler Directivity Calibration";
			this->DirectivityCalButton->Click += new System::EventHandler(this, &InstrumentCal::DirectivityCalButton_Click);
			// 
			// DirectivityCalStat
			// 
			this->DirectivityCalStat->BackColor = System::Drawing::Color::Transparent;
			this->DirectivityCalStat->Location = System::Drawing::Point(16, 304);
			this->DirectivityCalStat->Name = S"DirectivityCalStat";
			this->DirectivityCalStat->Size = System::Drawing::Size(48, 48);
			this->DirectivityCalStat->TabIndex = 32;
			this->DirectivityCalStat->Visible = false;
			// 
			// label14
			// 
			this->label14->BackColor = System::Drawing::Color::Transparent;
			this->label14->Location = System::Drawing::Point(96, 312);
			this->label14->Name = S"label14";
			this->label14->Size = System::Drawing::Size(408, 32);
			this->label14->TabIndex = 33;
			this->label14->Text = S"Connect 40 dB attenuator directly to the TX connector (no cable).";
			// 
			// RxAmpButtonOpen
			// 
			this->RxAmpButtonOpen->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->RxAmpButtonOpen->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->RxAmpButtonOpen->Location = System::Drawing::Point(520, 160);
			this->RxAmpButtonOpen->Name = S"RxAmpButtonOpen";
			this->RxAmpButtonOpen->Size = System::Drawing::Size(176, 48);
			this->RxAmpButtonOpen->TabIndex = 34;
			this->RxAmpButtonOpen->Text = S"Refl Amplitude Detector Cal Open";
			this->RxAmpButtonOpen->Click += new System::EventHandler(this, &InstrumentCal::RxAmpButtonOpen_Click);
			// 
			// label15
			// 
			this->label15->BackColor = System::Drawing::Color::Transparent;
			this->label15->Location = System::Drawing::Point(96, 160);
			this->label15->Name = S"label15";
			this->label15->Size = System::Drawing::Size(408, 48);
			this->label15->TabIndex = 35;
			this->label15->Text = S"Connect approximately one meter long 50-ohm cable, open at far end, to Tx connect" 
				S"or.";
			// 
			// RxAmpStatOpen
			// 
			this->RxAmpStatOpen->BackColor = System::Drawing::Color::Transparent;
			this->RxAmpStatOpen->Location = System::Drawing::Point(16, 152);
			this->RxAmpStatOpen->Name = S"RxAmpStatOpen";
			this->RxAmpStatOpen->Size = System::Drawing::Size(48, 48);
			this->RxAmpStatOpen->TabIndex = 36;
			this->RxAmpStatOpen->Visible = false;
			// 
			// RxAmpButtonShort
			// 
			this->RxAmpButtonShort->FlatStyle = System::Windows::Forms::FlatStyle::System;
			this->RxAmpButtonShort->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->RxAmpButtonShort->Location = System::Drawing::Point(520, 112);
			this->RxAmpButtonShort->Name = S"RxAmpButtonShort";
			this->RxAmpButtonShort->Size = System::Drawing::Size(176, 48);
			this->RxAmpButtonShort->TabIndex = 37;
			this->RxAmpButtonShort->Text = S"Refl Amplitude Detector Cal Short";
			this->RxAmpButtonShort->Click += new System::EventHandler(this, &InstrumentCal::RxAmpButtonShort_Click);
			// 
			// ICO1Label
			// 
			this->ICO1Label->BackColor = System::Drawing::Color::Transparent;
			this->ICO1Label->Image = (__try_cast<System::Drawing::Image*  >(resources->GetObject(S"ICO1Label.Image")));
			this->ICO1Label->Location = System::Drawing::Point(19, 448);
			this->ICO1Label->Name = S"ICO1Label";
			this->ICO1Label->Size = System::Drawing::Size(37, 25);
			this->ICO1Label->TabIndex = 38;
			this->ICO1Label->Visible = false;
			// 
			// ICO2Label
			// 
			this->ICO2Label->BackColor = System::Drawing::Color::Transparent;
			this->ICO2Label->Image = (__try_cast<System::Drawing::Image*  >(resources->GetObject(S"ICO2Label.Image")));
			this->ICO2Label->Location = System::Drawing::Point(25, 480);
			this->ICO2Label->Name = S"ICO2Label";
			this->ICO2Label->Size = System::Drawing::Size(25, 25);
			this->ICO2Label->TabIndex = 39;
			this->ICO2Label->Visible = false;
			// 
			// Optional
			// 
			this->Optional->BackColor = System::Drawing::Color::Transparent;
			this->Optional->Location = System::Drawing::Point(87, 352);
			this->Optional->Name = S"Optional";
			this->Optional->Size = System::Drawing::Size(609, 134);
			this->Optional->TabIndex = 40;
			this->Optional->TabStop = false;
			this->Optional->Text = S"Optional";
			// 
			// InstrumentCal
			// 
			this->AcceptButton = this->OKbutton;
			this->AutoScroll = true;
			this->BackgroundImage = (__try_cast<System::Drawing::Image*  >(resources->GetObject(S"$this.BackgroundImage")));
			this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
			this->CancelButton = this->Cancelbutton;
			this->ClientSize = System::Drawing::Size(736, 542);
			this->Controls->Add(this->ICO2Label);
			this->Controls->Add(this->ICO1Label);
			this->Controls->Add(this->RxAmpButtonShort);
			this->Controls->Add(this->RxAmpStatOpen);
			this->Controls->Add(this->label15);
			this->Controls->Add(this->RxAmpButtonOpen);
			this->Controls->Add(this->label14);
			this->Controls->Add(this->DirectivityCalStat);
			this->Controls->Add(this->DirectivityCalButton);
			this->Controls->Add(this->label12);
			this->Controls->Add(this->label11);
			this->Controls->Add(this->label10);
			this->Controls->Add(this->FreqEnterButton);
			this->Controls->Add(this->label9);
			this->Controls->Add(this->MeasFreqTextBox);
			this->Controls->Add(this->FrequencyCalStat);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->FrequencyCalButton);
			this->Controls->Add(this->TxLowAmpStat);
			this->Controls->Add(this->label8);
			this->Controls->Add(this->TxLowAmpButton);
			this->Controls->Add(this->label7);
			this->Controls->Add(this->label6);
			this->Controls->Add(this->progressBar1);
			this->Controls->Add(this->TxPhaseStat);
			this->Controls->Add(this->RxAmpStatShort);
			this->Controls->Add(this->RxPhaseStat);
			this->Controls->Add(this->label5);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->TxPhaseButton);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->RxPhaseButton);
			this->Controls->Add(this->Cancelbutton);
			this->Controls->Add(this->OKbutton);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->Optional);
			this->Font = (new System::Drawing::Font(S"Verdana", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				(System::Byte)0));
			this->Location = System::Drawing::Point(128, 239);
			this->Name = S"InstrumentCal";
			this->Text = S"Detector Cal";
			this->ResumeLayout(false);
			this->PerformLayout();

		}		

private: VNADevice* VNA;					///< Vector Network Analyzer hardware object
private: CalDataSet* Cal;					///< Calibration Data Set
private: FrequencyGrid* FG;					///< Our frequency grid
private: String* StartUpDir;				///< Startup directory
private: int Iphase __gc[], Qphase __gc[];	///< hold phase detector results from sweep
private: int ReflMagRegression __gc[ , ];	///< Reflection Magnitude vs level sweep
private: int ReflMagPhDir __gc[ , ];		///< Directivity Magnitude & Phase data from reflection sweep
private: int ReflMagPhOpen __gc[ , ];		///< Open Magnitude & Phase data  rom reflection sweep
private: int ReflMagPhShort __gc[ , ];		///< Shorted Magnitude & Phase data from reflection sweep
private: int ReflDetailMagPhShort __gc[ , ]; ///< Shorted Detailed Mag & Phase data from reflection sweep
private: int TranMag __gc[ , ];				///< Transmission magnitude detector vs level sweep
private: int BufferI __gc[], BufferQ __gc[];
private: int BufferN __gc[], BufferM __gc[]; ///< Temporary raw readings
private: int BufferP __gc[];
private: int MeasFrequency;					///< Measured Frequency from crystal calibration
private: bool CalStepPass __nogc[NUMCALSTEPS];		///< Array of Calibrations Steps. TRUE = step passed

		 /// Reflection Phase Detector Calibration button click handler
private: System::Void RxPhaseButton_Click(System::Object *  sender, System::EventArgs *  e)
		 {

			 // Reflection Phase Detector Calibration

			VNA_RXBUFFER *RxBuf = new VNA_RXBUFFER;
			VNA_TXBUFFER *TxBuf = new VNA_TXBUFFER;
			int Fdesired;

			progressBar1->Value = 0;
	

			// run a sweep of 1024 points, calibrating Rx phase detector
			for (long i=0; i<1024; i++)
			{
				// Compute spot frequency

				Fdesired = Convert::ToInt32(200000.0+( i*(120000000.0-200000.0)/1024.0));

				TxBuf->TxAccum = FG->DDS(Fdesired);
				TxBuf->IDAClevelHi = MAX_DDS_LEVEL;		// Max transmit level
				TxBuf->ReplyType = 0;
				TxBuf->MeasureDelay = 0;
				TxBuf->QDAClevel = QDAC_ZERODBM;	// Reference level

				// Take 7 readings at the same frequency

				for(int k=0; k<7; k++)
				{
                    VNA->WriteRead(TxBuf, RxBuf);
					BufferI[k] = RxBuf->ReflPI;
					BufferQ[k] = RxBuf->ReflPQ;
				}

				Iphase[i] = Median7i(BufferI);	// use median filter to smooth raw value
				Qphase[i] = Median7i(BufferQ);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -