Commit cb3129a8 LN

模拟量调试修改

1 个父辈 8566b42c
......@@ -95,6 +95,7 @@
<Content Include="system_config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="说明.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
20200303
获取模拟量IO方法:
public static short GetAdVal(short adNo)
值说明:
3754 -20
4380 -10
5005 0
5317 5
10mm对应625,1mm=62.5;
\ No newline at end of file
......@@ -212,6 +212,7 @@
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.timerIO = new System.Windows.Forms.Timer(this.components);
this.timerMain = new System.Windows.Forms.Timer(this.components);
this.chbAuto = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox8.SuspendLayout();
......@@ -1322,11 +1323,11 @@
this.tabPage2.Controls.Add(this.groupBox9);
this.tabPage2.Controls.Add(this.groupBox10);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Location = new System.Drawing.Point(4, 26);
this.tabPage2.Margin = new System.Windows.Forms.Padding(2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(2);
this.tabPage2.Size = new System.Drawing.Size(750, 562);
this.tabPage2.Size = new System.Drawing.Size(750, 558);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = " 数字量IO ";
//
......@@ -2049,6 +2050,7 @@
//
// groupBox5
//
this.groupBox5.Controls.Add(this.chbAuto);
this.groupBox5.Controls.Add(this.lblAdSts);
this.groupBox5.Controls.Add(this.txtAdSts4);
this.groupBox5.Controls.Add(this.label11);
......@@ -2077,31 +2079,34 @@
// lblAdSts
//
this.lblAdSts.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.lblAdSts.Location = new System.Drawing.Point(372, 29);
this.lblAdSts.Location = new System.Drawing.Point(681, 29);
this.lblAdSts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAdSts.Name = "lblAdSts";
this.lblAdSts.Size = new System.Drawing.Size(354, 202);
this.lblAdSts.Size = new System.Drawing.Size(45, 202);
this.lblAdSts.TabIndex = 31;
this.lblAdSts.Text = "通道1值:";
this.lblAdSts.Visible = false;
//
// txtAdSts4
//
this.txtAdSts4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAdSts4.Location = new System.Drawing.Point(259, 159);
this.txtAdSts4.Location = new System.Drawing.Point(624, 164);
this.txtAdSts4.Margin = new System.Windows.Forms.Padding(2);
this.txtAdSts4.Name = "txtAdSts4";
this.txtAdSts4.Size = new System.Drawing.Size(85, 26);
this.txtAdSts4.TabIndex = 30;
this.txtAdSts4.Visible = false;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(176, 164);
this.label11.Location = new System.Drawing.Point(541, 169);
this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(75, 17);
this.label11.TabIndex = 29;
this.label11.Text = "通道1状态:";
this.label11.Visible = false;
//
// txtAd4
//
......@@ -2125,21 +2130,23 @@
// txtAdSts3
//
this.txtAdSts3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAdSts3.Location = new System.Drawing.Point(259, 117);
this.txtAdSts3.Location = new System.Drawing.Point(624, 122);
this.txtAdSts3.Margin = new System.Windows.Forms.Padding(2);
this.txtAdSts3.Name = "txtAdSts3";
this.txtAdSts3.Size = new System.Drawing.Size(85, 26);
this.txtAdSts3.TabIndex = 26;
this.txtAdSts3.Visible = false;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(176, 122);
this.label9.Location = new System.Drawing.Point(541, 127);
this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(75, 17);
this.label9.TabIndex = 25;
this.label9.Text = "通道1状态:";
this.label9.Visible = false;
//
// txtAd3
//
......@@ -2163,21 +2170,23 @@
// txtAdSts2
//
this.txtAdSts2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAdSts2.Location = new System.Drawing.Point(259, 74);
this.txtAdSts2.Location = new System.Drawing.Point(624, 79);
this.txtAdSts2.Margin = new System.Windows.Forms.Padding(2);
this.txtAdSts2.Name = "txtAdSts2";
this.txtAdSts2.Size = new System.Drawing.Size(85, 26);
this.txtAdSts2.TabIndex = 22;
this.txtAdSts2.Visible = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(176, 79);
this.label5.Location = new System.Drawing.Point(541, 84);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(75, 17);
this.label5.TabIndex = 21;
this.label5.Text = "通道1状态:";
this.label5.Visible = false;
//
// txtAd2
//
......@@ -2201,7 +2210,7 @@
// btnAdGet
//
this.btnAdGet.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdGet.Location = new System.Drawing.Point(179, 226);
this.btnAdGet.Location = new System.Drawing.Point(67, 212);
this.btnAdGet.Margin = new System.Windows.Forms.Padding(2);
this.btnAdGet.Name = "btnAdGet";
this.btnAdGet.Size = new System.Drawing.Size(100, 35);
......@@ -2213,21 +2222,23 @@
// txtAdSts1
//
this.txtAdSts1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAdSts1.Location = new System.Drawing.Point(259, 32);
this.txtAdSts1.Location = new System.Drawing.Point(624, 37);
this.txtAdSts1.Margin = new System.Windows.Forms.Padding(2);
this.txtAdSts1.Name = "txtAdSts1";
this.txtAdSts1.Size = new System.Drawing.Size(85, 26);
this.txtAdSts1.TabIndex = 17;
this.txtAdSts1.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(176, 37);
this.label7.Location = new System.Drawing.Point(541, 42);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(75, 17);
this.label7.TabIndex = 16;
this.label7.Text = "通道1状态:";
this.label7.Visible = false;
//
// txtAd1
//
......@@ -2345,6 +2356,17 @@
this.timerMain.Interval = 1000;
this.timerMain.Tick += new System.EventHandler(this.timerMain_Tick);
//
// chbAuto
//
this.chbAuto.AutoSize = true;
this.chbAuto.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAuto.Location = new System.Drawing.Point(193, 217);
this.chbAuto.Name = "chbAuto";
this.chbAuto.Size = new System.Drawing.Size(84, 24);
this.chbAuto.TabIndex = 32;
this.chbAuto.Text = "自动读取";
this.chbAuto.UseVisualStyleBackColor = true;
//
// FrmHuiChuanTest
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -2575,5 +2597,6 @@
private System.Windows.Forms.TextBox txtAd1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label lblAdSts;
private System.Windows.Forms.CheckBox chbAuto;
}
}
\ No newline at end of file
......@@ -590,6 +590,11 @@ namespace HuichuanLibrary
{
FormStatus(true );
}
if (chbAuto.Checked)
{
ReadAdValue();
}
}
else
......@@ -632,15 +637,24 @@ namespace HuichuanLibrary
MessageBox.Show("板卡未初始化完成!");
return;
}
ReadAdValue();
//txtAdSts1.Text = ConSts(HCBoardManager.GetAdSts(0));
//txtAdSts2.Text = ConSts(HCBoardManager.GetAdSts(1));
//txtAdSts3.Text = ConSts(HCBoardManager.GetAdSts(2));
//txtAdSts4.Text = ConSts(HCBoardManager.GetAdSts(3));
}
private void ReadAdValue()
{
if (!HCBoardManager.CardInitOk())
{
return;
}
txtAd1.Text = HCBoardManager.GetAdVal(0).ToString();
txtAd2.Text = HCBoardManager.GetAdVal(1).ToString();
txtAd3.Text = HCBoardManager.GetAdVal(2).ToString();
txtAd4.Text = HCBoardManager.GetAdVal(3).ToString();
txtAdSts1.Text = ConSts(HCBoardManager.GetAdSts(0));
txtAdSts2.Text = ConSts(HCBoardManager.GetAdSts(1));
txtAdSts3.Text = ConSts(HCBoardManager.GetAdSts(2));
txtAdSts4.Text = ConSts(HCBoardManager.GetAdSts(3));
}
private string ConSts(short input)
......
......@@ -547,7 +547,7 @@ namespace HuichuanLibrary
#region AD/DA控制
/// <summary>
/// 获取EtherCAT 第 adNo号的ad值
/// 模拟量IO值获取 获取EtherCAT 第 adNo号的ad值
/// </summary>
/// <param name="adNo">ad的通道:0~配置个数</param>
/// <returns>获取AD的输入值</returns>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!