Procházet zdrojové kódy

2022-01-12;优化蚯蚓电源连接

pc před 3 roky
rodič
revize
094358b725
27 změnil soubory, kde provedl 285 přidání a 100 odebrání
  1. 1 0
      exe/apps/DevicesApp/commands/程控命令.xml
  2. 18 0
      exe/apps/DevicesApp/本地仪器 - 副本.xml
  3. 2 1
      exe/apps/DevicesApp/本地仪器.xml
  4. binární
      exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.dll
  5. binární
      exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.pdb
  6. binární
      exe/apps/Tps_LQ_Transmitter/config/串口控制.xlsx
  7. binární
      exe/apps/Tps_LQ_Transmitter/config/测试#常温测试#9B发射机-FSQ-8.xlsx
  8. binární
      tps/TpsLabStudio/.vs/TpsLabStudio/v16/.suo
  9. 45 27
      tps/TpsLabStudio/DebuggingForm.Designer.cs
  10. 73 37
      tps/TpsLabStudio/DebuggingForm.cs
  11. 14 3
      tps/TpsLabStudio/FrmMain.cs
  12. 21 20
      tps/TpsLabStudio/MainTps.cs
  13. 15 4
      tps/TpsLabStudio/TpsLabStudio.csproj
  14. 1 1
      tps/TpsLabStudio/TpsLabStudio.csproj.user
  15. 1 1
      tps/TpsLabStudio/com/MySerial.cs
  16. 16 0
      tps/TpsLabStudio/com/PcGpio.cs
  17. 56 0
      tps/TpsLabStudio/com/RainwormPower.cs
  18. binární
      tps/TpsLabStudio/config/串口控制.xlsx
  19. binární
      tps/TpsLabStudio/config/测试#常温测试#9B发射机-FSQ-8.xlsx
  20. 19 4
      tps/TpsLabStudio/models/PowerAndFreqStability.cs
  21. binární
      tps/TpsLabStudio/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  22. binární
      tps/TpsLabStudio/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  23. 1 1
      tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.CoreCompileInputs.cache
  24. 2 1
      tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.FileListAbsolute.txt
  25. binární
      tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.GenerateResource.cache
  26. binární
      tps/TpsLabStudio/obj/Debug/Tps_LQ_Transmitter.dll
  27. binární
      tps/TpsLabStudio/obj/Debug/Tps_LQ_Transmitter.pdb

+ 1 - 0
exe/apps/DevicesApp/commands/程控命令.xml

@@ -289,6 +289,7 @@
       <Models>
 		<string>FSQ</string>
         <string>FSU-26</string>
+        <string>FSQ-8</string>
       </Models>
       <Commands>
 	    <Command Key="仪器复位" Value="*RST" Description="复位"/>

+ 18 - 0
exe/apps/DevicesApp/本地仪器 - 副本.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<LocalDevices>
+  <DeviceInfos>
+    <!--应让虚拟仪器的地址与真实仪器的地址不一样,考虑到真实地址不超过32,因此可以设置为32以上-->
+    <!--IsVirtual="false" 如果为false,则是手动配置的真实仪器,手动配置的仪器会优先初始化-->
+    <!--<DeviceInfo DeviceType="程控电源" DeviceModel="IT6722" DeviceHandle="GPIB0::33::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/>
+    <DeviceInfo DeviceType="电子负载" DeviceModel="IT8811" DeviceHandle="GPIB0::34::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/>-->
+    <!--DeviceHandle="0" 0是卡地址,默认-->
+    <!--<DeviceInfo DeviceType="示波器" DeviceModel="PXIe69848" DeviceHandle="0" ClassType="DevicesApp.Devices.Oscilloscope" IsVirtual="false"/>-->
+    <!--DeviceHandle="0" 0是卡地址,PXI19::11::INSTR-->
+    <!--<DeviceInfo DeviceType="视频开关" DeviceModel="Pickering40161D" DeviceHandle="bus:19,slot:12" ClassType="DevicesApp.Devices.VideoSwitch" IsVirtual="false"/>-->
+    <!--<DeviceInfo DeviceType="万用表" DeviceModel="KeysightM9182A" DeviceHandle="PXI19::10::INSTR" ClassType="DevicesApp.Devices.Multimeter" IsVirtual="false"/>-->
+    <DeviceInfo DeviceType="信号源" DeviceModel="E4221B" DeviceHandle="GPIB0::34::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/>
+    <!--<DeviceInfo DeviceType="频谱仪" DeviceModel="FSU-26" DeviceHandle="TCPIP0::169.254.17.73::inst0::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> -->
+    <DeviceInfo DeviceType="频谱仪" DeviceModel="N9030A" DeviceHandle="USB0::0x0957::0x0D0B::US49230327::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> 
+	    <!--<DeviceInfo DeviceType="功率计" DeviceModel="E4418A" DeviceHandle="GPIB0::13::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/>-->
+  </DeviceInfos>
+</LocalDevices>

