소스 검색

V1.2.2:
1、调整带载类型和有感或无感设置方式;
2、修改存储器读取的显示方式,针对Byte、Word、Double Word类型可自动转换十进制显示,并可设置是否清除。

Dail 2 년 전
부모
커밋
01bbc56526

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 79 - 72
Welling_Motor_Debug_Tool/Form1.Designer.cs

@@ -42,9 +42,6 @@ namespace Welling_Motor_Debug_Tool
             this.连接ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.写入存储ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.带载类型ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.空载ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.带载ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.工具箱ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.记录数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.计算器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -363,9 +360,11 @@ namespace Welling_Motor_Debug_Tool
             this.label45 = new System.Windows.Forms.Label();
             this.label46 = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
-            this.位置传感器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.无感ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.有感ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.checkBox_ReadRanFlash_AutoSW = new System.Windows.Forms.CheckBox();
+            this.checkBox_ReadRanFlash_AutoClear = new System.Windows.Forms.CheckBox();
+            this.checkBox_ReadRanFlash_ChangeFormat = new System.Windows.Forms.CheckBox();
+            this.label_Load = new System.Windows.Forms.Label();
+            this.label_MotorSensor = new System.Windows.Forms.Label();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -493,9 +492,7 @@ namespace Welling_Motor_Debug_Tool
             // 配置ToolStripMenuItem
             // 
             this.配置ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.写入存储ToolStripMenuItem,
-            this.带载类型ToolStripMenuItem,
-            this.位置传感器ToolStripMenuItem});
+            this.写入存储ToolStripMenuItem});
             this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
             this.配置ToolStripMenuItem.Name = "配置ToolStripMenuItem";
             this.配置ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
@@ -510,31 +507,6 @@ namespace Welling_Motor_Debug_Tool
             this.写入存储ToolStripMenuItem.Text = "执行保存";
             this.写入存储ToolStripMenuItem.Click += new System.EventHandler(this.写入存储ToolStripMenuItem_Click);
             // 
-            // 带载类型ToolStripMenuItem
-            // 
-            this.带载类型ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.空载ToolStripMenuItem,
-            this.带载ToolStripMenuItem});
-            this.带载类型ToolStripMenuItem.Name = "带载类型ToolStripMenuItem";
-            this.带载类型ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.带载类型ToolStripMenuItem.Text = "带载类型";
-            // 
-            // 空载ToolStripMenuItem
-            // 
-            this.空载ToolStripMenuItem.Name = "空载ToolStripMenuItem";
-            this.空载ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.空载ToolStripMenuItem.Text = "空载";
-            this.空载ToolStripMenuItem.Click += new System.EventHandler(this.空载ToolStripMenuItem_Click);
-            // 
-            // 带载ToolStripMenuItem
-            // 
-            this.带载ToolStripMenuItem.Checked = true;
-            this.带载ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.带载ToolStripMenuItem.Name = "带载ToolStripMenuItem";
-            this.带载ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.带载ToolStripMenuItem.Text = "带载";
-            this.带载ToolStripMenuItem.Click += new System.EventHandler(this.带载ToolStripMenuItem_Click);
-            // 
             // 工具箱ToolStripMenuItem
             // 
             this.工具箱ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -2351,7 +2323,7 @@ namespace Welling_Motor_Debug_Tool
             // button_OBC_ButtonSet
             // 
             this.button_OBC_ButtonSet.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_OBC_ButtonSet.Location = new System.Drawing.Point(6, 227);
+            this.button_OBC_ButtonSet.Location = new System.Drawing.Point(6, 264);
             this.button_OBC_ButtonSet.Name = "button_OBC_ButtonSet";
             this.button_OBC_ButtonSet.Size = new System.Drawing.Size(60, 35);
             this.button_OBC_ButtonSet.TabIndex = 20;
@@ -2362,7 +2334,7 @@ namespace Welling_Motor_Debug_Tool
             // button_OBC_ButtonLight
             // 
             this.button_OBC_ButtonLight.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_OBC_ButtonLight.Location = new System.Drawing.Point(6, 187);
