Commit 589d47aa 几米阳光

三个轴原点返回都改为负方向

1 个父辈 faf869d1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
public class ACCMDManager public class ACCMDManager
...@@ -11,7 +11,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,7 +11,8 @@ namespace OnlineStore.DeviceLibrary
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON /// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary> /// </summary>
public static string Home_Single = "0132"; public static string Home_Single = "0132";
// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// <summary> /// <summary>
///速度 4601 ///速度 4601
/// </summary> /// </summary>
...@@ -23,11 +24,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -23,11 +24,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 0120h 选通输入 (STB) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON /// 0120h 选通输入 (STB) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary> /// </summary>
public static string STB_Addr = "0120"; public static string STB_Addr = "0120";
/// <summary> /// <summary>
/// 0124h 减速停止输入 (S-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON /// 0124h 减速停止输入 (S-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary> /// </summary>
public static string Stop_Addr = "0124"; public static string Stop_Addr = "0124";
/// <summary> /// <summary>
/// 0123h 紧急停止输入 (H-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON /// 0123h 紧急停止输入 (H-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary> /// </summary>
...@@ -50,7 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
/// 实际位置=600F /// 实际位置=600F
/// </summary> /// </summary>
public static string ActualPosition = "600F"; public static string ActualPosition = "600F";
/// <summary> /// <summary>
/// BUSY状态=0140,0140h 动作执行状态 (BUSY) ReadOnly 0:未执行 1:执行中 /// BUSY状态=0140,0140h 动作执行状态 (BUSY) ReadOnly 0:未执行 1:执行中
public static string BUSYStatus = "0140"; public static string BUSYStatus = "0140";
...@@ -73,7 +74,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -73,7 +74,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 读线圈01 /// 读线圈01
/// </summary> /// </summary>
public static byte CMD_ReadCoil= 0x01; public static byte CMD_ReadCoil = 0x01;
/// <summary> /// <summary>
/// 写线圈 05 /// 写线圈 05
/// </summary> /// </summary>
...@@ -128,12 +129,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -128,12 +129,12 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public static string Block_SuddenStop = "7"; public static string Block_SuddenStop = "7";
public static byte[] buildCheckData(byte[] sendData, int length) public static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
...@@ -152,7 +153,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,7 +153,7 @@ namespace OnlineStore.DeviceLibrary
// ( 2) 读取寄存器( 03h) // ( 2) 读取寄存器( 03h)
if (cmd.Equals(CMD_ReadRegisters)) if (cmd.Equals(CMD_ReadRegisters))
{ {
return Get03WriteData(slvAddr, addr,length); return Get03WriteData(slvAddr, addr, length);
} }
else if (cmd.Equals(CMD_WriteRegisters)) else if (cmd.Equals(CMD_WriteRegisters))
{ {
...@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteCoil; sendData[1] = CMD_WriteCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -188,7 +189,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -188,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -203,13 +204,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -203,13 +204,13 @@ namespace OnlineStore.DeviceLibrary
sendData = buildCheckData(sendData, sendData.Length - 2); sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData; return sendData;
} }
private static byte[] Get01WriteData(int slvAddr, string addr, int length) private static byte[] Get01WriteData(int slvAddr, string addr, int length)
{ {
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadCoil; sendData[1] = CMD_ReadCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -221,7 +222,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -221,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -249,10 +250,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,10 +250,10 @@ namespace OnlineStore.DeviceLibrary
//低位 //低位
//CRC 低位 //CRC 低位
//高位 //高位
byte[] sendData = new byte[8 ]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadRegisters; sendData[1] = CMD_ReadRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -264,7 +265,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -264,7 +265,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -276,7 +277,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -276,7 +277,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = dataByte[0]; sendData[5] = dataByte[0];
} }
sendData = buildCheckData(sendData, sendData.Length-2); sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData; return sendData;
} }
...@@ -294,7 +295,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -294,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteRegisters; sendData[1] = CMD_WriteRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -306,7 +307,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,7 +307,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -316,14 +317,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -316,14 +317,15 @@ namespace OnlineStore.DeviceLibrary
{ {
sendData[4] = dataByte[0]; sendData[4] = dataByte[0];
sendData[5] = dataByte[1]; sendData[5] = dataByte[1];
//sendData[4] = dataByte[1]; //sendData[4] = dataByte[1];
//sendData[5] = dataByte[0]; //sendData[5] = dataByte[0];
} }
sendData = buildCheckData(sendData, sendData.Length - 2); sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData; return sendData;
} }
} }
} }
...@@ -163,18 +163,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -163,18 +163,9 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType == 5) else if (wait.WaitType == 5)
{ {
if (wait.IsHomeMove) string msg = "";
{ wait.IsEnd = ShuoKeIsEnd(wait, out msg);
wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime); NotOkMsg = NotOkMsg + " " + msg;
}
else
{
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
}
if (!wait.IsEnd)
{
ShuoKeControls.GetStatus(wait.SlvAddr);
}
} }
if (wait.IsEnd) if (wait.IsEnd)
{ {
...@@ -206,7 +197,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,7 +197,18 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
{
msg = "";
if (wait.IsHomeMove)
{
return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg);
}
else
{
return ShuoKeControls.IsMoveEnd(wait.SlvAddr, wait.TargetPosition, StoreMove.LastSetpTime, out msg);
}
}
#endregion #endregion
#region 入库 #region 入库
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!