+ 2 - 1
exe/apps/DevicesApp/本地仪器.xml

@@ -12,7 +12,8 @@
     <!--<DeviceInfo DeviceType="万用表" DeviceModel="KeysightM9182A" DeviceHandle="PXI19::10::INSTR" ClassType="DevicesApp.Devices.Multimeter" IsVirtual="false"/>-->
     <DeviceInfo DeviceType="信号源" DeviceModel="E4221B" DeviceHandle="GPIB0::34::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/>
     <!--<DeviceInfo DeviceType="频谱仪" DeviceModel="FSU-26" DeviceHandle="TCPIP0::169.254.17.73::inst0::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> -->
-    <DeviceInfo DeviceType="频谱仪" DeviceModel="N9030A" DeviceHandle="USB0::0x0957::0x0D0B::US49230327::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> 
+    <!--<DeviceInfo DeviceType="频谱仪" DeviceModel="N9030A" DeviceHandle="USB0::0x0957::0x0D0B::US49230327::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> -->
+    <DeviceInfo DeviceType="频谱仪" DeviceModel="FSQ-8" DeviceHandle="TCPIP0::FSQX-000000::inst0::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> 
 	    <!--<DeviceInfo DeviceType="功率计" DeviceModel="E4418A" DeviceHandle="GPIB0::13::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/>-->
   </DeviceInfos>
 </LocalDevices>

binární
exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.dll


binární
exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.pdb


binární
exe/apps/Tps_LQ_Transmitter/config/串口控制.xlsx


binární
exe/apps/Tps_LQ_Transmitter/config/测试#常温测试#9B发射机-FSQ-8.xlsx


binární
tps/TpsLabStudio/.vs/TpsLabStudio/v16/.suo


+ 45 - 27
tps/TpsLabStudio/DebuggingForm.Designer.cs

@@ -100,7 +100,6 @@ namespace Tps_LQ_Transmitter
             this.labelX12 = new DevComponents.DotNetBar.LabelX();
             this.chkCzCh = new DevComponents.DotNetBar.Controls.CheckBoxX();
             this.ChkPowerOnOff = new DevComponents.DotNetBar.Controls.CheckBoxX();
-            this.labelX13 = new DevComponents.DotNetBar.LabelX();
             this.btnPowCh_3 = new DevComponents.DotNetBar.ButtonX();
             this.labelX14 = new DevComponents.DotNetBar.LabelX();
             this.labelX15 = new DevComponents.DotNetBar.LabelX();
@@ -146,6 +145,8 @@ namespace Tps_LQ_Transmitter
             this.txtbTimer2Num = new DevComponents.DotNetBar.Controls.TextBoxX();
             this.timer2 = new System.Windows.Forms.Timer(this.components);
             this.labelX36 = new DevComponents.DotNetBar.LabelX();
+            this.labelX37 = new DevComponents.DotNetBar.LabelX();
+            this.chkAllSwitchDo = new DevComponents.DotNetBar.Controls.CheckBoxX();
             this.gpbHdlcTr.SuspendLayout();
             this.gpbUartCheck.SuspendLayout();
             this.gpbSendMode.SuspendLayout();
@@ -1037,7 +1038,7 @@ namespace Tps_LQ_Transmitter
             this.chkAyCh_7.Size = new System.Drawing.Size(75, 23);
             this.chkAyCh_7.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
             this.chkAyCh_7.TabIndex = 1;
-            this.chkAyCh_7.Text = "通道7";
+            this.chkAyCh_7.Text = "陷/衰";
             this.chkAyCh_7.CheckedChanged += new System.EventHandler(this.chkAyCh_7_CheckedChanged);
             // 
             // chkAyCh_8
@@ -1052,7 +1053,7 @@ namespace Tps_LQ_Transmitter
             this.chkAyCh_8.Size = new System.Drawing.Size(75, 23);
             this.chkAyCh_8.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
             this.chkAyCh_8.TabIndex = 1;
-            this.chkAyCh_8.Text = "通道8";
+            this.chkAyCh_8.Text = "陷/衰";
             this.chkAyCh_8.CheckedChanged += new System.EventHandler(this.chkAyCh_8_CheckedChanged);
             // 
             // chkBxCh_1
@@ -1171,19 +1172,6 @@ namespace Tps_LQ_Transmitter
             this.ChkPowerOnOff.Text = "ON/OFF";
             this.ChkPowerOnOff.CheckedChanged += new System.EventHandler(this.ChkPowerOnOff_CheckedChanged);
             // 
