diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index fd797f0..132bcd9 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -829,8 +829,10 @@ namespace CMS_CORE_Library.Demo public override CmsError PLC_WOperatorInputResponse(int process, double responseVal) { + byte approxymatedVal = Convert.ToByte(responseVal >= 255 ? 255 : responseVal); + int procAddress = OPERATOR_INPUT_RESPONSE.Address + process - 1; - return NO_ERROR; + return MEM_RWByte(W, 0, MEMORY_TYPE.Demo, procAddress, 0, ref approxymatedVal); } public override CmsError PLC_RMTConnectData(ref List value) @@ -3103,7 +3105,8 @@ namespace CMS_CORE_Library.Demo internal static MEMORY_CELL COUNTERS_STROBE = new MEMORY_CELL(MEMORY_TYPE.Demo, 3010, 2); internal static MEMORY_CELL OPERATOR_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 450, 1); - internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 451, 1); + internal static MEMORY_CELL OPERATOR_INPUT_RESPONSE = new MEMORY_CELL(MEMORY_TYPE.Demo, 451, 1); + internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 452, 1); } #endregion Memory addresses diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index a1b3129..a63ceea 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -972,39 +972,39 @@ namespace CMS_CORE_Library.Osai return NO_ERROR; } - //Get the process Alarm + // Get the process Alarm public override CmsError PROC_RActiveAlarms(ushort procNumber, ref List alarms) { - //Check if the NC is Connected + // Check if the NC is Connected CmsError cmsError = CheckConnection(); if (cmsError.IsError()) return cmsError; ushort nReturn; - //Try to get information + // Try to get information try { - //Clear the OLD Message + // Clear the OLD Message alarms.Clear(); - //Execute the method + // Execute the method nReturn = OpenNC.ReadCurrentErrorMsg(procNumber, out MSGERROR err, out uint errorClass, out uint errorNum); - //If there's an error launch exception + // If there's an error launch exception if (errorClass != 0 || errorNum != 0 || nReturn == 0) return GetNCError(errorClass, errorNum); - //If there's an error + // If there's an error if (err.CodeErr != 0) { - //Create a CNDEX style error + // Create a CNDEX style error Cndex.MSG_ERROR CndexError = ConverToCndexMessage(err); MESSAGE_TEXT Message = new MESSAGE_TEXT(); - //Translate using OSAI .DLL (a new one!) + // Translate using OSAI .DLL (a new one!) OSAIErrorManagerLibrary.TranslateErrorMsg(ref CndexError, ref Message); - //Build the new String Message + // Build the new String Message AddAlarmToList((uint)CndexError.Code_Err, OsaiToStepMessage(Message), procNumber, alarms); } } @@ -1016,10 +1016,10 @@ namespace CMS_CORE_Library.Osai return NO_ERROR; } - //Get PP Lines + // Get PP Lines public override CmsError PROC_RPPLines(ushort ProcNumber, ref List Lines) { - //Check if the NC is Connected + // Check if the NC is Connected CmsError cmsError = CheckConnection(); if (cmsError.IsError()) return cmsError; @@ -1033,20 +1033,20 @@ namespace CMS_CORE_Library.Osai string L7 = ""; string L8 = ""; - //Try to get information + // Try to get information try { - //Execute the method + // Execute the method nReturn = OpenNC.GetPartProgramLines(ProcNumber, out L1, out L2, out L3, out L4, out L5, out L6, out L7, out L8, out uint errorClass, out uint errorNum); - //If there's an error launch exception + // If there's an error launch exception if (errorClass != 0 || errorNum != 0 || nReturn == 0) return GetNCError(errorClass, errorNum); - //Clear All Values + // Clear All Values Lines.Clear(); - //Build the new Lines + // Build the new Lines Lines.Add(L1); Lines.Add(L2); Lines.Add(L3);