+            this.button_OBC_ButtonLight.Location = new System.Drawing.Point(6, 216);
             this.button_OBC_ButtonLight.Name = "button_OBC_ButtonLight";
             this.button_OBC_ButtonLight.Size = new System.Drawing.Size(60, 35);
             this.button_OBC_ButtonLight.TabIndex = 19;
@@ -2373,7 +2345,7 @@ namespace Welling_Motor_Debug_Tool
             // button_OBC_ButtonWalk
             // 
             this.button_OBC_ButtonWalk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_OBC_ButtonWalk.Location = new System.Drawing.Point(6, 147);
+            this.button_OBC_ButtonWalk.Location = new System.Drawing.Point(6, 169);
             this.button_OBC_ButtonWalk.Name = "button_OBC_ButtonWalk";
             this.button_OBC_ButtonWalk.Size = new System.Drawing.Size(60, 35);
             this.button_OBC_ButtonWalk.TabIndex = 18;
@@ -2384,7 +2356,7 @@ namespace Welling_Motor_Debug_Tool
             // button_OBC_ButtonDec
             // 
             this.button_OBC_ButtonDec.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_OBC_ButtonDec.Location = new System.Drawing.Point(6, 107);
+            this.button_OBC_ButtonDec.Location = new System.Drawing.Point(6, 122);
             this.button_OBC_ButtonDec.Name = "button_OBC_ButtonDec";
             this.button_OBC_ButtonDec.Size = new System.Drawing.Size(60, 35);
             this.button_OBC_ButtonDec.TabIndex = 17;
@@ -2395,7 +2367,7 @@ namespace Welling_Motor_Debug_Tool
             // button_OBC_ButtonAcc
             // 
             this.button_OBC_ButtonAcc.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_OBC_ButtonAcc.Location = new System.Drawing.Point(6, 67);
+            this.button_OBC_ButtonAcc.Location = new System.Drawing.Point(6, 75);
             this.button_OBC_ButtonAcc.Name = "button_OBC_ButtonAcc";
             this.button_OBC_ButtonAcc.Size = new System.Drawing.Size(60, 35);
             this.button_OBC_ButtonAcc.TabIndex = 16;
@@ -2921,6 +2893,9 @@ namespace Welling_Motor_Debug_Tool
             // tabPage_RAMorFLASH
             // 
             this.tabPage_RAMorFLASH.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.tabPage_RAMorFLASH.Controls.Add(this.checkBox_ReadRanFlash_ChangeFormat);
+            this.tabPage_RAMorFLASH.Controls.Add(this.checkBox_ReadRanFlash_AutoClear);
+            this.tabPage_RAMorFLASH.Controls.Add(this.checkBox_ReadRanFlash_AutoSW);
             this.tabPage_RAMorFLASH.Controls.Add(this.textBox_Address_End);
             this.tabPage_RAMorFLASH.Controls.Add(this.label66);
             this.tabPage_RAMorFLASH.Controls.Add(this.textBox_Address_Begin);
@@ -2972,7 +2947,7 @@ namespace Welling_Motor_Debug_Tool
             // button_ReadRamFlash
             // 
             this.button_ReadRamFlash.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
-            this.button_ReadRamFlash.Location = new System.Drawing.Point(808, 259);
+            this.button_ReadRamFlash.Location = new System.Drawing.Point(811, 259);
             this.button_ReadRamFlash.Name = "button_ReadRamFlash";
             this.button_ReadRamFlash.Size = new System.Drawing.Size(112, 50);
             this.button_ReadRamFlash.TabIndex = 5;
@@ -3532,6 +3507,8 @@ namespace Welling_Motor_Debug_Tool
             // 
             // groupBox22
             // 
+            this.groupBox22.Controls.Add(this.label_MotorSensor);
+            this.groupBox22.Controls.Add(this.label_Load);
             this.groupBox22.Controls.Add(this.button_FacModeLightSW);
             this.groupBox22.Controls.Add(this.label_FacModeMotorSpeedSet);
             this.groupBox22.Controls.Add(this.label67);
@@ -3604,7 +3581,7 @@ namespace Welling_Motor_Debug_Tool
             // radioButton_FacModeDriverMtb
             // 
             this.radioButton_FacModeDriverMtb.AutoSize = true;