-            // labelX13
-            // 
-            // 
-            // 
-            // 
-            this.labelX13.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
-            this.labelX13.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.labelX13.Location = new System.Drawing.Point(1744, 200);
-            this.labelX13.Name = "labelX13";
-            this.labelX13.Size = new System.Drawing.Size(85, 23);
-            this.labelX13.TabIndex = 3;
-            this.labelX13.Text = "[ON;陷波器]";
-            // 
             // btnPowCh_3
             // 
             this.btnPowCh_3.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
@@ -1449,7 +1437,7 @@ namespace Tps_LQ_Transmitter
             this.btnPcmSetting.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
             this.btnPcmSetting.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
             this.btnPcmSetting.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.btnPcmSetting.Location = new System.Drawing.Point(166, 689);
+            this.btnPcmSetting.Location = new System.Drawing.Point(166, 664);
             this.btnPcmSetting.Name = "btnPcmSetting";
             this.btnPcmSetting.Size = new System.Drawing.Size(98, 31);
             this.btnPcmSetting.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@@ -1508,7 +1496,7 @@ namespace Tps_LQ_Transmitter
             this.txtbBaudrate.Border.Class = "TextBoxBorder";
             this.txtbBaudrate.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
             this.txtbBaudrate.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtbBaudrate.Location = new System.Drawing.Point(257, 547);
+            this.txtbBaudrate.Location = new System.Drawing.Point(257, 542);
             this.txtbBaudrate.Name = "txtbBaudrate";
             this.txtbBaudrate.PreventEnterBeep = true;
             this.txtbBaudrate.Size = new System.Drawing.Size(112, 31);
@@ -1523,7 +1511,7 @@ namespace Tps_LQ_Transmitter
             // 
             this.labelX33.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
             this.labelX33.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.labelX33.Location = new System.Drawing.Point(157, 555);
+            this.labelX33.Location = new System.Drawing.Point(157, 550);
             this.labelX33.Name = "labelX33";
             this.labelX33.Size = new System.Drawing.Size(75, 23);
             this.labelX33.TabIndex = 3;
@@ -1556,7 +1544,7 @@ namespace Tps_LQ_Transmitter
             // 
             this.gpbHdlcTr.Controls.Add(this.rbtnFall);
             this.gpbHdlcTr.Controls.Add(this.rbtnRise);
-            this.gpbHdlcTr.Location = new System.Drawing.Point(166, 580);
+            this.gpbHdlcTr.Location = new System.Drawing.Point(166, 573);
             this.gpbHdlcTr.Name = "gpbHdlcTr";
             this.gpbHdlcTr.Size = new System.Drawing.Size(203, 41);
             this.gpbHdlcTr.TabIndex = 13;
@@ -1567,7 +1555,7 @@ namespace Tps_LQ_Transmitter
             this.gpbUartCheck.Controls.Add(this.rbtnNone);
             this.gpbUartCheck.Controls.Add(this.rbtnEven);
             this.gpbUartCheck.Controls.Add(this.rbtnOdd);
-            this.gpbUartCheck.Location = new System.Drawing.Point(166, 627);
+            this.gpbUartCheck.Location = new System.Drawing.Point(166, 616);
             this.gpbUartCheck.Name = "gpbUartCheck";
             this.gpbUartCheck.Size = new System.Drawing.Size(203, 41);
             this.gpbUartCheck.TabIndex = 13;
@@ -1653,7 +1641,7 @@ namespace Tps_LQ_Transmitter
             this.txtbPcmRd.Border.Class = "TextBoxBorder";
             this.txtbPcmRd.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
             this.txtbPcmRd.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.txtbPcmRd.Location = new System.Drawing.Point(462, 590);
+            this.txtbPcmRd.Location = new System.Drawing.Point(462, 575);
             this.txtbPcmRd.Multiline = true;
             this.txtbPcmRd.Name = "txtbPcmRd";
             this.txtbPcmRd.PreventEnterBeep = true;
@@ -1665,7 +1653,7 @@ namespace Tps_LQ_Transmitter
             this.btnCleartxtbPcmRd.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
             this.btnCleartxtbPcmRd.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
             this.btnCleartxtbPcmRd.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.btnCleartxtbPcmRd.Location = new System.Drawing.Point(886, 590);
+            this.btnCleartxtbPcmRd.Location = new System.Drawing.Point(886, 575);
             this.btnCleartxtbPcmRd.Name = "btnCleartxtbPcmRd";
             this.btnCleartxtbPcmRd.Size = new System.Drawing.Size(98, 31);
             this.btnCleartxtbPcmRd.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@@ -1694,7 +1682,7 @@ namespace Tps_LQ_Transmitter
             // 
             this.labelX35.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
             this.labelX35.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.labelX35.Location = new System.Drawing.Point(397, 595);
