Commit 57fcc6e2 LN

增加伺服ON输入信号读取

1 个父辈 a5ff6dbd
......@@ -63,6 +63,8 @@
this.button5 = new System.Windows.Forms.Button();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupAxis = new System.Windows.Forms.GroupBox();
this.label13 = new System.Windows.Forms.Label();
this.textBoxON = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtServoStatue = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
......@@ -635,6 +637,8 @@
//
this.groupAxis.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupAxis.Controls.Add(this.label13);
this.groupAxis.Controls.Add(this.textBoxON);
this.groupAxis.Controls.Add(this.label5);
this.groupAxis.Controls.Add(this.txtServoStatue);
this.groupAxis.Controls.Add(this.label17);
......@@ -675,15 +679,32 @@
this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupAxis.Location = new System.Drawing.Point(6, 6);
this.groupAxis.Name = "groupAxis";
this.groupAxis.Size = new System.Drawing.Size(546, 299);
this.groupAxis.Size = new System.Drawing.Size(546, 306);
this.groupAxis.TabIndex = 216;
this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(28, 157);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(79, 17);
this.label13.TabIndex = 328;
this.label13.Text = "伺服ON输入:";
//
// textBoxON
//
this.textBoxON.Enabled = false;
this.textBoxON.Location = new System.Drawing.Point(113, 154);
this.textBoxON.Name = "textBoxON";
this.textBoxON.Size = new System.Drawing.Size(25, 23);
this.textBoxON.TabIndex = 327;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(48, 170);
this.label5.Location = new System.Drawing.Point(48, 186);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(59, 17);
this.label5.TabIndex = 326;
......@@ -692,7 +713,7 @@
// txtServoStatue
//
this.txtServoStatue.Enabled = false;
this.txtServoStatue.Location = new System.Drawing.Point(113, 167);
this.txtServoStatue.Location = new System.Drawing.Point(113, 183);
this.txtServoStatue.Name = "txtServoStatue";
this.txtServoStatue.Size = new System.Drawing.Size(25, 23);
this.txtServoStatue.TabIndex = 325;
......@@ -700,7 +721,7 @@
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(155, 271);
this.label17.Location = new System.Drawing.Point(155, 263);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(71, 17);
this.label17.TabIndex = 324;
......@@ -710,7 +731,7 @@
// txtLimit2
//
this.txtLimit2.Enabled = false;
this.txtLimit2.Location = new System.Drawing.Point(232, 268);
this.txtLimit2.Location = new System.Drawing.Point(232, 260);
this.txtLimit2.Name = "txtLimit2";
this.txtLimit2.Size = new System.Drawing.Size(25, 23);
this.txtLimit2.TabIndex = 321;
......@@ -718,7 +739,7 @@
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(155, 237);
this.label19.Location = new System.Drawing.Point(155, 229);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(71, 17);
this.label19.TabIndex = 320;
......@@ -728,7 +749,7 @@
// txtLimit1
//
this.txtLimit1.Enabled = false;
this.txtLimit1.Location = new System.Drawing.Point(232, 234);
this.txtLimit1.Location = new System.Drawing.Point(232, 226);
this.txtLimit1.Name = "txtLimit1";
this.txtLimit1.Size = new System.Drawing.Size(25, 23);
this.txtLimit1.TabIndex = 317;
......@@ -736,7 +757,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(167, 203);
this.label6.Location = new System.Drawing.Point(167, 195);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(59, 17);
this.label6.TabIndex = 300;
......@@ -745,7 +766,7 @@
// txtHomeSingle
//
this.txtHomeSingle.Enabled = false;
this.txtHomeSingle.Location = new System.Drawing.Point(232, 200);
this.txtHomeSingle.Location = new System.Drawing.Point(232, 192);
this.txtHomeSingle.Name = "txtHomeSingle";
this.txtHomeSingle.Size = new System.Drawing.Size(25, 23);
this.txtHomeSingle.TabIndex = 297;
......@@ -753,7 +774,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(2, 271);
this.label11.Location = new System.Drawing.Point(2, 273);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(105, 17);
this.label11.TabIndex = 292;
......@@ -762,7 +783,7 @@
// txtHomeStatus
//
this.txtHomeStatus.Enabled = false;
this.txtHomeStatus.Location = new System.Drawing.Point(113, 268);
this.txtHomeStatus.Location = new System.Drawing.Point(113, 270);
this.txtHomeStatus.Name = "txtHomeStatus";
this.txtHomeStatus.Size = new System.Drawing.Size(25, 23);
this.txtHomeStatus.TabIndex = 291;
......@@ -770,7 +791,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(41, 237);
this.label10.Location = new System.Drawing.Point(41, 244);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(66, 17);
this.label10.TabIndex = 289;
......@@ -779,7 +800,7 @@
// txtBusyStatus
//
this.txtBusyStatus.Enabled = false;
this.txtBusyStatus.Location = new System.Drawing.Point(113, 234);
this.txtBusyStatus.Location = new System.Drawing.Point(113, 241);
this.txtBusyStatus.Name = "txtBusyStatus";
this.txtBusyStatus.Size = new System.Drawing.Size(25, 23);
this.txtBusyStatus.TabIndex = 288;
......@@ -787,7 +808,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(48, 203);
this.label2.Location = new System.Drawing.Point(48, 215);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 17);
this.label2.TabIndex = 286;
......@@ -796,7 +817,7 @@
// txtAlarmStatus
//
this.txtAlarmStatus.Enabled = false;
this.txtAlarmStatus.Location = new System.Drawing.Point(113, 200);
this.txtAlarmStatus.Location = new System.Drawing.Point(113, 212);
this.txtAlarmStatus.Name = "txtAlarmStatus";
this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23);
this.txtAlarmStatus.TabIndex = 285;
......@@ -805,7 +826,7 @@
//
this.btnGetAlarm.BackColor = System.Drawing.SystemColors.Control;
this.btnGetAlarm.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnGetAlarm.Location = new System.Drawing.Point(290, 215);
this.btnGetAlarm.Location = new System.Drawing.Point(290, 207);
this.btnGetAlarm.Name = "btnGetAlarm";
this.btnGetAlarm.Size = new System.Drawing.Size(105, 33);
this.btnGetAlarm.TabIndex = 284;
......@@ -820,7 +841,7 @@
this.btnReadPosition.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReadPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadPosition.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnReadPosition.Location = new System.Drawing.Point(428, 250);
this.btnReadPosition.Location = new System.Drawing.Point(428, 242);
this.btnReadPosition.Name = "btnReadPosition";
this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnReadPosition.Size = new System.Drawing.Size(105, 33);
......@@ -833,7 +854,7 @@
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(167, 167);
this.label8.Location = new System.Drawing.Point(167, 159);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(59, 17);
this.label8.TabIndex = 255;
......@@ -873,7 +894,7 @@
//
// txtP
//
this.txtP.Location = new System.Drawing.Point(232, 164);
this.txtP.Location = new System.Drawing.Point(232, 156);
this.txtP.Name = "txtP";
this.txtP.ReadOnly = true;
this.txtP.Size = new System.Drawing.Size(87, 23);
......@@ -975,7 +996,7 @@
//
this.btnComAlarmClear.BackColor = System.Drawing.SystemColors.Control;
this.btnComAlarmClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnComAlarmClear.Location = new System.Drawing.Point(290, 254);
this.btnComAlarmClear.Location = new System.Drawing.Point(290, 246);
this.btnComAlarmClear.Name = "btnComAlarmClear";
this.btnComAlarmClear.Size = new System.Drawing.Size(105, 33);
this.btnComAlarmClear.TabIndex = 50;
......@@ -1129,7 +1150,7 @@
this.groupBox1.Controls.Add(this.label43);
this.groupBox1.Controls.Add(this.label42);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(6, 308);
this.groupBox1.Location = new System.Drawing.Point(6, 317);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(543, 182);
this.groupBox1.TabIndex = 217;
......@@ -2016,7 +2037,7 @@
this.btnInOutP2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP2.Size = new System.Drawing.Size(140, 33);
this.btnInOutP2.TabIndex = 211;
this.btnInOutP2.Text = "进出轴取料点P2:";
this.btnInOutP2.Text = "进出轴仓门取料点P2:";
this.btnInOutP2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP2.UseVisualStyleBackColor = false;
this.btnInOutP2.Click += new System.EventHandler(this.btnInOutP2_Click);
......@@ -2184,7 +2205,7 @@
this.btnInOutP3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP3.Size = new System.Drawing.Size(140, 33);
this.btnInOutP3.TabIndex = 193;
this.btnInOutP3.Text = "进出轴取料点P3:";
this.btnInOutP3.Text = "进出轴库位取料点P3:";
this.btnInOutP3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP3.UseVisualStyleBackColor = false;
this.btnInOutP3.Click += new System.EventHandler(this.btnInOutP3_Click);
......@@ -2487,6 +2508,8 @@
private System.Windows.Forms.Button btnCheckPos;
private System.Windows.Forms.Button btnStartAutoCheck;
private System.Windows.Forms.Button btnCon;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBoxON;
}
}
......@@ -1107,6 +1107,7 @@ namespace OnlineStore.ACSingleStore
{
string PortName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
txtServoStatue.Text = ACServerManager.SRV_ON(PortName, SlvAddr) ? "✔" : "✘";
txtServoStatue.Text = ACServerManager.ServerOnStatus(PortName, SlvAddr) ? "✔" : "✘";
this.txtAlarmStatus.Text = ACServerManager.GetAlarmStatus(PortName, SlvAddr).ToString();
this.txtBusyStatus.Text = ACServerManager.GetBusyStatus(PortName, SlvAddr).ToString();
......
......@@ -7,6 +7,11 @@ namespace OnlineStore.DeviceLibrary
{
public class ACCMDManager
{
/// <summary>
/// 0020h 伺服 On 输入(SRV-ON) ReadOnly 0:输入 OFF、1:输入 ON
/// </summary>
public static string SRV_ON = "0020";
/// <summary>
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary>
......
......@@ -137,8 +137,24 @@ namespace OnlineStore.DeviceLibrary
ColsePort(key);
}
}
/// <summary>
/// 是否有伺服使能信号
/// </summary>
public static bool SRV_ON(string portName, short slvAddr)
{
if (!serialBeanMap.ContainsKey(portName))
{
return false;
}
PreReadCoilAddr = ACCMDManager.SRV_ON;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, PreReadCoilAddr, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, ReviceOutTimeMS, 6);
int result = GetCoilData(portName, reviceData, PreReadCoilAddr);
//TODO
return result >= 1;
}
/// <summary>
/// 是否成功打开伺服
/// </summary>
......@@ -237,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, addr, data, length);
SendData(portName, dataArray, 5);
}
}
public static void ServoOn(string portName, int slvAddr)
{
string addr = ACCMDManager.ServerOn_Addr;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!