-            this.radioButton_FacModeDriverMtb.Location = new System.Drawing.Point(112, 38);
+            this.radioButton_FacModeDriverMtb.Location = new System.Drawing.Point(112, 46);
             this.radioButton_FacModeDriverMtb.Name = "radioButton_FacModeDriverMtb";
             this.radioButton_FacModeDriverMtb.Size = new System.Drawing.Size(63, 25);
             this.radioButton_FacModeDriverMtb.TabIndex = 1;
@@ -3615,7 +3592,7 @@ namespace Welling_Motor_Debug_Tool
             // radioButton_FacModeDriverCity
             // 
             this.radioButton_FacModeDriverCity.AutoSize = true;
-            this.radioButton_FacModeDriverCity.Location = new System.Drawing.Point(23, 38);
+            this.radioButton_FacModeDriverCity.Location = new System.Drawing.Point(23, 46);
             this.radioButton_FacModeDriverCity.Name = "radioButton_FacModeDriverCity";
             this.radioButton_FacModeDriverCity.Size = new System.Drawing.Size(63, 25);
             this.radioButton_FacModeDriverCity.TabIndex = 0;
@@ -3998,30 +3975,61 @@ namespace Welling_Motor_Debug_Tool
             this.pictureBox2.TabIndex = 16;
             this.pictureBox2.TabStop = false;
             // 
-            // 位置传感器ToolStripMenuItem
-            // 
-            this.位置传感器ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.无感ToolStripMenuItem,
-            this.有感ToolStripMenuItem});
-            this.位置传感器ToolStripMenuItem.Name = "位置传感器ToolStripMenuItem";
-            this.位置传感器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.位置传感器ToolStripMenuItem.Text = "位置模式";
-            // 
-            // 无感ToolStripMenuItem
-            // 
-            this.无感ToolStripMenuItem.Name = "无感ToolStripMenuItem";
-            this.无感ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.无感ToolStripMenuItem.Text = "无感";
-            this.无感ToolStripMenuItem.Click += new System.EventHandler(this.无感ToolStripMenuItem_Click);
-            // 
-            // 有感ToolStripMenuItem
-            // 
-            this.有感ToolStripMenuItem.Checked = true;
-            this.有感ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.有感ToolStripMenuItem.Name = "有感ToolStripMenuItem";
-            this.有感ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.有感ToolStripMenuItem.Text = "有感";
-            this.有感ToolStripMenuItem.Click += new System.EventHandler(this.有感ToolStripMenuItem_Click);
+            // checkBox_ReadRanFlash_AutoSW
+            // 
+            this.checkBox_ReadRanFlash_AutoSW.AutoSize = true;
+            this.checkBox_ReadRanFlash_AutoSW.Location = new System.Drawing.Point(811, 194);
+            this.checkBox_ReadRanFlash_AutoSW.Name = "checkBox_ReadRanFlash_AutoSW";
+            this.checkBox_ReadRanFlash_AutoSW.Size = new System.Drawing.Size(93, 25);
+            this.checkBox_ReadRanFlash_AutoSW.TabIndex = 11;
+            this.checkBox_ReadRanFlash_AutoSW.Text = "自动读取";
+            this.checkBox_ReadRanFlash_AutoSW.UseVisualStyleBackColor = true;
+            // 
+            // checkBox_ReadRanFlash_AutoClear
+            // 
+            this.checkBox_ReadRanFlash_AutoClear.AutoSize = true;
+            this.checkBox_ReadRanFlash_AutoClear.Checked = true;
+            this.checkBox_ReadRanFlash_AutoClear.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.checkBox_ReadRanFlash_AutoClear.Location = new System.Drawing.Point(811, 8);
+            this.checkBox_ReadRanFlash_AutoClear.Name = "checkBox_ReadRanFlash_AutoClear";
+            this.checkBox_ReadRanFlash_AutoClear.Size = new System.Drawing.Size(141, 25);
+            this.checkBox_ReadRanFlash_AutoClear.TabIndex = 12;
+            this.checkBox_ReadRanFlash_AutoClear.Text = "数据更新时清屏";
+            this.checkBox_ReadRanFlash_AutoClear.UseVisualStyleBackColor = true;
+            // 
+            // checkBox_ReadRanFlash_ChangeFormat
+            // 
+            this.checkBox_ReadRanFlash_ChangeFormat.AutoSize = true;
+            this.checkBox_ReadRanFlash_ChangeFormat.Checked = true;
+            this.checkBox_ReadRanFlash_ChangeFormat.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.checkBox_ReadRanFlash_ChangeFormat.Location = new System.Drawing.Point(811, 39);
+            this.checkBox_ReadRanFlash_ChangeFormat.Name = "checkBox_ReadRanFlash_ChangeFormat";
+            this.checkBox_ReadRanFlash_ChangeFormat.Size = new System.Drawing.Size(141, 25);
+            this.checkBox_ReadRanFlash_ChangeFormat.TabIndex = 13;
+            this.checkBox_ReadRanFlash_ChangeFormat.Text = "转换十进制显示";
+            this.checkBox_ReadRanFlash_ChangeFormat.UseVisualStyleBackColor = true;
+            // 
+            // label_Load
+            // 
+            this.label_Load.AutoSize = true;
+            this.label_Load.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
+            this.label_Load.Location = new System.Drawing.Point(79, 26);
+            this.label_Load.Name = "label_Load";
+            this.label_Load.Size = new System.Drawing.Size(32, 17);
+            this.label_Load.TabIndex = 4;
+            this.label_Load.Text = "带载";
+            this.label_Load.Click += new System.EventHandler(this.label_Load_Click);
+            // 
+            // label_MotorSensor
+            // 
+            this.label_MotorSensor.AutoSize = true;
+            this.label_MotorSensor.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
+            this.label_MotorSensor.Location = new System.Drawing.Point(162, 26);
+            this.label_MotorSensor.Name = "label_MotorSensor";
+            this.label_MotorSensor.Size = new System.Drawing.Size(32, 17);
+            this.label_MotorSensor.TabIndex = 21;
+            this.label_MotorSensor.Text = "有感";
+            this.label_MotorSensor.Click += new System.EventHandler(this.label_MotorSensor_Click);
             // 
             // Form1
             // 