+            this.labelX35.Location = new System.Drawing.Point(397, 580);
             this.labelX35.Name = "labelX35";
             this.labelX35.Size = new System.Drawing.Size(59, 23);
             this.labelX35.TabIndex = 3;
@@ -1750,11 +1738,39 @@ namespace Tps_LQ_Transmitter
             this.labelX36.TabIndex = 3;
             this.labelX36.Text = "mS";
             // 
+            // labelX37
+            // 
+            // 
+            // 
+            // 
+            this.labelX37.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.labelX37.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.labelX37.Location = new System.Drawing.Point(5, 509);
+            this.labelX37.Name = "labelX37";
+            this.labelX37.Size = new System.Drawing.Size(154, 23);
+            this.labelX37.TabIndex = 3;
+            this.labelX37.Text = "PCM 控制:";
+            // 
+            // chkAllSwitchDo
+            // 
+            // 
+            // 
+            // 
+            this.chkAllSwitchDo.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.chkAllSwitchDo.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.chkAllSwitchDo.Location = new System.Drawing.Point(1744, 200);
+            this.chkAllSwitchDo.Name = "chkAllSwitchDo";
+            this.chkAllSwitchDo.Size = new System.Drawing.Size(114, 23);
+            this.chkAllSwitchDo.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+            this.chkAllSwitchDo.TabIndex = 1;
+            this.chkAllSwitchDo.Text = "8路全切换";
+            this.chkAllSwitchDo.CheckedChanged += new System.EventHandler(this.chkAllSwitchDo_CheckedChanged);
+            // 
             // DebuggingForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1370, 749);
+            this.ClientSize = new System.Drawing.Size(1904, 1041);
             this.Controls.Add(this.gpbUartCheck);
             this.Controls.Add(this.gpbSendMode);
             this.Controls.Add(this.gpbHdlcTr);
@@ -1800,7 +1816,7 @@ namespace Tps_LQ_Transmitter
             this.Controls.Add(this.labelX14);
             this.Controls.Add(this.labelX33);
             this.Controls.Add(this.labelX8);
-            this.Controls.Add(this.labelX13);
+            this.Controls.Add(this.labelX37);
             this.Controls.Add(this.labelX7);
             this.Controls.Add(this.labelX2);
             this.Controls.Add(this.labelX5);
@@ -1829,6 +1845,7 @@ namespace Tps_LQ_Transmitter
             this.Controls.Add(this.txtbVoltSetValue);
             this.Controls.Add(this.txtbCurrCh_1);
             this.Controls.Add(this.txtbVoltCh_1);
+            this.Controls.Add(this.chkAllSwitchDo);
             this.Controls.Add(this.chkAyCh_8);
             this.Controls.Add(this.chkStCh_8);
             this.Controls.Add(this.chkAyCh_7);
@@ -1947,7 +1964,6 @@ namespace Tps_LQ_Transmitter
         private DevComponents.DotNetBar.LabelX labelX12;
         private DevComponents.DotNetBar.Controls.CheckBoxX chkCzCh;
         private DevComponents.DotNetBar.Controls.CheckBoxX ChkPowerOnOff;
-        private DevComponents.DotNetBar.LabelX labelX13;
         private DevComponents.DotNetBar.ButtonX btnPowCh_3;
         private DevComponents.DotNetBar.LabelX labelX14;
         private DevComponents.DotNetBar.LabelX labelX15;
@@ -1993,5 +2009,7 @@ namespace Tps_LQ_Transmitter
         private DevComponents.DotNetBar.Controls.TextBoxX txtbTimer2Num;
         private System.Windows.Forms.Timer timer2;
         private DevComponents.DotNetBar.LabelX labelX36;
+        private DevComponents.DotNetBar.LabelX labelX37;
+        private DevComponents.DotNetBar.Controls.CheckBoxX chkAllSwitchDo;
     }
 }

+ 73 - 37
tps/TpsLabStudio/DebuggingForm.cs

@@ -37,15 +37,14 @@ namespace Tps_LQ_Transmitter
             }
             power.powerOnoff(RainwormPower.State.OFF);
             SeriesPortThread();
+            rbtnUartMode.Checked = true;
+            if (!power.UnlockKey())
+            {
+                txtbMsg.Text = "内部蚯蚓电源未连接成功!";
+            }
         }
 
-        public void SeriesPortThread()
-        {
 
-            SeriesPortChildref = new ThreadStart(Displaywhile);
-            SeriesPortChildThread = new Thread(SeriesPortChildref);
-            SeriesPortChildThread.Start();
-        }
         private void DebuggingForm_FormClosed(object sender, FormClosedEventArgs e)
         {
             dio.portClose();
@@ -54,33 +53,7 @@ namespace Tps_LQ_Transmitter
             SeriesPortChildThread.Abort();
 
         }
