add axes cmd (target pos and strobe/ack)
This commit is contained in:
@@ -676,6 +676,17 @@ namespace CMS_CORE_Library
|
||||
/// <param name="confirmUpdate">true: HMI --> PLC, false: PLC --> HMI</param>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WRecipeEdit(bool confirmUpdate);
|
||||
|
||||
/// <summary>
|
||||
/// Send axis command
|
||||
/// </summary>
|
||||
/// <param name="AxisNum">ID asse</param>
|
||||
/// <param name="CommandBit">Comando (0..15)</param>
|
||||
/// <param name="WritePos">Indica se scrivere la TargetPos</param>
|
||||
/// <param name="TargetPos">Posizione target</param>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WAxisCommand(int AxisNum, uint CommandBit, bool WritePos, double TargetPos);
|
||||
|
||||
/// <summary>
|
||||
/// Confirm FLIR image acquired and copied to PLC
|
||||
/// </summary>
|
||||
|
||||
@@ -40,11 +40,13 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
internal static MEMORY_CELL ALARMS_STATUS = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 14, 128);
|
||||
|
||||
// assi
|
||||
internal static MEMORY_CELL AXES_BUTTON_VISIBLE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 3044, 16);
|
||||
|
||||
internal static MEMORY_CELL AXES_INFO = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 616, 0, 896);
|
||||
internal static MEMORY_CELL AXES_COMMAND = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 616, 512, 512);
|
||||
|
||||
internal static MEMORY_CELL AXES_INFO = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 616, 0, 512);
|
||||
|
||||
// assi
|
||||
internal static MEMORY_CELL AXES_RTDATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 615, 0, 768);
|
||||
|
||||
internal static MEMORY_CELL AXIS_RESET_PROCEDURE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 2608, 1);
|
||||
@@ -3320,7 +3322,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
}
|
||||
}
|
||||
return libraryError;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current Axis RT data
|
||||
@@ -4624,6 +4626,43 @@ namespace CMS_CORE_Library.S7Net
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send axis command
|
||||
/// </summary>
|
||||
/// <param name="AxisNum">ID asse</param>
|
||||
/// <param name="CommandBit">Comando (0..15)</param>
|
||||
/// <param name="WritePos">Indica se scrivere la TargetPos</param>
|
||||
/// <param name="TargetPos">Posizione target</param>
|
||||
/// <returns></returns>
|
||||
public override CmsError PLC_WAxisCommand(int AxisNum, uint CommandBit, bool WritePos, double TargetPos)
|
||||
{
|
||||
CmsError libraryError = NO_ERROR;
|
||||
|
||||
if (WritePos)
|
||||
{
|
||||
MEMORY_CELL caTgtPos = new MEMORY_CELL(AXES_COMMAND.MemType, AXES_COMMAND.Address, AXES_COMMAND.SubAddress + ((AxisNum - 1) * 8), 2);
|
||||
// in primis scrivo la TargetPos nei 4 byte DWord...
|
||||
libraryError = MEM_RWDouble(W, 0, caTgtPos.MemType, caTgtPos.Address, caTgtPos.SubAddress, ref TargetPos);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
// ...è permesso solo 0..7
|
||||
if (CommandBit >= 0 && CommandBit < 7)
|
||||
{
|
||||
// posizione: è da array assi 0..n-1, 8byte ogni asse
|
||||
MEMORY_CELL currAxAck = new MEMORY_CELL(AXES_COMMAND.MemType, AXES_COMMAND.Address, AXES_COMMAND.SubAddress + ((AxisNum - 1) * 8), 2);
|
||||
MEMORY_CELL currAxStr = new MEMORY_CELL(AXES_COMMAND.MemType, AXES_COMMAND.Address, AXES_COMMAND.SubAddress + ((AxisNum - 1) * 8 + 2), 2);
|
||||
|
||||
// Call confirm update
|
||||
libraryError = PLC_WStrobe(true, currAxAck, currAxStr, CommandBit);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
public override CmsError PLC_WRefreshAllMessages()
|
||||
{
|
||||
// imposto come UserSoftKey
|
||||
|
||||
Reference in New Issue
Block a user