@@ -4456,13 +4464,12 @@ namespace Welling_Motor_Debug_Tool
         private Button button_OBC_ButtonDec;
         private Button button_OBC_ButtonAcc;
         private Button button_OBC_ButtonPower;
-        private ToolStripMenuItem 带载类型ToolStripMenuItem;
-        private ToolStripMenuItem 空载ToolStripMenuItem;
-        private ToolStripMenuItem 带载ToolStripMenuItem;
         private TextBox textBox_TorqueReg;
         private Label label55;
-        private ToolStripMenuItem 位置传感器ToolStripMenuItem;
-        private ToolStripMenuItem 无感ToolStripMenuItem;
-        private ToolStripMenuItem 有感ToolStripMenuItem;
+        private CheckBox checkBox_ReadRanFlash_AutoSW;
+        private CheckBox checkBox_ReadRanFlash_ChangeFormat;
+        private CheckBox checkBox_ReadRanFlash_AutoClear;
+        private Label label_MotorSensor;
+        private Label label_Load;
     }
 }

+ 143 - 37
Welling_Motor_Debug_Tool/Form1.cs

@@ -829,10 +829,78 @@ namespace Welling_Motor_Debug_Tool
                                     {
                                         long ByteNum = 0;
                                         ByteNum = ((Data[4] << 24) + (Data[5] << 16) + (Data[6] << 8) + Data[7]) - ((Data[0] << 24) + (Data[1] << 16) + (Data[2] << 8) + Data[3]) + 1;
-                                        for (int i = 0; i < ByteNum; i++)
+                                        if (ByteNum > 4) //数据长度超过4Bytes,按照16进制显示字节流
                                         {
-                                            richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8 + i], 16).PadLeft(2, '0').ToUpper() + " ");
+                                            for (int i = 0; i < ByteNum; i++)
+                                            {
+                                                richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8 + i], 16).PadLeft(2, '0').ToUpper() + " ");
+                                            }
                                         }