-        string tamp="";
-        public void Displaywhile()
-        {
-            string st;
-            
-            while (true)
-            {
-                byte[] byrd = pcm.OnlyRead();
-
-                //if (byrd != null && byrd[0] == 0xF0 && byrd[1] == 0x0F && byrd[2] == 0x03)
-                {
-                    //byte[] br = new byte[byrd.Length-6];
-                    //for (int i = 0; i < br.Length; i++)
-                    //{
-                    //    br[i] = byrd[6 + i];
-                    //}
-                    st = BytesToHexString(byrd);
-                    if (st != "" && st != tamp)
-                    {
-
-                        tamp = st;
-                    }
-                }
-                
-                Thread.Sleep(100);          
-            }
-        }
+  
 
         #region 8路供电开关控制(+28V)代码
         private void btnPowCh_1_Click(object sender, EventArgs e)
@@ -415,6 +388,34 @@ namespace Tps_LQ_Transmitter
                 gpio.SwitchControl(0);
             }
         }
+        private void chkAllSwitchDo_CheckedChanged(object sender, EventArgs e)
+        {
+            if (chkAllSwitchDo.Checked == true)
+            {
+                gpio.AllSwitchBandstopft();
+                chkAyCh_1.Enabled = false;
+                chkAyCh_2.Enabled = false;
+                chkAyCh_3.Enabled = false;
+                chkAyCh_4.Enabled = false;
+                chkAyCh_5.Enabled = false;
+                chkAyCh_6.Enabled = false;
+                chkAyCh_7.Enabled = false;
+                chkAyCh_8.Enabled = false;
+            }
+            else
+            {
+                gpio.AllSwitchAttenuator();
+                chkAyCh_1.Enabled = true;
+                chkAyCh_2.Enabled = true;
+                chkAyCh_3.Enabled = true;
+                chkAyCh_4.Enabled = true;
+                chkAyCh_5.Enabled = true;
+                chkAyCh_6.Enabled = true;
+                chkAyCh_7.Enabled = true;
+                chkAyCh_8.Enabled = true;
+            }
+        }
+
         #endregion
 
 
@@ -659,7 +660,7 @@ namespace Tps_LQ_Transmitter
         #endregion
 
 
-        #region 内部电控制代码
+        #region 内部电控制代码
         private void ChkPowerOnOff_CheckedChanged(object sender, EventArgs e)
         {
             if (ChkPowerOnOff.Checked == true)
@@ -679,10 +680,42 @@ namespace Tps_LQ_Transmitter
 
         #endregion
 
-       
+        #region PCM控制代码
+        string tamp = "";
+        public void Displaywhile()
+        {
+            string st;
+
+            while (true)
+            {
+                byte[] byrd = pcm.OnlyRead();
 
-       
+                //if (byrd != null && byrd[0] == 0xF0 && byrd[1] == 0x0F && byrd[2] == 0x03)
+                {
+                    //byte[] br = new byte[byrd.Length-6];
+                    //for (int i = 0; i < br.Length; i++)
+                    //{
+                    //    br[i] = byrd[6 + i];
+                    //}
+                    st = BytesToHexString(byrd);
+                    if (st != "" && st != tamp)
+                    {
 
+                        tamp = st;
+                    }
+                }
+
+                Thread.Sleep(100);
+            }
+        }
+
+        public void SeriesPortThread()
+        {
+
+            SeriesPortChildref = new ThreadStart(Displaywhile);
+            SeriesPortChildThread = new Thread(SeriesPortChildref);
+            SeriesPortChildThread.Start();
+        }
         private void btnPcmSendx_Click(object sender, EventArgs e)
         {
             string str = txtbPcmSend.Text;
@@ -694,7 +727,7 @@ namespace Tps_LQ_Transmitter
                 {
                     bytx[i] = Convert.ToByte(sArray[i], 16);
                 }
-                txtbMsg.Text = pcm.DataSend(bytx).ToString();
+                txtbMsg.Text = pcm.DataSend(bytx,0).ToString();
             }
         }
         private void btnCleartxtbPcmRd_Click(object sender, EventArgs e)
@@ -815,5 +848,8 @@ namespace Tps_LQ_Transmitter
         {
             timer2.Interval = int.Parse(txtbTimer2Num.Text);
         }
+        #endregion
+
+
     }
 }

+ 14 - 3
tps/TpsLabStudio/FrmMain.cs

@@ -310,6 +310,7 @@ namespace Tps_LQ_Transmitter
         }
         void StartTest()
         {
+           
             Stopwatch TimesCounter = new Stopwatch();
             double testMin = 0;
             TimesCounter.Restart();
@@ -382,8 +383,18 @@ namespace Tps_LQ_Transmitter
                 rainwormPower = new RainwormPower();
                 rainwormPower.powerSetting(volt, Current);//设置输出电压和限制电流
                 rainwormPower.powerOnoff(RainwormPower.State.ON);//设置蚯蚓电源输出
-                rainwormPower.portClose();
-                ShowMessage(MsgType.Info, string.Format("打开内部蚯蚓电源."));
+                Thread.Sleep(100);
+                if (rainwormPower.UnlockKey())
+                {
+                    ShowMessage(MsgType.Info, string.Format("打开内部蚯蚓电源."));
+                }
+                else
+                {
+                    MessageBox.Show("打开内部蚯蚓电源失败,请检查电源是否上电!");
+                    ShowMessage(MsgType.Error, string.Format("连接内部蚯蚓电源失败!"));
+                }
+                
+                
             }
            
 
@@ -769,7 +780,7 @@ namespace Tps_LQ_Transmitter
                     bool flag = false;
 
                     for (int i = 0; i < tbSerials.Items.Count; i++)