+                                        else //根据设置自动转换10进制显示
+                                        {
+                                            if (checkBox_ReadRanFlash_ChangeFormat.Checked == true) //10进制显示
+                                            {
+                                                switch (ByteNum)
+                                                {
+                                                    case 1:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8]) + ", ");
+                                                            break;
+                                                        }
+                                                    case 2:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8] + (Data[9] << 8)) + ", ");
+                                                            break;
+                                                        }
+                                                    case 3:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8] + (Data[9] << 8) + (Data[10] << 16)) + ", ");
+                                                            break;
+                                                        }
+                                                    case 4:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText(Convert.ToString(Data[8] + (Data[9] << 8) + (Data[10] << 16) + (Data[11] << 24)) + ", ");
+                                                            break;
+                                                        }
+                                                    default:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("无效数据" + ", ");
+                                                            break;
+                                                        }
+                                                }
+                                            }
+                                            else //16进制显示
+                                            {
+                                                switch (ByteNum)
+                                                {
+                                                    case 1:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("0x" + Convert.ToString(Data[8], 16).PadLeft(2, '0').ToUpper() + ", ");
+                                                            break;
+                                                        }
+                                                    case 2:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("0x" + Convert.ToString(Data[8] + (Data[9] << 8), 16).PadLeft(4, '0').ToUpper() + ", ");
+                                                            break;
+                                                        }
+                                                    case 3:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("0x" + Convert.ToString(Data[8] + (Data[9] << 8) + (Data[10] << 16), 16).PadLeft(6, '0').ToUpper() + ", ");
+                                                            break;
+                                                        }
+                                                    case 4:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("0x" + Convert.ToString(Data[8] + (Data[9] << 8) + (Data[10] << 16) + (Data[11] << 24), 16).PadLeft(8, '0').ToUpper() + ", ");
+                                                            break;
+                                                        }
+                                                    default:
+                                                        {
+                                                            richTextBox_RamFlasgData.AppendText("无效数据" + ", ");
+                                                            break;
+                                                        }
+                                                }
+                                            }
+                                        }                                      
                                     }));
                                 }  
                             }
@@ -1120,6 +1188,61 @@ namespace Welling_Motor_Debug_Tool
                 }
             }
 