-
+                          
                     {
 
                         if (string.Compare(newItem, tbSerials.Items[i].ToString()) == 0)

+ 21 - 20
tps/TpsLabStudio/MainTps.cs

@@ -72,7 +72,7 @@ namespace Tps_LQ_Transmitter
 
         public Dictionary<string,double> GloabConfigDict;
         public string DCPowerAddress;//程控电源地址
-        public string N9030A_SA_Address;//N9030A频谱仪地址
+       // public string N9030A_SA_Address;//N9030A频谱仪地址
         public int TestFreqSum;//频点数
         public TransmitterSerialPort SerialClient = new TransmitterSerialPort();
         public byte ThridByte;//频点控制第3个字节
@@ -636,6 +636,7 @@ namespace Tps_LQ_Transmitter
             foreach (DeviceNode device in this.Devices)
             {
                 DeviceParameter dev = devHost.GetFirstOrDefaultDeviceID(device.DeviceHandle);
+               
 
                 if (dev == null || !(device.DeviceType == dev.DeviceType && device.DeviceModel == dev.DeviceModel))
                 {
@@ -687,7 +688,7 @@ namespace Tps_LQ_Transmitter
             //清空测试数据
             // BaseModel.TestResults.Clear();
 
-            FrmMain FrmPara = new FrmMain();
+           // FrmMain FrmPara = new FrmMain();
 
 
             byte FourthByte = 0x00;
@@ -747,12 +748,12 @@ namespace Tps_LQ_Transmitter
                             this.TestNodes[i].PointTotal = FrequencyNumber;
                         }
 
-                        if (FrmPara.IsRuning == false)//中途点击停止测试按钮
-                        {
-                            //控制断电
-                            StopClose(ProductSeries,  DCPower,  rainwormPower,  SerialClient);
-                            return;
-                        }
+                        //if (FrmPara.IsRuning == false)//中途点击停止测试按钮
+                        //{
+                        //    //控制断电
+                        //    StopClose(ProductSeries,  DCPower,  rainwormPower,  SerialClient);
+                        //    return;
+                        //}
                         //控制
 
                         if (Product.Contains("YZH16A"))//针对YZH16A的产品
@@ -781,12 +782,12 @@ namespace Tps_LQ_Transmitter
 
                         foreach (TestNode testnode in group.OrderBy(a => a.Order))
                         {
-                            if (FrmPara.IsRuning == false)//中途点击停止测试按钮
-                            {
-                                //控制断电
-                                StopClose(ProductSeries, DCPower, rainwormPower, SerialClient);
-                                return;
-                            }
+                            //if (FrmPara.IsRuning == false)//中途点击停止测试按钮
+                            //{
+                            //    //控制断电
+                            //    StopClose(ProductSeries, DCPower, rainwormPower, SerialClient);
+                            //    return;
+                            //}
                             if (isStop == false)
                             {
                                 if (nodes.Count == 1 && testnode.Name.Contains("杂波抑制"))
@@ -820,12 +821,12 @@ namespace Tps_LQ_Transmitter
                                         currModel = testnode.TestModel;
                                         for (int i =0;i< ProductSeries.Length;i++)
                                         {
-                                            if (FrmPara.IsRuning == false)//中途点击停止测试按钮
-                                            {
-                                                //控制断电
-                                                StopClose(ProductSeries, DCPower, rainwormPower, SerialClient);
-                                                return;
-                                            }
+                                            //if (FrmPara.IsRuning == false)//中途点击停止测试按钮
+                                            //{
+                                            //    //控制断电
+                                            //    StopClose(ProductSeries, DCPower, rainwormPower, SerialClient);
+                                            //    return;
+                                            //}
                                             this.Serial =  ProductSeries[i];
                                             SystemChofSerial = (Array.IndexOf(ProductSeries, ProductSeries[i]) +  1).ToString();
                                             UpDateCurrentSeries(this.Serial);

+ 15 - 4
tps/TpsLabStudio/TpsLabStudio.csproj

@@ -100,13 +100,21 @@
     <Compile Include="Common\VisaResource.cs" />
     <Compile Include="com\BaseModelStruct.cs" />
     <Compile Include="com\DeviceNode.cs" />
-    <Compile Include="com\DioControlClass.cs" />
+    <Compile Include="com\DioControlClass.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="com\FileNode.cs" />
     <Compile Include="com\MsgType.cs" />
-    <Compile Include="com\MySerial.cs" />
+    <Compile Include="com\MySerial.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="com\PcGpio.cs" />
-    <Compile Include="com\PcmControl.cs" />
-    <Compile Include="com\RainwormPower.cs" />
+    <Compile Include="com\PcmControl.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="com\RainwormPower.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="com\SerialPort.cs" />
     <Compile Include="com\TestMessage.cs" />
     <Compile Include="com\TestNode.cs" />
@@ -179,6 +187,9 @@
     <None Include="config\串口控制.xlsx">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="config\测试#常温测试#9B发射机-FSQ-8.xlsx">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="config\测试#常温测试#9B发射机-N9030A.xlsx">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>

+ 1 - 1
tps/TpsLabStudio/TpsLabStudio.csproj.user

@@ -5,6 +5,6 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
     <StartAction>Program</StartAction>
-    <StartProgram>E:\LqTest\TpsLabStudio_LTS\exe\JGWorks.exe</StartProgram>
+    <StartProgram>D:\lqCode\TpsLabStudio_LTS\exe\JGWorks.exe</StartProgram>
   </PropertyGroup>
 </Project>

+ 1 - 1
tps/TpsLabStudio/com/MySerial.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 
 namespace Tps_LQ_Transmitter.com
 {
-    public class MySerial:SerialPort
+    public class MySerial
     {
         SerialPort serial;
         public bool IsOpen

+ 16 - 0
tps/TpsLabStudio/com/PcGpio.cs

@@ -157,5 +157,21 @@ namespace Tps_LQ_Transmitter.com
             }
             WriteOut(dat);
         }
+        /// <summary>
+        /// 8路全切换至衰减器通道(一分二射频开关全OFF)
+        /// </summary>
+        public void AllSwitchAttenuator()
+        {
+            ushort[] dat = { 0x00,0x00 };
+            WriteOut(dat);
+        }
+        /// <summary>
+        /// 8路全切换至陷波器通道(一分二射频开关全ON)
+        /// </summary>
+        public void AllSwitchBandstopft()
+        {
+            ushort[] dat = { 0xFF, 0xFF };
+            WriteOut(dat);
+        }
     }
 }

+ 56 - 0
tps/TpsLabStudio/com/RainwormPower.cs

@@ -108,5 +108,61 @@ namespace Tps_LQ_Transmitter.com
             powerWriteRead(byCurr);
             powerWriteRead(byVolt);
         }
+        /// <summary>
+        /// 蚯蚓电源按钮锁定(仅锁定旋钮不可用)
+        /// </summary>
+        /// <returns>成功返回true/失败返回false</returns>
+        public bool LockKey()
+        {
+            bool rdbl = false;
+            byte[] bylock = { 0x00, 0x10, 0x00, 0x06, 0x00, 0x01, 0x02, 0x00, 0x01 };
+            byte[] bylkrdx = { 0x00, 0x10, 0x00, 0x06, 0x00, 0x01, 0xE0, 0x19 };
+            byte[] bylkrd =powerWriteRead(bylock);
+            if (bylkrd!=null)
+            {
+                if (bylkrd.Length >= 5)
+                {
+                    rdbl = true;
+                    for (int i = 0; i < bylkrd.Length; i++)
+                    {
+                        if (bylkrdx[i] != bylkrd[i])
+                            rdbl = false;
+                    }
+                }
+                else
+                {
+                    rdbl = false;
+                }
+            }
+            return rdbl;
+        }
+        /// <summary>
+        /// 蚯蚓电源按钮解锁(旋钮可用)
+        /// </summary>
+        /// <returns>成功返回true/失败返回false</returns>
+        public bool UnlockKey()
+        {
+            bool rdbl = false;
+            byte[] bylock = { 0x00, 0x10, 0x00, 0x06, 0x00, 0x01, 0x02, 0x00, 0x00 };
+            byte[] bylkrdx = { 0x00, 0x10, 0x00, 0x06, 0x00, 0x01, 0xE0, 0x19 };
+            byte[] bylkrd = powerWriteRead(bylock);
+            if (bylkrd != null)
+            {
+                if (bylkrd.Length >= 5)
+                {
+                    rdbl = true;
+                    for (int i = 0; i < bylkrd.Length; i++)
+                    {
+                        if (bylkrdx[i] != bylkrd[i])
+                            rdbl = false;
+                    }
+                }
+                else
+                {
+                    rdbl = false;
+                }
+            }
+            return rdbl;
+        }
     }
 }

binární
tps/TpsLabStudio/config/串口控制.xlsx


binární
tps/TpsLabStudio/config/测试#常温测试#9B发射机-FSQ-8.xlsx


+ 19 - 4
tps/TpsLabStudio/models/PowerAndFreqStability.cs

@@ -156,18 +156,33 @@ namespace Tps_LQ_Transmitter.models
                     Thread.Sleep(500);
                     SA.Write("MARK打开", "1"); SA.Query("OPC");
                     Thread.Sleep(500);
-                    SA.Write("打开MARK精度", "1"); SA.Query("OPC");
-                    Thread.Sleep(200);
+                    if (SA.Query("IDN").Contains("N9030"))
+                    {
+                        SA.Write("打开MARK精度", "1"); SA.Query("OPC");
+                        Thread.Sleep(200);
+                    }
                     SA.Write("PEAK", "1"); SA.Query("OPC");
                     Thread.Sleep(500);
                     // SA.Write("SingleOrCont", "0"); SA.Query("OPC");
                     //   SA.Write("单次扫描"); SA.Query("OPC");
                     //   Thread.Sleep(100);
                     // string i=SA.Query("读MARK高精度频率", "1");
-                    string val = SA.Query("读MARK高精度频率", "1");
+                    string val = "";
+                    if (SA.Query("IDN").Contains("N9030"))
+                    {
+                        val = SA.Query("读MARK高精度频率", "1");
+                    }
+                    else
+                    {
+                        val = SA.Query("读MARK频率", "1");
+                    }
 
                     TestFreq = double.Parse(val);
-                    SA.Write("MARK关闭", "1"); SA.Query("OPC");
+                    if (SA.Query("IDN").Contains("N9030"))
+                    {
+                        SA.Write("MARK关闭", "1"); SA.Query("OPC");
+                    }
+                        
 
 
                     SA.Write("设置通道功率模式"); SA.Query("OPC");

binární
tps/TpsLabStudio/obj/Debug/DesignTimeResolveAssemblyReferences.cache


binární
tps/TpsLabStudio/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-decb6b1390e476d37613ac290019654e8fcb6be4
+60fbec6b54fa85610b87ef640925469373f3f35d

+ 2 - 1
tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.FileListAbsolute.txt

@@ -148,7 +148,6 @@ D:\lqCode\TpsLabStudio_LTS\exe\apps\Tps_LQ_Transmitter\config\ModulationMode.xls
 D:\lqCode\TpsLabStudio_LTS\exe\apps\Tps_LQ_Transmitter\config\串口控制.xlsx
 D:\lqCode\TpsLabStudio_LTS\exe\apps\Tps_LQ_Transmitter\Tps_LQ_Transmitter.dll
 D:\lqCode\TpsLabStudio_LTS\exe\apps\Tps_LQ_Transmitter\Tps_LQ_Transmitter.pdb
-D:\lqCode\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\TpsLabStudio.csproj.AssemblyReference.cache
 D:\lqCode\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\Tps_LQ_Transmitter.DebuggingForm.resources
 D:\lqCode\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\Tps_LQ_Transmitter.FrmMain.resources
 D:\lqCode\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\Tps_LQ_Transmitter.Properties.Resources.resources
@@ -179,3 +178,5 @@ E:\LqTest\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\TpsLabStudio.csproj.Genera
 E:\LqTest\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\TpsLabStudio.csproj.CoreCompileInputs.cache
 E:\LqTest\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\Tps_LQ_Transmitter.dll
 E:\LqTest\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\Tps_LQ_Transmitter.pdb
+D:\lqCode\TpsLabStudio_LTS\exe\apps\Tps_LQ_Transmitter\config\测试#常温测试#9B发射机-FSQ-8.xlsx
+D:\lqCode\TpsLabStudio_LTS\tps\TpsLabStudio\obj\Debug\TpsLabStudio.csproj.AssemblyReference.cache

binární
tps/TpsLabStudio/obj/Debug/TpsLabStudio.csproj.GenerateResource.cache


binární
tps/TpsLabStudio/obj/Debug/Tps_LQ_Transmitter.dll


binární
tps/TpsLabStudio/obj/Debug/Tps_LQ_Transmitter.pdb