+            //定时读取存储器
+            if (checkBox_ReadRanFlash_AutoSW.Checked == true)
+            {
+                var Address = new byte[4];
+                UInt32 Address_Begin;
+                UInt32 Addres_End;
+
+                if (checkBox_ReadRanFlash_AutoClear.Checked == true)
+                    richTextBox_RamFlasgData.Clear();
+
+                do
+                {
+                    if ((textBox_Address_Begin.Text == string.Empty) || (textBox_Address_End.Text == string.Empty))
+                    {
+                        checkBox_ReadRanFlash_AutoSW.Checked = false;
+                        MessageBox.Show("请输入起始和结束地址!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);                        
+                        continue;
+                    }
+                    else if ((textBox_Address_Begin.Text.Length != 8) || (textBox_Address_End.Text.Length != 8))
+                    {
+                        checkBox_ReadRanFlash_AutoSW.Checked = false;
+                        MessageBox.Show("请检查地址长度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);                        
+                        continue;
+                    }
+                    else
+                    {
+                        Address = mySerialProcess.HexStringToBytes(textBox_Address_Begin.Text, false);
+                        Address_Begin = ((UInt32)Address[0] << 24) + ((UInt32)Address[1] << 16) + ((UInt32)Address[2] << 8) + ((UInt32)Address[3]);
+                        Address = mySerialProcess.HexStringToBytes(textBox_Address_End.Text, false);
+                        Addres_End = ((UInt32)Address[0] << 24) + ((UInt32)Address[1] << 16) + ((UInt32)Address[2] << 8) + ((UInt32)Address[3]);
+
+                        if (Addres_End < Address_Begin)
+                        {
+                            checkBox_ReadRanFlash_AutoSW.Checked = false;
+                            MessageBox.Show("结束地址必须大于或等于起始地址!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);                            
+                            continue;
+                        }
+                        else
+                        {
+                            var SendByte = new byte[8];
+                            SendByte[0] = (byte)(Address_Begin >> 24);
+                            SendByte[1] = (byte)(Address_Begin >> 16);
+                            SendByte[2] = (byte)(Address_Begin >> 8);
+                            SendByte[3] = (byte)(Address_Begin);
+                            SendByte[4] = (byte)(Addres_End >> 24);
+                            SendByte[5] = (byte)(Addres_End >> 16);
+                            SendByte[6] = (byte)(Addres_End >> 8);
+                            SendByte[7] = (byte)(Addres_End);
+
+                            mySerialProcess.SendCmd((ushort)0x751, (byte)0x11, (ushort)0x2D08, SendByte);
+                        }
+                    }
+                } while (false);
+            }
+
         }
 
         /// <summary>
@@ -2332,7 +2455,8 @@ namespace Welling_Motor_Debug_Tool
             UInt32 Address_Begin;
             UInt32 Addres_End;
 
-            richTextBox_RamFlasgData.Clear();
+            if(checkBox_ReadRanFlash_AutoClear.Checked == true)
+                richTextBox_RamFlasgData.Clear();
 
             if ((textBox_Address_Begin.Text == string.Empty) || (textBox_Address_End.Text == string.Empty))
             {
@@ -2748,11 +2872,11 @@ namespace Welling_Motor_Debug_Tool
                     return;
                 }
                 //设置带载类型
-                if (空载ToolStripMenuItem.Checked == true)
+                if (label_Load.Text == "空载")
                 {
                     strDataTemp[10] = "转速环控制器带宽=3";
                 }
-                else if (带载ToolStripMenuItem.Checked == true)
+                else if (label_Load.Text == "带载")
                 {
                     strDataTemp[10] = "转速环控制器带宽=15";
                 }
@@ -2764,11 +2888,11 @@ namespace Welling_Motor_Debug_Tool
                     return;
                 }
                 //选择位置模式
-                if (有感ToolStripMenuItem.Checked == true)
+                if (label_MotorSensor.Text == "有感")
                 {
                     strDataTemp[1] = "位置获取模式=1";
                 }
-                else if (无感ToolStripMenuItem.Checked == true)
+                else if (label_MotorSensor.Text == "无感")
                 {
                     strDataTemp[1] = "位置获取模式=0";
                 }
@@ -3493,47 +3617,29 @@ namespace Welling_Motor_Debug_Tool
         }
 
         /// <summary>
-        /// 带载类型选择空载
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void 空载ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            空载ToolStripMenuItem.Checked = true;
-            带载ToolStripMenuItem.Checked = false;
-        }
-
-        /// <summary>
-        /// 带载类型选择带载
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void 带载ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            空载ToolStripMenuItem.Checked = false;
-            带载ToolStripMenuItem.Checked = true;
-        }
-
-        /// <summary>
-        /// 位置模式选择无感
+        /// 带载类型选择
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void 无感ToolStripMenuItem_Click(object sender, EventArgs e)
+        private void label_Load_Click(object sender, EventArgs e)
         {
-            无感ToolStripMenuItem.Checked = true;
-            有感ToolStripMenuItem.Checked = false;
+            if (label_Load.Text == "带载")
+                label_Load.Text = "空载";
+            else if (label_Load.Text == "空载")
+                label_Load.Text = "带载";
         }
 
         /// <summary>
-        /// 位置模式选择有感
+        /// 控制模式选择
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void 有感ToolStripMenuItem_Click(object sender, EventArgs e)
+        private void label_MotorSensor_Click(object sender, EventArgs e)
         {
-            有感ToolStripMenuItem.Checked = true;
-            无感ToolStripMenuItem.Checked = false;
+            if (label_MotorSensor.Text == "有感")
+                label_MotorSensor.Text = "无感";
+            else if (label_MotorSensor.Text == "无感")
+                label_MotorSensor.Text = "有感";
         }
     }
 }

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool.pdb


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb