From 575be5d88b8709cd4bafb897f8ea70caee0f3dd1 Mon Sep 17 00:00:00 2001 From: babayaga Date: Thu, 24 Apr 2025 18:38:03 +0200 Subject: [PATCH] tests:each image to cpp --- packages/kbot/tests/pdf/omron/convert.md | 21 + packages/kbot/tests/pdf/omron/convert.sh | 7 + packages/kbot/tests/pdf/omron/omron.h | 2094 ++++++++++++++++++++++ packages/kbot/tests/pdf/omron/prompt.md | 16 - 4 files changed, 2122 insertions(+), 16 deletions(-) create mode 100644 packages/kbot/tests/pdf/omron/convert.md create mode 100644 packages/kbot/tests/pdf/omron/convert.sh create mode 100644 packages/kbot/tests/pdf/omron/omron.h delete mode 100644 packages/kbot/tests/pdf/omron/prompt.md diff --git a/packages/kbot/tests/pdf/omron/convert.md b/packages/kbot/tests/pdf/omron/convert.md new file mode 100644 index 00000000..1adca29e --- /dev/null +++ b/packages/kbot/tests/pdf/omron/convert.md @@ -0,0 +1,21 @@ +Create or merge enums for found Modbus registers, for C++. Always prefix enum values with 'E_', all in capital, comment if possible (ranges, defaults) + +example: + +enum OR_E5_STATUS_1 +{ + // Lower Word + + OR_E5_S1_Heater_OverCurrent = 0, + OR_E5_S1_Heater_CurrentHold = 1, + OR_E5_S1_AD_ConverterError = 2, +} + +enum OR_E5_SWR +{ + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit ‚àí 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV = 0x2000, +} + +A file been provided with the existing enums. \ No newline at end of file diff --git a/packages/kbot/tests/pdf/omron/convert.sh b/packages/kbot/tests/pdf/omron/convert.sh new file mode 100644 index 00000000..4a07f1d4 --- /dev/null +++ b/packages/kbot/tests/pdf/omron/convert.sh @@ -0,0 +1,7 @@ +kbot-d --router2=openai --model=google/gemini-2.5-pro-preview-03-25 \ + --prompt=./tests/pdf/omron/convert.md \ + --each=./tests/pdf/omron/*.jpg \ + --include=./tests/pdf/omron/omron.h \ + --mode=completion --preferences=none \ + --dst=./tests/pdf/omron/omron.h \ + --filters=code --append=concat diff --git a/packages/kbot/tests/pdf/omron/omron.h b/packages/kbot/tests/pdf/omron/omron.h new file mode 100644 index 00000000..fdbe23ce --- /dev/null +++ b/packages/kbot/tests/pdf/omron/omron.h @@ -0,0 +1,2094 @@ +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register via Modbus. +enum class E5C_CommandCode : uint16_t +{ + CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + RunStop = 0x01, // Starts or stops control operation + MultiSP = 0x02, // Selects the target Set Point (SP) number + ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: 0x00) + SoftwareReset = 0x06, // Performs a software reset (Related Info: 0x00) + MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: 0x00) + MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: 0x00) + AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: 0x00) + AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values for specific commands. + +// Parameters for E5C_CommandCode::CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + OffDisabled = 0x00, + OnEnabled = 0x01, +}; + +// Parameters for E5C_CommandCode::RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + Run = 0x00, + Stop = 0x01, +}; + +// Parameters for E5C_CommandCode::MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + SetPoint0 = 0x00, + SetPoint1 = 0x01, + SetPoint2 = 0x02, + SetPoint3 = 0x03, + SetPoint4 = 0x04, + SetPoint5 = 0x05, + SetPoint6 = 0x06, + SetPoint7 = 0x07, +}; + +// Parameters for E5C_CommandCode::ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + ATCancel = 0x00, // Cancel Auto-Tuning + ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E5C_CommandCode::WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + Backup = 0x00, // Writes are backed up to non-volatile memory + RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E5C_CommandCode::AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + AutomaticMode = 0x00, + ManualMode = 0x01, +}; + +// Parameters for E5C_CommandCode::AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + Alarm1LatchCancel = 0x00, + Alarm2LatchCancel = 0x01, + Alarm3LatchCancel = 0x02, + HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + HSAlarmLatchCancel = 0x04, // (?) Assuming Heater Short or similar based on HB + Alarm4LatchCancel = 0x05, // Assuming relates to Alarm 4 based on pattern + AllAlarmLatchCancel= 0x0F, // Cancel all latched alarms +}; + +// Parameters for E5C_CommandCode::SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + LocalSPMode = 0x00, + RemoteSPMode = 0x01, +}; + +// Parameters for E5C_CommandCode::InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + NotInvert = 0x00, // Direct operation + Invert = 0x01, // Reverse operation +}; + +// Parameters for E5C_CommandCode::ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + Reset = 0x00, // Reset the program/pattern + Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E5C_CommandCode::SaveRAMData +// - E5C_CommandCode::SoftwareReset +// - E5C_CommandCode::MoveToSetupArea1 +// - E5C_CommandCode::MoveToProtectLevel +// - E5C_CommandCode::ParameterInitialization + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register via Modbus. +enum class E5C_CommandCode : uint16_t +{ + CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + RunStop = 0x01, // Starts or stops control operation + MultiSP = 0x02, // Selects the target Set Point (SP) number + ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: 0x00) + SoftwareReset = 0x06, // Performs a software reset (Related Info: 0x00) + MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: 0x00) + MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: 0x00) + AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: 0x00) + AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values for specific commands. + +// Parameters for E5C_CommandCode::CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + OffDisabled = 0x00, + OnEnabled = 0x01, +}; + +// Parameters for E5C_CommandCode::RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + Run = 0x00, + Stop = 0x01, +}; + +// Parameters for E5C_CommandCode::MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + SetPoint0 = 0x00, + SetPoint1 = 0x01, + SetPoint2 = 0x02, + SetPoint3 = 0x03, + SetPoint4 = 0x04, + SetPoint5 = 0x05, + SetPoint6 = 0x06, + SetPoint7 = 0x07, +}; + +// Parameters for E5C_CommandCode::ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + ATCancel = 0x00, // Cancel Auto-Tuning + ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E5C_CommandCode::WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + Backup = 0x00, // Writes are backed up to non-volatile memory + RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E5C_CommandCode::AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + AutomaticMode = 0x00, + ManualMode = 0x01, +}; + +// Parameters for E5C_CommandCode::AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + Alarm1LatchCancel = 0x00, + Alarm2LatchCancel = 0x01, + Alarm3LatchCancel = 0x02, + HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + HSAlarmLatchCancel = 0x04, // (?) Assuming Heater Short or similar based on HB + Alarm4LatchCancel = 0x05, // Assuming relates to Alarm 4 based on pattern + AllAlarmLatchCancel= 0x0F, // Cancel all latched alarms +}; + +// Parameters for E5C_CommandCode::SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + LocalSPMode = 0x00, + RemoteSPMode = 0x01, +}; + +// Parameters for E5C_CommandCode::InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + NotInvert = 0x00, // Direct operation + Invert = 0x01, // Reverse operation +}; + +// Parameters for E5C_CommandCode::ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + Reset = 0x00, // Reset the program/pattern + Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E5C_CommandCode::SaveRAMData +// - E5C_CommandCode::SoftwareReset +// - E5C_CommandCode::MoveToSetupArea1 +// - E5C_CommandCode::MoveToProtectLevel +// - E5C_CommandCode::ParameterInitialization + + +// --- E5C Modbus Variable Area Registers (Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values +// as listed in the "Variable Area (Setting Range) List". +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Parameters (Addresses 0x2000 - 0x20FF approx.) --- + PV = 0x2000, // Process Value + Status1 = 0x2001, // Status 1 (Bitfield, see manual section 5-2 for details. Note *1, *2 apply) + InternalSetPoint = 0x2002, // Internal Set Point (Note *1 applies) + HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (0.0 to 55.0 A) + MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (%: -5.0 to 105.0 or 0.0 to 105.0) + MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (%: 0.0 to 105.0) + + // --- Setting Parameters (Addresses 0x2100 - 0x21FF approx.) --- + SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable) + AlarmValue1 = 0x2104, // Alarm Value 1 (-1999 to 9999) + AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (-1999 to 9999) + AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (-1999 to 9999) + AlarmValue2 = 0x2107, // Alarm Value 2 (-1999 to 9999) + AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (-1999 to 9999) + AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (-1999 to 9999) + // Add other registers from 0x21xx range if needed from other tables + + // --- Status/Monitor Parameters (Addresses 0x2400 - 0x24FF approx.) --- + PV_StatusArea = 0x2402, // Process Value (Likely read-only status copy) + InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Likely read-only status copy, Note *1) + MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7) + Status1_StatusArea = 0x2406, // Status 1 (Likely read-only status copy, Note *1, *2 apply) + Status_Word3 = 0x2407, // Status Word 3/Leftmost bits (Part of a larger status? Note *3 applies) + Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Note *1, *2 apply) + Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Note *1, *3 apply) + DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3) + // Add other registers from 0x24xx range if needed +}; + +// Note on Status Registers: +// The Status registers (0x2001, 0x2406, 0x2407, 0x2408, 0x2409) are bitfields. +// Refer to the E5C Communications Manual Section 5-2 "Status" for details on individual bit meanings. +// Note *1: Not displayed on the Controller display. +// Note *2: In 2-byte mode, the rightmost 16 bits are read. +// Note *3: In 2-byte mode, the leftmost 16 bits are read. +// This suggests Status 2 (0x2408/0x2409) and potentially Status 1 (0x2001/0x2406) and Status_Word3 (0x2407) +// might be parts of larger 32-bit status values when read in 4-byte mode. + + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register (often 0x0000) via Modbus. +enum class E5C_CommandCode : uint16_t +{ + E_CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + E_RunStop = 0x01, // Starts or stops control operation + E_MultiSP = 0x02, // Selects the target Set Point (SP) number + E_ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + E_WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + E_SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: 0x00) + E_SoftwareReset = 0x06, // Performs a software reset (Related Info: 0x00) + E_MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: 0x00) + E_MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: 0x00) + E_AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + E_ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: 0x00) + E_AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + E_SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + E_InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + E_ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values (data) sent with specific commands. + +// Parameters for E_CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + E_OffDisabled = 0x00, + E_OnEnabled = 0x01, +}; + +// Parameters for E_RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + E_Run = 0x00, + E_Stop = 0x01, +}; + +// Parameters for E_MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + E_SetPoint0 = 0x00, + E_SetPoint1 = 0x01, + E_SetPoint2 = 0x02, + E_SetPoint3 = 0x03, + E_SetPoint4 = 0x04, + E_SetPoint5 = 0x05, + E_SetPoint6 = 0x06, + E_SetPoint7 = 0x07, +}; + +// Parameters for E_ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + E_ATCancel = 0x00, // Cancel Auto-Tuning + E_ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + E_ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E_WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + E_Backup = 0x00, // Writes are backed up to non-volatile memory + E_RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E_AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + E_AutomaticMode = 0x00, + E_ManualMode = 0x01, +}; + +// Parameters for E_AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + E_Alarm1LatchCancel = 0x00, + E_Alarm2LatchCancel = 0x01, + E_Alarm3LatchCancel = 0x02, + E_HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + E_HSAlarmLatchCancel = 0x04, // (?) Assuming Heater Short or similar based on HB + E_Alarm4LatchCancel = 0x05, // Assuming relates to Alarm 4 based on pattern + E_AllAlarmLatchCancel= 0x0F, // Cancel all latched alarms +}; + +// Parameters for E_SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + E_LocalSPMode = 0x00, + E_RemoteSPMode = 0x01, +}; + +// Parameters for E_InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + E_NotInvert = 0x00, // Direct operation + E_Invert = 0x01, // Reverse operation +}; + +// Parameters for E_ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + E_Reset = 0x00, // Reset the program/pattern + E_Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E_SaveRAMData +// - E_SoftwareReset +// - E_MoveToSetupArea1 +// - E_MoveToProtectLevel (Command, not the register 0x2504) +// - E_ParameterInitialization + +// --- E5C Modbus Variable Area Registers (Holding Registers - Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values. +// Based on the "Variable Area (Setting Range) List" sections of the Communications Manual (H175). +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Parameters (Addresses ~0x2000 - 0x20FF) --- + E_PV = 0x2000, // Process Value (Read-Only) + E_Status1 = 0x2001, // Status 1 (Bitfield, Read-Only, see manual section 5-2. Note *1, *2 apply) + E_InternalSetPoint = 0x2002, // Internal Set Point (Read-Only? Note *1 applies) + E_HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) + E_MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) + E_MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (Read-Only, %: 0.0 to 105.0) + + // --- Setting Parameters (Addresses ~0x2100 - 0x21FF) --- + E_SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable, Primary SP setting) + E_AlarmValue1 = 0x2104, // Alarm Value 1 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (Writable, -1999 to 9999) + E_AlarmValue2 = 0x2107, // Alarm Value 2 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (Writable, -1999 to 9999) + // Add other registers from 0x21xx range if needed from other tables + + // --- Protect Level Parameters (Addresses ~0x2500 - 0x25FF, Ref Manual Page 5-3) --- + E_OperationAdjustmentProtect = 0x2500, // Sets Operation/Adjustment Protection Level (See E5C_OperationProtect_Param) + E_InitialSettingCommsProtect = 0x2501, // Sets Initial Setting/Communications Protection Level (See E5C_InitialProtect_Param) + E_SettingChangeProtect = 0x2502, // Enable/Disable Setting Change Protect via front panel (See E5C_SettingChangeProtect_Param) + E_PF_KeyProtect = 0x2503, // Enable/Disable PF Key Protect (See E5C_PFKeyProtect_Param) + E_MoveToProtectLevelSetting = 0x2504, // Sets the password value needed to move to protect level (Writable, -1999 to 9999 or FFFF831 to 270F) + E_PasswordToMoveToProtectLevel = 0x2505, // Write the password here to attempt moving to the protect level (Write-Only? HFFFF831 to H0000270F / -1999 to 9999) (Monitor value always 0) + E_ParameterMaskEnable = 0x2506, // Enable/Disable Parameter Mask (See E5C_ParamMaskEnable_Param) (Monitor value always 0) + E_ChangedParametersOnly = 0x2507, // Control Change Parameters setting (See E5C_ChangedParamsOnly_Param) + + // --- Manual Control / Operation Level Parameters (Addresses ~0x2600 - 0x26FF, Ref Manual Page 5-3) --- + E_ManualMV = 0x2600, // Manual Manipulated Value (Writable in Manual Mode) (%: Ranges vary by model/setting) + E_SetPoint_OperationLevel = 0x2601, // Set Point visible/settable in Operation Level (Writable, Range: SP lower to SP upper limit) (Potentially same as 0x2103?) + E_RemoteSPMonitor = 0x2602, // Remote SP Monitor (Read-Only, Range: Remote SP lower limit -10% FS to Remote SP upper limit +10% FS) + E_HeaterCurrent1ValueMonitor_OpLevel = 0x2604, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) (Likely same value as 0x2003) + E_MVMonitorHeating_OpLevel = 0x2605, // MV Monitor (Heating) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) (Likely same value as 0x2004) + E_MVMonitorCooling_OpLevel = 0x2606, // MV Monitor (Cooling) (Read-Only, %: 0.0 to 105.0) (Likely same value as 0x2005) + E_ValveOpeningMonitor = 0x2607, // Valve Opening Monitor (Read-Only, %: -10.0 to 110.0) + + // --- Status/Monitor Parameters (Addresses ~0x2400 - 0x24FF) --- + E_PV_StatusArea = 0x2402, // Process Value (Read-Only status copy) + E_InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Read-Only status copy, Note *1) + E_MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7, Read-Only) + E_Status1_StatusArea = 0x2406, // Status 1 (Read-Only status copy, Bitfield, Note *1, *2 apply) + E_StatusWord3_Leftmost = 0x2407, // Status Word 3 / Leftmost bits (Part of a larger status? Read-Only, Note *3 applies) + E_Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Read-Only, Bitfield, Note *1, *2 apply) + E_Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Read-Only, Bitfield, Note *1, *3 apply) + E_DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3, Read-Only) + // Add other registers from 0x24xx range if needed + + // NOTE on Status Registers (e.g., E_Status1, E_Status2_LowerWord, E_Status2_UpperWord): + // These are bitfields. Refer to the E5C Communications Manual Section 5-2 "Status" + // for details on individual bit meanings. + // Note *1: Not displayed on the Controller display. + // Note *2: In 2-byte mode, the rightmost 16 bits are usually read. + // Note *3: In 2-byte mode, the leftmost 16 bits are usually read. + // This suggests Status 2 (0x2408/0x2409) and StatusWord3 (0x2407) might be parts + // of larger 32-bit status values if the controller supported 4-byte mode reads. +}; + +// --- Parameter Enums for Specific Holding Register Settings (from Page 5-3) --- + +// Parameters for E_OperationAdjustmentProtect (0x2500) +enum class E5C_OperationProtect_Param : uint16_t +{ + E_NoRestrictions = 0x00, // No restrictions in operation and adjustment levels + E_AdjustLevelProhibited = 0x01, // Move to adjustment level is prohibited + E_DisplayChangePV_PVSP = 0x02, // Display and change of only "PV" and "PV/SP" parameters is allowed + E_DisplayOnlyPV_PVSP = 0x03, // Display of only "PV" and "PV/SP" parameters is allowed +}; + +// Parameters for E_InitialSettingCommsProtect (0x2501) +enum class E5C_InitialProtect_Param : uint16_t +{ + E_MoveToInitialAllowedAdvDisplayed = 0x00, // Move to initial setting/communications setting level is allowed. (Move to advanced function setting level is displayed.) + E_MoveToInitialAllowedAdvNotDisplayed= 0x01, // Move to initial setting/communications setting level is allowed. (Move to advanced function setting level is not displayed.) + E_MoveToInitialProhibited = 0x02, // Move to initial setting/communications setting level is prohibited. +}; + +// Parameters for E_SettingChangeProtect (0x2502) +enum class E5C_SettingChangeProtect_Param : uint16_t +{ + E_OffChangeAllowed = 0x00, // OFF (Changing of setup on controller display is allowed.) + E_OnChangeProhibited = 0x01, // ON (Changing of setup on controller display is prohibited.) +}; + +// Parameters for E_PF_KeyProtect (0x2503) +enum class E5C_PFKeyProtect_Param : uint16_t +{ + E_Off = 0x00, + E_On = 0x01, +}; + +// Parameters for E_ParameterMaskEnable (0x2506) +enum class E5C_ParamMaskEnable_Param : uint16_t +{ + E_Off = 0x00, + E_On = 0x01, +}; + +// Parameters for E_ChangedParametersOnly (0x2507) +enum class E5C_ChangedParamsOnly_Param : uint16_t +{ + E_Off = 0x00, // Standard control? Check Manual + E_On = 0x01, +}; + + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register (often 0x0000) via Modbus. +enum class E5C_CommandCode : uint16_t +{ + E_CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + E_RunStop = 0x01, // Starts or stops control operation + E_MultiSP = 0x02, // Selects the target Set Point (SP) number + E_ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + E_WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + E_SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: 0x00) + E_SoftwareReset = 0x06, // Performs a software reset (Related Info: 0x00) + E_MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: 0x00) + E_MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: 0x00) + E_AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + E_ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: 0x00) + E_AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + E_SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + E_InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + E_ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values (data) sent with specific commands. + +// Parameters for E_CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + E_OffDisabled = 0x00, + E_OnEnabled = 0x01, +}; + +// Parameters for E_RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + E_Run = 0x00, + E_Stop = 0x01, +}; + +// Parameters for E_MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + E_SetPoint0 = 0x00, + E_SetPoint1 = 0x01, + E_SetPoint2 = 0x02, + E_SetPoint3 = 0x03, + E_SetPoint4 = 0x04, + E_SetPoint5 = 0x05, + E_SetPoint6 = 0x06, + E_SetPoint7 = 0x07, +}; + +// Parameters for E_ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + E_ATCancel = 0x00, // Cancel Auto-Tuning + E_ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + E_ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E_WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + E_Backup = 0x00, // Writes are backed up to non-volatile memory + E_RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E_AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + E_AutomaticMode = 0x00, + E_ManualMode = 0x01, +}; + +// Parameters for E_AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + E_Alarm1LatchCancel = 0x00, + E_Alarm2LatchCancel = 0x01, + E_Alarm3LatchCancel = 0x02, + E_HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + E_HSAlarmLatchCancel = 0x04, // Heater Short alarm latch cancel (?) + E_Alarm4LatchCancel = 0x05, // Alarm 4 latch cancel (?) + E_AllAlarmLatchCancel = 0x0F, // Cancel all latched alarms +}; + +// Parameters for E_SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + E_LocalSPMode = 0x00, + E_RemoteSPMode = 0x01, +}; + +// Parameters for E_InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + E_NotInvert = 0x00, // Direct operation + E_Invert = 0x01, // Reverse operation +}; + +// Parameters for E_ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + E_Reset = 0x00, // Reset the program/pattern + E_Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E_SaveRAMData +// - E_SoftwareReset +// - E_MoveToSetupArea1 +// - E_MoveToProtectLevel (Command, not the register 0x2504) +// - E_ParameterInitialization + +// --- E5C Modbus Variable Area Registers (Holding Registers - Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values. +// Based on the "Variable Area (Setting Range) List" sections of the Communications Manual (H175). +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Parameters (Addresses ~0x2000 - 0x20FF) --- + E_PV = 0x2000, // Process Value (Read-Only) + E_Status1 = 0x2001, // Status 1 (Bitfield, Read-Only, see manual section 5-2. Note *1, *2 apply) + E_InternalSetPoint = 0x2002, // Internal Set Point (Read-Only? Note *1 applies) + E_HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) + E_MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) + E_MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (Read-Only, %: 0.0 to 105.0) + + // --- Setting Parameters (Addresses ~0x2100 - 0x21FF) --- + E_SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable, Primary SP setting) + E_AlarmValue1 = 0x2104, // Alarm Value 1 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (Writable, -1999 to 9999) + E_AlarmValue2 = 0x2107, // Alarm Value 2 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (Writable, -1999 to 9999) + // Add other registers from 0x21xx range if needed from other tables + + // --- Status/Monitor Parameters (Addresses ~0x2400 - 0x24FF) --- + E_PV_StatusArea = 0x2402, // Process Value (Read-Only status copy) + E_InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Read-Only status copy, Note *1) + E_MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7, Read-Only) + E_Status1_StatusArea = 0x2406, // Status 1 (Read-Only status copy, Bitfield, Note *1, *2 apply) + E_StatusWord3_Leftmost = 0x2407, // Status Word 3 / Leftmost bits (Part of a larger status? Read-Only, Note *3 applies) + E_Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Read-Only, Bitfield, Note *1, *2 apply) + E_Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Read-Only, Bitfield, Note *1, *3 apply) + E_DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3, Read-Only) + // Add other registers from 0x24xx range if needed + + // --- Protect Level Parameters (Addresses ~0x2500 - 0x25FF, Ref Manual Page 5-3) --- + E_OperationAdjustmentProtect = 0x2500, // Sets Operation/Adjustment Protection Level (See E5C_OperationProtect_Param) + E_InitialSettingCommsProtect = 0x2501, // Sets Initial Setting/Communications Protection Level (See E5C_InitialProtect_Param) + E_SettingChangeProtect = 0x2502, // Enable/Disable Setting Change Protect via front panel (See E5C_SettingChangeProtect_Param) + E_PF_KeyProtect = 0x2503, // Enable/Disable PF Key Protect (See E5C_PFKeyProtect_Param) + E_MoveToProtectLevelSetting = 0x2504, // Sets the password value needed to move to protect level (Writable, -1999 to 9999 or FFFF831 to 270F) + E_PasswordToMoveToProtectLevel = 0x2505, // Write the password here to attempt moving to the protect level (Write-Only? Monitor value always 0) + E_ParameterMaskEnable = 0x2506, // Enable/Disable Parameter Mask (See E5C_ParamMaskEnable_Param) (Monitor value always 0) + E_ChangedParametersOnly = 0x2507, // Control Change Parameters setting (See E5C_ChangedParamsOnly_Param) + + // --- Manual Control / Operation Level Parameters (Addresses ~0x2600 - 0x26FF, Ref Manual Page 5-3) --- + E_ManualMV = 0x2600, // Manual Manipulated Value (Writable in Manual Mode) (%: Ranges vary by model/setting) + E_SetPoint_OperationLevel = 0x2601, // Set Point visible/settable in Operation Level (Writable, Range: SP lower to SP upper limit) (Potentially same as 0x2103?) + E_RemoteSPMonitor = 0x2602, // Remote SP Monitor (Read-Only, Range: Remote SP lower limit +/-10% FS) + E_HeaterCurrent1ValueMonitor_OpLevel = 0x2604, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) (Likely same value as 0x2003) + E_MVMonitorHeating_OpLevel = 0x2605, // MV Monitor (Heating) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) (Likely same value as 0x2004) + E_MVMonitorCooling_OpLevel = 0x2606, // MV Monitor (Cooling) (Read-Only, %: 0.0 to 105.0) (Likely same value as 0x2005) + E_ValveOpeningMonitor = 0x2607, // Valve Opening Monitor (Read-Only, %: -10.0 to 110.0) + + // --- Adjustment Level / PID / Control Parameters (Addresses ~0x2700 - 0x27FF approx. from page 5-4) --- + E_ProportionalBandCooling = 0x2701, // Proportional Band (Cooling) (Writable, 0.1 to 999.9) [Adjustment Level] + E_IntegralTimeCooling = 0x2702, // Integral Time (Cooling) (Writable, 0 to 9999 s / 0.0 to 999.9 s depending on derivative unit) [Adjustment Level] + E_DerivativeTimeCooling = 0x2703, // Derivative Time (Cooling) (Writable, Same range as Integral) [Adjustment Level] + E_DeadBand = 0x2704, // Dead Band (Writable, -199.9 to 999.9 for temp input / -19.99 to 99.99 for analog input) [Adjustment Level] + E_ManualResetValue = 0x2705, // Manual Reset Value (Writable, 0.0 to 100.0) [Adjustment Level] + E_HysteresisHeating = 0x2706, // Hysteresis (Heating) (Writable, 0.1 to 999.9 for temp input / 0.01 to 99.99 for analog input) [Adjustment Level] + E_HysteresisCooling = 0x2707, // Hysteresis (Cooling) (Writable, Same range as Heating) [Adjustment Level] + E_ControlPeriodHeating = 0x2708, // Control Period (Heating) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_ControlPeriodCooling = 0x2709, // Control Period (Cooling) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_PositionPropDeadBand = 0x270A, // Position Proportional Dead Band (Writable, 0.1 to 10.0) [Adjustment Level] + E_OpenCloseHysteresis = 0x270B, // Open/Close Hysteresis (Writable, 0.1 to 20.0) [Adjustment Level] + E_SPRampTimeUnit = 0x270C, // SP Ramp Time Unit (Writable) [Advanced Function Setting Level] (See E5C_SPRampTimeUnit_Param) + E_SPRampSetValue = 0x270D, // SP Ramp Set Value (Writable, 0=OFF or 1 to 9999 in units from 0x270C) [Adjustment Level] (See E5C_SPRampSetValue_SpecialVal) + E_SPRampFallValue = 0x270E, // SP Ramp Fall Value (Writable, -1=Same as Set, 0=OFF or 1 to 9999) [Adjustment Level] (See E5C_SPRampFallValue_SpecialVal) + E_MVAtStop = 0x270F, // MV (%) at Stop (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVAtPVError = 0x2711, // MV (%) at PV Error (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVChangeRateLimit = 0x2713, // MV Change Rate Limit (Writable, 0.0=OFF or 0.1 to 100.0 %/s) [Advanced Function Setting Level] + E_PVInputSlopeCoeff = 0x2718, // PV Input Slope Coefficient (Writable, 0.001 to 9.999) [Advanced Function Setting Level] + E_HeaterCurrent1ValueMonitor_Adv = 0x271A, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level - Seems redundant, matches 0x2003/0x2604] + E_HeaterBurnoutDetection1 = 0x271B, // Heater Burnout Detection 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent1Monitor = 0x271C, // Leakage Current 1 Monitor (Read-Only, 0.0 to 55.0? Units not specified, likely mA) [Operation Level] + E_HSAlarm1 = 0x271D, // HS (Heater Short?) Alarm 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_ProcessValueInputShift = 0x2723, // Process Value Input Shift (Writable, -1999 to 9999) [Adjustment Level] + E_HeaterCurrent2ValueMonitor = 0x2724, // Heater Current 2 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level] + + // NOTE on Status Registers (e.g., E_Status1, E_Status2_LowerWord, E_Status2_UpperWord): + // These are bitfields. Refer to the E5C Communications Manual Section 5-2 "Status" + // for details on individual bit meanings. Explicit enums for these bits can be added if needed. + // Note *1: Not displayed on the Controller display. + // Note *2: In 2-byte mode, the rightmost 16 bits are usually read. + // Note *3: In 2-byte mode, the leftmost 16 bits are usually read. + // This suggests Status 2 (E_Status2_LowerWord/E_Status2_UpperWord) and potentially StatusWord3 (E_StatusWord3_Leftmost) + // might be parts of larger 32-bit status values if the controller supported 4-byte mode reads. +}; + +// --- Parameter Enums for Specific Holding Register Settings --- + +// Parameters for E_OperationAdjustmentProtect (0x2500) +enum class E5C_OperationProtect_Param : uint16_t +{ + E_NoRestrictions = 0x00, // No restrictions in operation and adjustment levels + E_AdjustLevelProhibited = 0x01, // Move to adjustment level is prohibited + E_DisplayChangePV_PVSP = 0x02, // Display and change of only "PV" and "PV/SP" allowed + E_DisplayOnlyPV_PVSP = 0x03, // Display of only "PV" and "PV/SP" allowed +}; + +// Parameters for E_InitialSettingCommsProtect (0x2501) +enum class E5C_InitialProtect_Param : uint16_t +{ + E_MoveToInitialAllowedAdvDisplayed = 0x00, // Move to initial/comms allowed. Adv func displayed. + E_MoveToInitialAllowedAdvNotDisplayed= 0x01, // Move to initial/comms allowed. Adv func not displayed. + E_MoveToInitialProhibited = 0x02, // Move to initial/comms prohibited. +}; + +// Parameters for E_SettingChangeProtect (0x2502) +enum class E5C_SettingChangeProtect_Param : uint16_t +{ + E_OffChangeAllowed = 0x00, // OFF (Changing settings via front panel allowed) + E_OnChangeProhibited = 0x01, // ON (Changing settings via front panel prohibited) +}; + +// Parameters for E_PF_KeyProtect (0x2503) +enum class E5C_PFKeyProtect_Param : uint16_t +{ + E_Off = 0x00, // PF Key Protection OFF + E_On = 0x01, // PF Key Protection ON +}; + +// Parameters for E_ParameterMaskEnable (0x2506) +enum class E5C_ParamMaskEnable_Param : uint16_t +{ + E_Off = 0x00, // Parameter Mask function OFF + E_On = 0x01, // Parameter Mask function ON +}; + +// Parameters for E_ChangedParametersOnly (0x2507) +enum class E5C_ChangedParamsOnly_Param : uint16_t +{ + E_Off = 0x00, // Display all parameters in adjustment level etc. + E_On = 0x01, // Display only parameters changed from default in adjustment level etc. +}; + + +// --- Special Values / Parameter Enums for specific registers from page 5-4 --- + +// Special values for E_ControlPeriodHeating (0x2708) and E_ControlPeriodCooling (0x2709) +// Note: Positive values 1 to 99 represent seconds directly. Use raw integers for those. +enum class E5C_ControlPeriod_SpecialVal : int16_t // Use signed type for negative values +{ + E_Period_0_1_Sec = -2, // Represents 0.1 seconds + E_Period_0_2_Sec = -1, // Represents 0.2 seconds + E_Period_0_5_Sec = 0, // Represents 0.5 seconds + // Values 1..99 are direct seconds, do not add them here. Must be written as int16_t. +}; + +// Parameters for E_SPRampTimeUnit (0x270C) +enum class E5C_SPRampTimeUnit_Param : uint16_t +{ + E_EU_Per_Second = 0, // Unit is Engineering Unit / second + E_EU_Per_Minute = 1, // Unit is Engineering Unit / minute + E_EU_Per_Hour = 2, // Unit is Engineering Unit / hour +}; + +// Special value for E_SPRampSetValue (0x270D) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampSetValue_SpecialVal : uint16_t +{ + E_Off = 0, // SP Ramp Set is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as uint16_t. +}; + +// Special values for E_SPRampFallValue (0x270E) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampFallValue_SpecialVal : int16_t // Use signed type for negative value +{ + E_SameAsSet = -1, // Fall rate is same as Set rate (defined by 0x270D) + E_Off = 0, // SP Ramp Fall is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as int16_t. +}; + + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register (often 0x0000) via Modbus. +enum class E5C_CommandCode : uint16_t +{ + E_CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + E_RunStop = 0x01, // Starts or stops control operation + E_MultiSP = 0x02, // Selects the target Set Point (SP) number + E_ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + E_WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + E_SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: 0x00) + E_SoftwareReset = 0x06, // Performs a software reset (Related Info: 0x00) + E_MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: 0x00) + E_MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: 0x00) + E_AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + E_ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: 0x00) + E_AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + E_SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + E_InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + E_ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values (data) sent with specific commands. + +// Parameters for E_CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + E_OffDisabled = 0x00, + E_OnEnabled = 0x01, +}; + +// Parameters for E_RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + E_Run = 0x00, + E_Stop = 0x01, +}; + +// Parameters for E_MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + E_SetPoint0 = 0x00, + E_SetPoint1 = 0x01, + E_SetPoint2 = 0x02, + E_SetPoint3 = 0x03, + E_SetPoint4 = 0x04, + E_SetPoint5 = 0x05, + E_SetPoint6 = 0x06, + E_SetPoint7 = 0x07, +}; + +// Parameters for E_ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + E_ATCancel = 0x00, // Cancel Auto-Tuning + E_ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + E_ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E_WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + E_Backup = 0x00, // Writes are backed up to non-volatile memory + E_RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E_AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + E_AutomaticMode = 0x00, + E_ManualMode = 0x01, +}; + +// Parameters for E_AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + E_Alarm1LatchCancel = 0x00, + E_Alarm2LatchCancel = 0x01, + E_Alarm3LatchCancel = 0x02, + E_HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + E_HSAlarmLatchCancel = 0x04, // Heater Short alarm latch cancel (?) + E_Alarm4LatchCancel = 0x05, // Alarm 4 latch cancel (?) + E_AllAlarmLatchCancel = 0x0F, // Cancel all latched alarms +}; + +// Parameters for E_SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + E_LocalSPMode = 0x00, + E_RemoteSPMode = 0x01, +}; + +// Parameters for E_InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + E_NotInvert = 0x00, // Direct operation + E_Invert = 0x01, // Reverse operation +}; + +// Parameters for E_ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + E_Reset = 0x00, // Reset the program/pattern + E_Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E_SaveRAMData +// - E_SoftwareReset +// - E_MoveToSetupArea1 +// - E_MoveToProtectLevel (Command, not the register 0x2504) +// - E_ParameterInitialization + +// --- E5C Modbus Variable Area Registers (Holding Registers - Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values. +// Based on the "Variable Area (Setting Range) List" sections of the Communications Manual (H175). +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Parameters (Addresses ~0x2000 - 0x20FF) --- + E_PV = 0x2000, // Process Value (Read-Only) + E_Status1 = 0x2001, // Status 1 (Bitfield, Read-Only, see manual section 5-2. Note *1, *2 apply) + E_InternalSetPoint = 0x2002, // Internal Set Point (Read-Only? Note *1 applies) + E_HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) + E_MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) + E_MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (Read-Only, %: 0.0 to 105.0) + + // --- Setting Parameters (Addresses ~0x2100 - 0x21FF) --- + E_SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable, Primary SP setting) + E_AlarmValue1 = 0x2104, // Alarm Value 1 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (Writable, -1999 to 9999) + E_AlarmValue2 = 0x2107, // Alarm Value 2 (Writable, -1999 to 9999) + E_AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (Writable, -1999 to 9999) + E_AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (Writable, -1999 to 9999) + // Add other registers from 0x21xx range if needed from other tables + + // --- Status/Monitor Parameters (Addresses ~0x2400 - 0x24FF) --- + E_PV_StatusArea = 0x2402, // Process Value (Read-Only status copy) + E_InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Read-Only status copy, Note *1) + E_MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7, Read-Only) + E_Status1_StatusArea = 0x2406, // Status 1 (Read-Only status copy, Bitfield, Note *1, *2 apply) + E_StatusWord3_Leftmost = 0x2407, // Status Word 3 / Leftmost bits (Part of a larger status? Read-Only, Note *3 applies) + E_Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Read-Only, Bitfield, Note *1, *2 apply) + E_Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Read-Only, Bitfield, Note *1, *3 apply) + E_DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3, Read-Only) + // Add other registers from 0x24xx range if needed + + // --- Protect Level Parameters (Addresses ~0x2500 - 0x25FF, Ref Manual Page 5-3) --- + E_OperationAdjustmentProtect = 0x2500, // Sets Operation/Adjustment Protection Level (Writable, See E5C_OperationProtect_Param) + E_InitialSettingCommsProtect = 0x2501, // Sets Initial Setting/Communications Protection Level (Writable, See E5C_InitialProtect_Param) + E_SettingChangeProtect = 0x2502, // Enable/Disable Setting Change Protect via front panel (Writable, See E5C_SettingChangeProtect_Param) + E_PF_KeyProtect = 0x2503, // Enable/Disable PF Key Protect (Writable, See E5C_PFKeyProtect_Param) + E_MoveToProtectLevelSetting = 0x2504, // Sets the password value needed to move to protect level (Writable, -1999 to 9999 or FFFF831 to 270F) + E_PasswordToMoveToProtectLevel = 0x2505, // Write the password here to attempt moving to the protect level (Write-Only? Monitor value always 0) + E_ParameterMaskEnable = 0x2506, // Enable/Disable Parameter Mask (Writable, See E5C_ParamMaskEnable_Param) (Monitor value always 0) + E_ChangedParametersOnly = 0x2507, // Control Change Parameters setting (Writable, See E5C_ChangedParamsOnly_Param) + + // --- Manual Control / Operation Level Parameters (Addresses ~0x2600 - 0x26FF, Ref Manual Page 5-3) --- + E_ManualMV = 0x2600, // Manual Manipulated Value (Writable in Manual Mode) (%: Ranges vary by model/setting) + E_SetPoint_OperationLevel = 0x2601, // Set Point visible/settable in Operation Level (Writable, Range: SP lower to SP upper limit) (Potentially same as 0x2103?) + E_RemoteSPMonitor = 0x2602, // Remote SP Monitor (Read-Only, Range: Remote SP lower limit +/-10% FS) + E_HeaterCurrent1ValueMonitor_OpLevel = 0x2604, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) (Likely same value as 0x2003) + E_MVMonitorHeating_OpLevel = 0x2605, // MV Monitor (Heating) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) (Likely same value as 0x2004) + E_MVMonitorCooling_OpLevel = 0x2606, // MV Monitor (Cooling) (Read-Only, %: 0.0 to 105.0) (Likely same value as 0x2005) + E_ValveOpeningMonitor = 0x2607, // Valve Opening Monitor (Read-Only, %: -10.0 to 110.0) + + // --- Adjustment Level / PID / Control Parameters (Addresses ~0x2700 - 0x27FF approx. from page 5-4 and 5-5) --- + E_ProportionalBandCooling = 0x2701, // Proportional Band (Cooling) (Writable, 0.1 to 999.9) [Adjustment Level] + E_IntegralTimeCooling = 0x2702, // Integral Time (Cooling) (Writable, 0 to 9999 s / 0.0 to 999.9 s depending on derivative unit) [Adjustment Level] + E_DerivativeTimeCooling = 0x2703, // Derivative Time (Cooling) (Writable, Same range as Integral) [Adjustment Level] + E_DeadBand = 0x2704, // Dead Band (Writable, -199.9 to 999.9 for temp input / -19.99 to 99.99 for analog input) [Adjustment Level] + E_ManualResetValue = 0x2705, // Manual Reset Value (Writable, 0.0 to 100.0) [Adjustment Level] + E_HysteresisHeating = 0x2706, // Hysteresis (Heating) (Writable, 0.1 to 999.9 for temp input / 0.01 to 99.99 for analog input) [Adjustment Level] + E_HysteresisCooling = 0x2707, // Hysteresis (Cooling) (Writable, Same range as Heating) [Adjustment Level] + E_ControlPeriodHeating = 0x2708, // Control Period (Heating) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_ControlPeriodCooling = 0x2709, // Control Period (Cooling) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_PositionPropDeadBand = 0x270A, // Position Proportional Dead Band (Writable, 0.1 to 10.0) [Adjustment Level] + E_OpenCloseHysteresis = 0x270B, // Open/Close Hysteresis (Writable, 0.1 to 20.0) [Adjustment Level] + E_SPRampTimeUnit = 0x270C, // SP Ramp Time Unit (Writable) [Advanced Function Setting Level] (See E5C_SPRampTimeUnit_Param) + E_SPRampSetValue = 0x270D, // SP Ramp Set Value (Writable, 0=OFF or 1 to 9999 in units from 0x270C) [Adjustment Level] (See E5C_SPRampSetValue_SpecialVal) + E_SPRampFallValue = 0x270E, // SP Ramp Fall Value (Writable, -1=Same as Set, 0=OFF or 1 to 9999) [Adjustment Level] (See E5C_SPRampFallValue_SpecialVal) + E_MVAtStop = 0x270F, // MV (%) at Stop (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVAtPVError = 0x2711, // MV (%) at PV Error (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVChangeRateLimit = 0x2713, // MV Change Rate Limit (Writable, 0.0=OFF or 0.1 to 100.0 %/s) [Advanced Function Setting Level] + E_PVInputSlopeCoeff = 0x2718, // PV Input Slope Coefficient (Writable, 0.001 to 9.999) [Advanced Function Setting Level] + E_HeaterCurrent1ValueMonitor_Adv = 0x271A, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level - Seems redundant, matches 0x2003/0x2604] + E_HeaterBurnoutDetection1 = 0x271B, // Heater Burnout Detection 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent1Monitor = 0x271C, // Leakage Current 1 Monitor (Read-Only, 0.0 to 55.0? Units not specified, likely mA) [Operation Level] + E_HSAlarm1 = 0x271D, // HS (Heater Short?) Alarm 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_ProcessValueInputShift = 0x2723, // Process Value Input Shift (Writable, -1999 to 9999) [Adjustment Level] + E_HeaterCurrent2ValueMonitor = 0x2724, // Heater Current 2 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level] + E_HeaterBurnoutDetection2 = 0x2725, // Heater Burnout Detection 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent2Monitor = 0x2726, // Leakage Current 2 Monitor (Read-Only, 0.0 to 55.0 mA?) [Operation Level] + E_HSAlarm2 = 0x2727, // HS (Heater Short?) Alarm 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_SoakTimeRemain = 0x2728, // Soak Time Remain (Read-Only?, 0 to 9999) [Operation Level] + E_SoakTime = 0x2729, // Soak Time (Writable, 1 to 9999) [Adjustment Level] + E_WaitBand = 0x272A, // Wait Band (Writable, 0=OFF, Range: 0.1 to 999.9 Temp / 0.01 to 99.99 Analog) [Adjustment Level] (See E5C_WaitBand_SpecialVal) + E_RemoteSPInputShift = 0x272B, // Remote SP Input Shift (Writable, -1999 to 9999) [Advanced Function Setting Level] + E_RemoteSPInputSlopeCoeff = 0x272C, // Remote SP Input Slope Coefficient (Writable, 0.001 to 9.999) [Advanced Function Setting Level] + + // --- Advanced Function Setting Level Parameters (Addresses ~0x2800 - ...) --- + E_InputDigitalFilter = 0x2800, // Input Digital Filter (Writable, 0.0 to 999.9) [Advanced Function Setting Level] + E_MovingAverageCount = 0x2804, // Moving Average Count (Writable) [Advanced Function Setting Level] (See E5C_MovingAverageCount_Param) + + // NOTE on Status Registers (e.g., E_Status1, E_Status2_LowerWord, E_Status2_UpperWord): + // These are bitfields. Refer to the E5C Communications Manual Section 5-2 "Status" + // for details on individual bit meanings. Explicit enums for these bits can be added if needed. + // Note *1: Not displayed on the Controller display. + // Note *2: In 2-byte mode, the rightmost 16 bits are usually read. + // Note *3: In 2-byte mode, the leftmost 16 bits are usually read. + // This suggests Status 2 (E_Status2_LowerWord/E_Status2_UpperWord) and potentially StatusWord3 (E_StatusWord3_Leftmost) + // might be parts of larger 32-bit status values if the controller supported 4-byte mode reads. +}; + +// --- Parameter Enums for Specific Holding Register Settings --- + +// Parameters for E_OperationAdjustmentProtect (0x2500) +enum class E5C_OperationProtect_Param : uint16_t +{ + E_NoRestrictions = 0x00, // No restrictions in operation and adjustment levels + E_AdjustLevelProhibited = 0x01, // Move to adjustment level is prohibited + E_DisplayChangePV_PVSP = 0x02, // Display and change of only "PV" and "PV/SP" allowed + E_DisplayOnlyPV_PVSP = 0x03, // Display of only "PV" and "PV/SP" allowed +}; + +// Parameters for E_InitialSettingCommsProtect (0x2501) +enum class E5C_InitialProtect_Param : uint16_t +{ + E_MoveToInitialAllowedAdvDisplayed = 0x00, // Move to initial/comms allowed. Adv func displayed. + E_MoveToInitialAllowedAdvNotDisplayed= 0x01, // Move to initial/comms allowed. Adv func not displayed. + E_MoveToInitialProhibited = 0x02, // Move to initial/comms prohibited. +}; + +// Parameters for E_SettingChangeProtect (0x2502) +enum class E5C_SettingChangeProtect_Param : uint16_t +{ + E_OffChangeAllowed = 0x00, // OFF (Changing settings via front panel allowed) + E_OnChangeProhibited = 0x01, // ON (Changing settings via front panel prohibited) +}; + +// Parameters for E_PF_KeyProtect (0x2503) +enum class E5C_PFKeyProtect_Param : uint16_t +{ + E_Off = 0x00, // PF Key Protection OFF + E_On = 0x01, // PF Key Protection ON +}; + +// Parameters for E_ParameterMaskEnable (0x2506) +enum class E5C_ParamMaskEnable_Param : uint16_t +{ + E_Off = 0x00, // Parameter Mask function OFF + E_On = 0x01, // Parameter Mask function ON +}; + +// Parameters for E_ChangedParametersOnly (0x2507) +enum class E5C_ChangedParamsOnly_Param : uint16_t +{ + E_Off = 0x00, // Display all parameters in adjustment level etc. + E_On = 0x01, // Display only parameters changed from default in adjustment level etc. +}; + + +// --- Special Values / Parameter Enums for specific registers from page 5-4 and 5-5 --- + +// Special values for E_ControlPeriodHeating (0x2708) and E_ControlPeriodCooling (0x2709) +// Note: Positive values 1 to 99 represent seconds directly. Use raw integers for those. +enum class E5C_ControlPeriod_SpecialVal : int16_t // Use signed type for negative values +{ + E_Period_0_1_Sec = -2, // Represents 0.1 seconds + E_Period_0_2_Sec = -1, // Represents 0.2 seconds + E_Period_0_5_Sec = 0, // Represents 0.5 seconds + // Values 1..99 are direct seconds, do not add them here. Must be written as int16_t. +}; + +// Parameters for E_SPRampTimeUnit (0x270C) +enum class E5C_SPRampTimeUnit_Param : uint16_t +{ + E_EU_Per_Second = 0, // Unit is Engineering Unit / second + E_EU_Per_Minute = 1, // Unit is Engineering Unit / minute + E_EU_Per_Hour = 2, // Unit is Engineering Unit / hour +}; + +// Special value for E_SPRampSetValue (0x270D) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampSetValue_SpecialVal : uint16_t +{ + E_Off = 0, // SP Ramp Set is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as uint16_t. +}; + +// Special values for E_SPRampFallValue (0x270E) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampFallValue_SpecialVal : int16_t // Use signed type for negative value +{ + E_SameAsSet = -1, // Fall rate is same as Set rate (defined by 0x270D) + E_Off = 0, // SP Ramp Fall is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as int16_t. +}; + +// Special value for E_WaitBand (0x272A) +// Note: Positive values represent the band width directly (needs scaling based on Temp/Analog input). +// Use raw values for setting the width. +enum class E5C_WaitBand_SpecialVal : uint16_t +{ + E_Off = 0, // Wait Band function is OFF + // Other values represent the actual width. +}; + +// Parameters for E_MovingAverageCount (0x2804) +enum class E5C_MovingAverageCount_Param : uint16_t +{ + E_Off = 0, // Moving Average OFF + E_2_Times = 1, // Moving Average Count: 2 times + E_4_Times = 2, // Moving Average Count: 4 times + E_8_Times = 3, // Moving Average Count: 8 times + E_16_Times= 4, // Moving Average Count: 16 times + E_32_Times= 5, // Moving Average Count: 32 times +}; + +// --- Enums for Status Register Bits (Refer to Manual Section 5-2) --- +// Example: If you need to decode bits from E_Status1 (0x2001) or E_Status1_StatusArea (0x2406) +// (These are just examples, the actual mapping needs to be confirmed from the manual) +/* +enum class E5C_Status1_Bits : uint16_t +{ + E_Alarm1_Output = (1 << 0), // Bit 0: Alarm 1 Output Status (0: OFF, 1: ON) + E_Alarm2_Output = (1 << 1), // Bit 1: Alarm 2 Output Status + E_Alarm3_Output = (1 << 2), // Bit 2: Alarm 3 Output Status + E_Alarm4_Output = (1 << 3), // Bit 3: Alarm 4 Output Status (?) + E_HeaterBurnout1 = (1 << 4), // Bit 4: Heater Burnout 1 Status + E_HeaterBurnout2 = (1 << 5), // Bit 5: Heater Burnout 2 Status + E_RunMode = (1 << 8), // Bit 8: RUN/STOP Status (0: STOP, 1: RUN) + E_AutoTuning = (1 << 9), // Bit 9: AT Execution Status (0: OFF, 1: ON) + E_CommWritingDisabled = (1 << 11), // Bit 11: Communications Writing Disabled Status + E_ManualMode = (1 << 12), // Bit 12: Auto/Manual Mode Status (0: Auto, 1: Manual) + // ... add other relevant bits based on manual section 5-2 +}; +*/ + +// Example: If you need bits from Status 2 Lower Word (0x2408) +/* +enum class E5C_Status2Lower_Bits : uint16_t +{ + E_RAM_Error = (1 << 0), // Bit 0: RAM Error + E_MemoryError = (1 << 1), // Bit 1: Memory Error + E_ADC_Error = (1 << 2), // Bit 2: A/D Converter Error + E_InputTypeError = (1 << 3), // Bit 3: Input Type Error + // ... +}; + */ + +// Example: If you need bits from Status 2 Upper Word (0x2409) +/* +enum class E5C_Status2Upper_Bits : uint16_t +{ + E_PV_InputError = (1 << 0), // Bit 16 (0 in upper word): PV Input Error + E_RemoteSPInputError = (1 << 1), // Bit 17 (1 in upper word): Remote SP Input Error + // ... +}; +*/ + + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register (often 0x0000) via Modbus. +enum class E5C_CommandCode : uint16_t +{ + E_CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + E_RunStop = 0x01, // Starts or stops control operation + E_MultiSP = 0x02, // Selects the target Set Point (SP) number + E_ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + E_WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + E_SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_SoftwareReset = 0x06, // Performs a software reset (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + E_ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + E_SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + E_InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + E_ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values (data) sent with specific commands. + +// Parameters for E_CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + E_OffDisabled = 0x00, + E_OnEnabled = 0x01, +}; + +// Parameters for E_RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + E_Run = 0x00, + E_Stop = 0x01, +}; + +// Parameters for E_MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + E_SetPoint0 = 0x00, + E_SetPoint1 = 0x01, + E_SetPoint2 = 0x02, + E_SetPoint3 = 0x03, + E_SetPoint4 = 0x04, + E_SetPoint5 = 0x05, + E_SetPoint6 = 0x06, + E_SetPoint7 = 0x07, +}; + +// Parameters for E_ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + E_ATCancel = 0x00, // Cancel Auto-Tuning + E_ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + E_ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E_WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + E_Backup = 0x00, // Writes are backed up to non-volatile memory + E_RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E_AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + E_AutomaticMode = 0x00, + E_ManualMode = 0x01, +}; + +// Parameters for E_AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + E_Alarm1LatchCancel = 0x00, + E_Alarm2LatchCancel = 0x01, + E_Alarm3LatchCancel = 0x02, + E_HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + E_HSAlarmLatchCancel = 0x04, // Heater Short alarm latch cancel (?) + E_Alarm4LatchCancel = 0x05, // Alarm 4 latch cancel (?) + E_AllAlarmLatchCancel = 0x0F, // Cancel all latched alarms +}; + +// Parameters for E_SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + E_LocalSPMode = 0x00, + E_RemoteSPMode = 0x01, +}; + +// Parameters for E_InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + E_NotInvert = 0x00, // Direct operation + E_Invert = 0x01, // Reverse operation +}; + +// Parameters for E_ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + E_Reset = 0x00, // Reset the program/pattern + E_Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E_SaveRAMData +// - E_SoftwareReset +// - E_MoveToSetupArea1 +// - E_MoveToProtectLevel (Command, not the register 0x2504) +// - E_ParameterInitialization + +// --- E5C Modbus Variable Area Registers (Holding Registers - Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values. +// Based on the "Variable Area (Setting Range) List" sections of the Communications Manual (H175). +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Monitors (Addresses ~0x2000 - 0x20FF) --- + E_PV = 0x2000, // Process Value (Read-Only) + E_Status1 = 0x2001, // Status 1 (Bitfield, Read-Only, see manual section 5-2. Note *1, *2 apply) + E_InternalSetPoint = 0x2002, // Internal Set Point (Read-Only? Note *1 applies) + E_HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) + E_MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) + E_MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (Read-Only, %: 0.0 to 105.0) + + // --- Primary Setting Parameters (Addresses ~0x2100 - 0x21FF) --- + E_SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable, Primary SP setting, likely the *active* SP or SP0 in non-MultiSP mode) + E_AlarmValue1 = 0x2104, // Alarm Value 1 (Writable, -1999 to 9999) [Main Setting] + E_AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (Writable, -1999 to 9999) [Main Setting] + E_AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (Writable, -1999 to 9999) [Main Setting] + E_AlarmValue2 = 0x2107, // Alarm Value 2 (Writable, -1999 to 9999) [Main Setting] + E_AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (Writable, -1999 to 9999) [Main Setting] + E_AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (Writable, -1999 to 9999) [Main Setting] + // Add other registers from 0x21xx range if needed from other tables + + // --- Status/Monitor Parameters (Addresses ~0x2400 - 0x24FF) --- + E_PV_StatusArea = 0x2402, // Process Value (Read-Only status copy) + E_InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Read-Only status copy, Note *1) + E_MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7, Read-Only) + E_Status1_StatusArea = 0x2406, // Status 1 (Read-Only status copy, Bitfield, Note *1, *2 apply) + E_StatusWord3_Leftmost = 0x2407, // Status Word 3 / Leftmost bits (Part of a larger status? Read-Only, Note *3 applies) + E_Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Read-Only, Bitfield, Note *1, *2 apply) + E_Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Read-Only, Bitfield, Note *1, *3 apply) + E_DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3, Read-Only) + // Add other registers from 0x24xx range if needed + + // --- Protect Level Parameters (Addresses ~0x2500 - 0x25FF, Ref Manual Page 5-3) --- + E_OperationAdjustmentProtect = 0x2500, // Sets Operation/Adjustment Protection Level (Writable, See E5C_OperationProtect_Param) + E_InitialSettingCommsProtect = 0x2501, // Sets Initial Setting/Communications Protection Level (Writable, See E5C_InitialProtect_Param) + E_SettingChangeProtect = 0x2502, // Enable/Disable Setting Change Protect via front panel (Writable, See E5C_SettingChangeProtect_Param) + E_PF_KeyProtect = 0x2503, // Enable/Disable PF Key Protect (Writable, See E5C_PFKeyProtect_Param) + E_MoveToProtectLevelSetting = 0x2504, // Sets the password value needed to move to protect level (Writable, -1999 to 9999 or FFFF831 to 270F) + E_PasswordToMoveToProtectLevel = 0x2505, // Write the password here to attempt moving to the protect level (Write-Only? Monitor value always 0) + E_ParameterMaskEnable = 0x2506, // Enable/Disable Parameter Mask (Writable, See E5C_ParamMaskEnable_Param) (Monitor value always 0) + E_ChangedParametersOnly = 0x2507, // Control Change Parameters setting (Writable, See E5C_ChangedParamsOnly_Param) + + // --- Manual Control / Operation Level Parameters (Addresses ~0x2600 - 0x26FF, Ref Manual Page 5-3) --- + E_ManualMV = 0x2600, // Manual Manipulated Value (Writable in Manual Mode) (%: Ranges vary by model/setting) + E_SetPoint_OperationLevel = 0x2601, // Set Point visible/settable in Operation Level (Writable, Range: SP lower to SP upper limit) (Likely mirrors E_SetPoint=0x2103 but accessible differently) + E_RemoteSPMonitor = 0x2602, // Remote SP Monitor (Read-Only, Range: Remote SP lower limit +/-10% FS) + E_HeaterCurrent1ValueMonitor_OpLevel = 0x2604, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) (Likely same value as 0x2003) + E_MVMonitorHeating_OpLevel = 0x2605, // MV Monitor (Heating) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) (Likely same value as 0x2004) + E_MVMonitorCooling_OpLevel = 0x2606, // MV Monitor (Cooling) (Read-Only, %: 0.0 to 105.0) (Likely same value as 0x2005) + E_ValveOpeningMonitor = 0x2607, // Valve Opening Monitor (Read-Only, %: -10.0 to 110.0) + + // --- Adjustment Level / PID / Control Parameters (Addresses ~0x2700 - 0x27FF approx. from page 5-4 and 5-5) --- + E_ProportionalBandCooling = 0x2701, // Proportional Band (Cooling) (Writable, 0.1 to 999.9) [Adjustment Level] + E_IntegralTimeCooling = 0x2702, // Integral Time (Cooling) (Writable, 0 to 9999 s / 0.0 to 999.9 s depending on derivative unit) [Adjustment Level] + E_DerivativeTimeCooling = 0x2703, // Derivative Time (Cooling) (Writable, Same range as Integral) [Adjustment Level] + E_DeadBand = 0x2704, // Dead Band (Writable, -199.9 to 999.9 for temp input / -19.99 to 99.99 for analog input) [Adjustment Level] + E_ManualResetValue = 0x2705, // Manual Reset Value (Writable, 0.0 to 100.0) [Adjustment Level] + E_HysteresisHeating = 0x2706, // Hysteresis (Heating) (Writable, 0.1 to 999.9 for temp input / 0.01 to 99.99 for analog input) [Adjustment Level] + E_HysteresisCooling = 0x2707, // Hysteresis (Cooling) (Writable, Same range as Heating) [Adjustment Level] + E_ControlPeriodHeating = 0x2708, // Control Period (Heating) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_ControlPeriodCooling = 0x2709, // Control Period (Cooling) (Writable, Special values -2, -1, 0 or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_PositionPropDeadBand = 0x270A, // Position Proportional Dead Band (Writable, 0.1 to 10.0) [Adjustment Level] + E_OpenCloseHysteresis = 0x270B, // Open/Close Hysteresis (Writable, 0.1 to 20.0) [Adjustment Level] + E_SPRampTimeUnit = 0x270C, // SP Ramp Time Unit (Writable) [Advanced Function Setting Level] (See E5C_SPRampTimeUnit_Param) + E_SPRampSetValue = 0x270D, // SP Ramp Set Value (Writable, 0=OFF or 1 to 9999 in units from 0x270C) [Adjustment Level] (See E5C_SPRampSetValue_SpecialVal) + E_SPRampFallValue = 0x270E, // SP Ramp Fall Value (Writable, -1=Same as Set, 0=OFF or 1 to 9999) [Adjustment Level] (See E5C_SPRampFallValue_SpecialVal) + E_MVAtStop = 0x270F, // MV (%) at Stop (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVAtPVError = 0x2711, // MV (%) at PV Error (Writable, -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVChangeRateLimit = 0x2713, // MV Change Rate Limit (Writable, 0.0=OFF or 0.1 to 100.0 %/s) [Advanced Function Setting Level] + E_PVInputSlopeCoeff = 0x2718, // PV Input Slope Coefficient (Writable, 0.001 to 9.999) [Advanced Function Setting Level] + E_HeaterCurrent1ValueMonitor_Adv = 0x271A, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) [ Seems redundant, matches 0x2003/0x2604] + E_HeaterBurnoutDetection1 = 0x271B, // Heater Burnout Detection 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent1Monitor = 0x271C, // Leakage Current 1 Monitor (Read-Only, 0.0 to 55.0? Units not specified, likely mA) [Operation Level] + E_HSAlarm1 = 0x271D, // HS (Heater Short?) Alarm 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_ProcessValueInputShift = 0x2723, // Process Value Input Shift (Writable, -1999 to 9999) [Adjustment Level] + E_HeaterCurrent2ValueMonitor = 0x2724, // Heater Current 2 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level] + E_HeaterBurnoutDetection2 = 0x2725, // Heater Burnout Detection 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent2Monitor = 0x2726, // Leakage Current 2 Monitor (Read-Only, 0.0 to 55.0 mA?) [Operation Level] + E_HSAlarm2 = 0x2727, // HS (Heater Short?) Alarm 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_SoakTimeRemain = 0x2728, // Soak Time Remain (Read-Only?, 0 to 9999) [Operation Level] + E_SoakTime = 0x2729, // Soak Time (Writable, 1 to 9999) [Adjustment Level] + E_WaitBand = 0x272A, // Wait Band (Writable, 0=OFF, Range: 0.1 to 999.9 Temp / 0.01 to 99.99 Analog) [Adjustment Level] (See E5C_WaitBand_SpecialVal) + E_RemoteSPInputShift = 0x272B, // Remote SP Input Shift (Writable, -1999 to 9999) [Advanced Function Setting Level] + E_RemoteSPInputSlopeCoeff = 0x272C, // Remote SP Input Slope Coefficient (Writable, 0.001 to 9.999) [Advanced Function Setting Level] + + // --- Advanced Function Setting Level / Other (Addresses ~0x2800 - ...) --- + E_InputDigitalFilter = 0x2800, // Input Digital Filter (Writable, 0.0 to 999.9) [Advanced Function Setting Level] + E_MovingAverageCount = 0x2804, // Moving Average Count (Writable) [Advanced Function Setting Level] (See E5C_MovingAverageCount_Param) + E_ExtractionOfSquareRootLowCutPoint = 0x2808, // Extraction of Square Root Low-cut Point (%) (Writable, 0.0 to 100.0) [Adjustment Level] + + // --- Operation Level Parameters (Duplicated Address? / Specific Uses) (Addresses ~0x2900 - 0x29FF) --- + // These seem related to parameters also available elsewhere, but accessible during 'Operation' or 'Adjustment' levels specifically. + E_SP0_OperationLevel = 0x2900, // SP 0 Setting (Writable, SP lower limit to SP upper limit) [Operation Level] (Likely same as E_SetPoint when SP 0 is selected) + E_AlarmValue1_OperationLevel = 0x2902, // Alarm Value 1 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValue1=0x2104) + E_AlarmValueUpperLimit1_OperationLevel = 0x2903, // Alarm Value Upper Limit 1 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValueUpperLimit1=0x2105) + E_AlarmValueLowerLimit1_OperationLevel = 0x2904, // Alarm Value Lower Limit 1 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValueLowerLimit1=0x2106) + E_AlarmValue2_OperationLevel = 0x2905, // Alarm Value 2 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValue2=0x2107) + E_AlarmValueUpperLimit2_OperationLevel = 0x2906, // Alarm Value Upper Limit 2 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValueUpperLimit2=0x2108) + E_AlarmValueLowerLimit2_OperationLevel = 0x2907, // Alarm Value Lower Limit 2 (Writable, -1999 to 9999) [Operation Level] (May modify E_AlarmValueLowerLimit2=0x2109) + E_AlarmValue3 = 0x2908, // Alarm Value 3 (Writable, -1999 to 9999) [Operation Level] + E_AlarmValueUpperLimit3 = 0x2909, // Alarm Value Upper Limit 3 (Writable, -1999 to 9999) [Operation Level] + E_AlarmValueLowerLimit3 = 0x290A, // Alarm Value Lower Limit 3 (Writable, -1999 to 9999) [Operation Level] + E_AlarmValue4 = 0x290B, // Alarm Value 4 (Writable, -1999 to 9999) [Operation Level] + E_AlarmValueUpperLimit4 = 0x290C, // Alarm Value Upper Limit 4 (Writable, -1999 to 9999) [Operation Level] + E_AlarmValueLowerLimit4 = 0x290D, // Alarm Value Lower Limit 4 (Writable, -1999 to 9999) [Operation Level] + E_SP1_Setting = 0x290E, // SP 1 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 1) + E_SP2_Setting = 0x291C, // SP 2 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 2) + E_SP3_Setting = 0x292A, // SP 3 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 3) + E_SP4_Setting = 0x2938, // SP 4 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 4) + E_SP5_Setting = 0x2946, // SP 5 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 5) + E_SP6_Setting = 0x2954, // SP 6 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 6) + E_SP7_Setting = 0x2962, // SP 7 Setting (Writable, SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 7) + + // --- Adjustment Level PID / MV Limits (Addresses ~0x2A00 - ...) --- + E_ProportionalBand = 0x2A00, // Proportional Band (Heating, Standard, or Close Position Control) (Writable, 0.1 to 999.9) [Adjustment Level] + E_IntegralTime = 0x2A01, // Integral Time (Heating, Standard, or Close Position Control) (Writable, Range depends on time unit setting) [Adjustment Level] + E_DerivativeTime = 0x2A02, // Derivative Time (Heating, Standard, or Close Position Control) (Writable, Range depends on time unit setting) [Adjustment Level] + E_MVUpperLimit = 0x2A05, // MV Upper Limit (%) (Writable, Range depends on control type, see manual) [Adjustment Level] + E_MVLowerLimit = 0x2A06, // MV Lower Limit (%) (Writable, Range depends on control type, see manual) [Adjustment Level] + + // NOTE on Status Registers (e.g., E_Status1, E_Status2_LowerWord, E_Status2_UpperWord): + // These are bitfields. Refer to the E5C Communications Manual Section 5-2 "Status" + // for details on individual bit meanings. Explicit enums for these bits can be added if needed. + // Note *1: Not displayed on the Controller display. + // Note *2: In 2-byte mode, the rightmost 16 bits are usually read. + // Note *3: In 2-byte mode, the leftmost 16 bits are usually read. + // This suggests Status 2 (E_Status2_LowerWord/E_Status2_UpperWord) and potentially StatusWord3 (E_StatusWord3_Leftmost) + // might be parts of larger 32-bit status values if the controller supported 4-byte mode reads. +}; + +// --- Parameter Enums for Specific Holding Register Settings --- + +// Parameters for E_OperationAdjustmentProtect (0x2500) +enum class E5C_OperationProtect_Param : uint16_t +{ + E_NoRestrictions = 0x00, // No restrictions in operation and adjustment levels + E_AdjustLevelProhibited = 0x01, // Move to adjustment level is prohibited + E_DisplayChangePV_PVSP = 0x02, // Display and change of only "PV" and "PV/SP" allowed + E_DisplayOnlyPV_PVSP = 0x03, // Display of only "PV" and "PV/SP" allowed +}; + +// Parameters for E_InitialSettingCommsProtect (0x2501) +enum class E5C_InitialProtect_Param : uint16_t +{ + E_MoveToInitialAllowedAdvDisplayed = 0x00, // Move to initial/comms allowed. Adv func displayed. + E_MoveToInitialAllowedAdvNotDisplayed= 0x01, // Move to initial/comms allowed. Adv func not displayed. + E_MoveToInitialProhibited = 0x02, // Move to initial/comms prohibited. +}; + +// Parameters for E_SettingChangeProtect (0x2502) +enum class E5C_SettingChangeProtect_Param : uint16_t +{ + E_OffChangeAllowed = 0x00, // OFF (Changing settings via front panel allowed) + E_OnChangeProhibited = 0x01, // ON (Changing settings via front panel prohibited) +}; + +// Parameters for E_PF_KeyProtect (0x2503) +enum class E5C_PFKeyProtect_Param : uint16_t +{ + E_Off = 0x00, // PF Key Protection OFF + E_On = 0x01, // PF Key Protection ON +}; + +// Parameters for E_ParameterMaskEnable (0x2506) +enum class E5C_ParamMaskEnable_Param : uint16_t +{ + E_Off = 0x00, // Parameter Mask function OFF + E_On = 0x01, // Parameter Mask function ON +}; + +// Parameters for E_ChangedParametersOnly (0x2507) +enum class E5C_ChangedParamsOnly_Param : uint16_t +{ + E_Off = 0x00, // Display all parameters in adjustment level etc. + E_On = 0x01, // Display only parameters changed from default in adjustment level etc. +}; + + +// --- Special Values / Parameter Enums for specific registers --- + +// Special values for E_ControlPeriodHeating (0x2708) and E_ControlPeriodCooling (0x2709) +// Note: Positive values 1 to 99 represent seconds directly. Use raw integers for those. +enum class E5C_ControlPeriod_SpecialVal : int16_t // Use signed type for negative values +{ + E_Period_0_1_Sec = -2, // Represents 0.1 seconds + E_Period_0_2_Sec = -1, // Represents 0.2 seconds + E_Period_0_5_Sec = 0, // Represents 0.5 seconds + // Values 1..99 are direct seconds, do not add them here. Must be written as int16_t. +}; + +// Parameters for E_SPRampTimeUnit (0x270C) +enum class E5C_SPRampTimeUnit_Param : uint16_t +{ + E_EU_Per_Second = 0, // Unit is Engineering Unit / second + E_EU_Per_Minute = 1, // Unit is Engineering Unit / minute + E_EU_Per_Hour = 2, // Unit is Engineering Unit / hour +}; + +// Special value for E_SPRampSetValue (0x270D) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampSetValue_SpecialVal : uint16_t +{ + E_Off = 0, // SP Ramp Set is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as uint16_t. +}; + +// Special values for E_SPRampFallValue (0x270E) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampFallValue_SpecialVal : int16_t // Use signed type for negative value +{ + E_SameAsSet = -1, // Fall rate is same as Set rate (defined by 0x270D) + E_Off = 0, // SP Ramp Fall is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as int16_t. +}; + +// Special value for E_WaitBand (0x272A) +// Note: Positive values represent the band width directly (needs scaling based on Temp/Analog input). +// Use raw values for setting the width. +enum class E5C_WaitBand_SpecialVal : uint16_t +{ + E_Off = 0, // Wait Band function is OFF + // Other values represent the actual width. +}; + +// Parameters for E_MovingAverageCount (0x2804) +enum class E5C_MovingAverageCount_Param : uint16_t +{ + E_Off = 0, // Moving Average OFF + E_2_Times = 1, // Moving Average Count: 2 times + E_4_Times = 2, // Moving Average Count: 4 times + E_8_Times = 3, // Moving Average Count: 8 times + E_16_Times= 4, // Moving Average Count: 16 times + E_32_Times= 5, // Moving Average Count: 32 times +}; + + +// --- Enums for Status Register Bits (Refer to Manual Section 5-2) --- +// These are *examples* and need to be carefully verified against the specific E5C model manual. +// Define these if you need to decode individual status bits from registers like E_Status1, E_Status2_LowerWord, etc. + +/* +// Example bits for E_Status1 (0x2001) / E_Status1_StatusArea (0x2406) +enum class E5C_Status1_Bits : uint16_t +{ + E_S1_Alarm1_Output = (1 << 0), // Bit 0: Alarm 1 Output Status (0: OFF, 1: ON) + E_S1_Alarm2_Output = (1 << 1), // Bit 1: Alarm 2 Output Status + E_S1_Alarm3_Output = (1 << 2), // Bit 2: Alarm 3 Output Status + E_S1_Alarm4_Output = (1 << 3), // Bit 3: Alarm 4 Output Status (?) + E_S1_HeaterBurnout1 = (1 << 4), // Bit 4: Heater Burnout 1 Status + E_S1_HeaterBurnout2 = (1 << 5), // Bit 5: Heater Burnout 2 Status + E_S1_RunMode = (1 << 8), // Bit 8: RUN/STOP Status (0: STOP, 1: RUN) + E_S1_AutoTuning = (1 << 9), // Bit 9: AT Execution Status (0: OFF, 1: ON) + E_S1_TaskOperating = (1 << 10), // Bit 10: Task Operating Status (Programs) + E_S1_CommWritingDisabled= (1 << 11), // Bit 11: Communications Writing Disabled Status + E_S1_ManualMode = (1 << 12), // Bit 12: Auto/Manual Mode Status (0: Auto, 1: Manual) + E_S1_RemoteSP_Mode = (1 << 13), // Bit 13: SP Mode (0: Local, 1: Remote) + // ... add other relevant bits based on manual section 5-2 +}; +*/ + +/* +// Example bits for E_Status2_LowerWord (0x2408) +enum class E5C_Status2Lower_Bits : uint16_t +{ + E_S2L_RAM_Error = (1 << 0), // Bit 0: RAM Error + E_S2L_MemoryError = (1 << 1), // Bit 1: Memory Error (Non-volatile) + E_S2L_ADC_Error = (1 << 2), // Bit 2: A/D Converter Error + E_S2L_InputTypeError = (1 << 3), // Bit 3: Input Type Error + E_S2L_WatchdogTimeout = (1 << 4), // Bit 4: Watchdog Timer Timeout + E_S2L_OverrunError = (1 << 5), // Bit 5: Overrun Error + E_S2L_FramingError = (1 << 6), // Bit 6: Framing Error + E_S2L_ParityError = (1 << 7), // Bit 7: Parity Error + E_S2L_CommsTimeoutError = (1 << 8), // Bit 8: Communications Timeout Error + E_S2L_CommsError = (1 << 9), // Bit 9: Communications Error + E_S2L_CommsBufferOverrun = (1 << 10),// Bit 10: Communications Buffer Overrun Error + E_S2L_PowerSupplyFreqError = (1 << 11),// Bit 11: Power Supply Frequency Error + // ... add other relevant bits based on manual section 5-2 +}; + */ + +/* +// Example bits for E_Status2_UpperWord (0x2409) - Note: Bit numbering starts from 16 conceptually +enum class E5C_Status2Upper_Bits : uint16_t +{ + E_S2U_PV_InputError = (1 << 0), // Bit 16 (0 in upper word): PV Input Error (Over/Under Range) + E_S2U_RemoteSPInputError = (1 << 1), // Bit 17 (1 in upper word): Remote SP Input Error (Over/Under Range) + E_S2U_MVOutputError = (1 << 2), // Bit 18 (2 in upper word): MV Output Error + E_S2U_ExternalDIError = (1 << 3), // Bit 19 (3 in upper word): Error via External DI (Digital Input) + E_S2U_HeaterShortAlarm1 = (1 << 4), // Bit 20 (4 in upper word): HS (Heater Short) Alarm 1 Status + E_S2U_HeaterShortAlarm2 = (1 << 5), // Bit 21 (5 in upper word): HS (Heater Short) Alarm 2 Status + E_S2U_TempSensorDisconnected= (1 << 6), // Bit 22 (6 in upper word): Temp Sensor Disconnected (Specific models?) + // ... add other relevant bits based on manual section 5-2 +}; +*/ + + +#include // Required for uint16_t + +// --- E5C Modbus Command Codes --- +// Represents the Command Codes used for various operations on the E5C device. +// These codes are typically written to a specific command register (often 0x0000) via Modbus. +enum class E5C_CommandCode : uint16_t +{ + E_CommunicationsWriting = 0x00, // Controls Modbus communications writing (enable/disable) + E_RunStop = 0x01, // Starts or stops control operation + E_MultiSP = 0x02, // Selects the target Set Point (SP) number + E_ATExecuteCancel = 0x03, // Executes or cancels Auto-Tuning (AT) + E_WriteMode = 0x04, // Selects the write mode (Backup or RAM only) + E_SaveRAMData = 0x05, // Saves data from RAM to non-volatile memory (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_SoftwareReset = 0x06, // Performs a software reset (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_MoveToSetupArea1 = 0x07, // Moves operation to Setup Area 1 (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_MoveToProtectLevel = 0x08, // Moves operation to the Protect Level (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_AutoManualSwitch = 0x09, // Switches between Automatic and Manual control mode + E_ParameterInitialization = 0x0B, // Initializes parameters to default values (Related Info: E5C_COMMAND_PARAM_DEFAULT) + E_AlarmLatchCancel = 0x0C, // Cancels specified latched alarms + E_SPMode = 0x0D, // Selects Set Point (SP) mode (Local or Remote) + E_InvertDirectReverse = 0x0E, // Selects direct or reverse operation (Invert/Not Invert) + E_ProgramStart = 0x11, // Starts or resets a program pattern +}; + +// --- Parameter Enums for Specific Command Codes --- +// These enums define the valid "Related Information" values (data) sent with specific commands. + +// Parameters for E_CommunicationsWriting (0x00) +enum class E5C_CommWrite_Param : uint16_t +{ + E_OffDisabled = 0x00, + E_OnEnabled = 0x01, +}; + +// Parameters for E_RunStop (0x01) +enum class E5C_RunStop_Param : uint16_t +{ + E_Run = 0x00, + E_Stop = 0x01, +}; + +// Parameters for E_MultiSP (0x02) +enum class E5C_MultiSP_Param : uint16_t +{ + E_SetPoint0 = 0x00, + E_SetPoint1 = 0x01, + E_SetPoint2 = 0x02, + E_SetPoint3 = 0x03, + E_SetPoint4 = 0x04, + E_SetPoint5 = 0x05, + E_SetPoint6 = 0x06, + E_SetPoint7 = 0x07, +}; + +// Parameters for E_ATExecuteCancel (0x03) +enum class E5C_ATExecuteCancel_Param : uint16_t +{ + E_ATCancel = 0x00, // Cancel Auto-Tuning + E_ATExecute100Pct = 0x01, // Execute 100% Auto-Tuning + E_ATEexecute40Pct = 0x02, // Execute 40% Auto-Tuning +}; + +// Parameters for E_WriteMode (0x04) +enum class E5C_WriteMode_Param : uint16_t +{ + E_Backup = 0x00, // Writes are backed up to non-volatile memory + E_RAMWriteMode = 0x01, // Writes affect RAM only +}; + +// Parameters for E_AutoManualSwitch (0x09) +enum class E5C_AutoManualSwitch_Param : uint16_t +{ + E_AutomaticMode = 0x00, + E_ManualMode = 0x01, +}; + +// Parameters for E_AlarmLatchCancel (0x0C) +enum class E5C_AlarmLatchCancel_Param : uint16_t +{ + E_Alarm1LatchCancel = 0x00, + E_Alarm2LatchCancel = 0x01, + E_Alarm3LatchCancel = 0x02, + E_HBAlarmLatchCancel = 0x03, // Heater Break alarm latch cancel + E_HSAlarmLatchCancel = 0x04, // Heater Short alarm latch cancel (?) + E_Alarm4LatchCancel = 0x05, // Alarm 4 latch cancel (?) + E_AllAlarmLatchCancel = 0x0F, // Cancel all latched alarms +}; + +// Parameters for E_SPMode (0x0D) +enum class E5C_SPMode_Param : uint16_t +{ + E_LocalSPMode = 0x00, + E_RemoteSPMode = 0x01, +}; + +// Parameters for E_InvertDirectReverse (0x0E) +enum class E5C_InvertDirectReverse_Param : uint16_t +{ + E_NotInvert = 0x00, // Direct operation + E_Invert = 0x01, // Reverse operation +}; + +// Parameters for E_ProgramStart (0x11) +enum class E5C_ProgramStart_Param : uint16_t +{ + E_Reset = 0x00, // Reset the program/pattern + E_Start = 0x01, // Start the program/pattern +}; + +// Constant for commands where the related information is always 0x0000 +constexpr uint16_t E5C_COMMAND_PARAM_DEFAULT = 0x0000; +// This value should be used as the data when issuing commands like: +// - E_SaveRAMData +// - E_SoftwareReset +// - E_MoveToSetupArea1 +// - E_MoveToProtectLevel (Command, not the register 0x2504) +// - E_ParameterInitialization + +// --- E5C Modbus Variable Area Registers (Holding Registers - Two-Byte Mode Addresses) --- +// Represents the addresses for reading/writing various parameters and status values. +// Based on the "Variable Area (Setting Range) List" sections of the Communications Manual (H175). +// Note: Addresses are based on the "Two-byte mode" column. +enum class E5C_HoldingRegister : uint16_t +{ + // --- Operation Level Monitors (Addresses ~0x2000 - 0x20FF) --- + E_PV = 0x2000, // Process Value (Read-Only) + E_Status1 = 0x2001, // Status 1 (Bitfield, Read-Only, see manual section 5-2. Note *1, *2 apply) + E_InternalSetPoint = 0x2002, // Internal Set Point (Read-Only? Note *1 applies) + E_HeaterCurrent1Value = 0x2003, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) + E_MV_MonitorHeating = 0x2004, // Manipulated Value Monitor (Heating Output) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) + E_MV_MonitorCooling = 0x2005, // Manipulated Value Monitor (Cooling Output) (Read-Only, %: 0.0 to 105.0) + + // --- Primary Setting Parameters (Addresses ~0x2100 - 0x21FF) --- + E_SetPoint = 0x2103, // Set Point (SP) value (Writable & Readable, Primary SP setting, likely the *active* SP or SP0 in non-MultiSP mode) + E_AlarmValue1 = 0x2104, // Alarm Value 1 (Writable, Range: -1999 to 9999) [Main Setting] + E_AlarmValueUpperLimit1 = 0x2105, // Alarm Value Upper Limit 1 (Writable, Range: -1999 to 9999) [Main Setting] + E_AlarmValueLowerLimit1 = 0x2106, // Alarm Value Lower Limit 1 (Writable, Range: -1999 to 9999) [Main Setting] + E_AlarmValue2 = 0x2107, // Alarm Value 2 (Writable, Range: -1999 to 9999) [Main Setting] + E_AlarmValueUpperLimit2 = 0x2108, // Alarm Value Upper Limit 2 (Writable, Range: -1999 to 9999) [Main Setting] + E_AlarmValueLowerLimit2 = 0x2109, // Alarm Value Lower Limit 2 (Writable, Range: -1999 to 9999) [Main Setting] + // Add other registers from 0x21xx range if needed from other tables + + // --- Status/Monitor Parameters (Addresses ~0x2400 - 0x24FF) --- + E_PV_StatusArea = 0x2402, // Process Value (Read-Only status copy) + E_InternalSetPoint_StatusArea = 0x2403, // Internal Set Point (Read-Only status copy, Note *1) + E_MultiSP_NoMonitor = 0x2404, // Multi-SP No. Monitor (Which SP is currently active: 0 to 7, Read-Only) + E_Status1_StatusArea = 0x2406, // Status 1 (Read-Only status copy, Bitfield, Note *1, *2 apply) + E_StatusWord3_Leftmost = 0x2407, // Status Word 3 / Leftmost bits (Part of a larger status? Read-Only, Note *3 applies) + E_Status2_LowerWord = 0x2408, // Status 2 (Rightmost 16 bits / Lower Word. Read-Only, Bitfield, Note *1, *2 apply) + E_Status2_UpperWord = 0x2409, // Status 2 (Leftmost 16 bits / Upper Word. Read-Only, Bitfield, Note *1, *3 apply) + E_DecimalPointMonitor = 0x2410, // Decimal Point Monitor (Position for PV/SP display: 0 to 3, Read-Only) + // Add other registers from 0x24xx range if needed + + // --- Protect Level Parameters (Addresses ~0x2500 - 0x25FF, Ref Manual Page 5-3) --- + E_OperationAdjustmentProtect = 0x2500, // Sets Operation/Adjustment Protection Level (Writable, See E5C_OperationProtect_Param) + E_InitialSettingCommsProtect = 0x2501, // Sets Initial Setting/Communications Protection Level (Writable, See E5C_InitialProtect_Param) + E_SettingChangeProtect = 0x2502, // Enable/Disable Setting Change Protect via front panel (Writable, See E5C_SettingChangeProtect_Param) + E_PF_KeyProtect = 0x2503, // Enable/Disable PF Key Protect (Writable, See E5C_PFKeyProtect_Param) + E_MoveToProtectLevelSetting = 0x2504, // Sets the password value needed to move to protect level (Writable, Range: -1999 to 9999 or FFFF831 to 270F) + E_PasswordToMoveToProtectLevel = 0x2505, // Write the password here to attempt moving to the protect level (Write-Only? Monitor value always 0) + E_ParameterMaskEnable = 0x2506, // Enable/Disable Parameter Mask (Writable, See E5C_ParamMaskEnable_Param) (Monitor value always 0) + E_ChangedParametersOnly = 0x2507, // Control Change Parameters setting (Writable, See E5C_ChangedParamsOnly_Param) + + // --- Manual Control / Operation Level Parameters (Addresses ~0x2600 - 0x26FF, Ref Manual Page 5-3) --- + E_ManualMV = 0x2600, // Manual Manipulated Value (Writable in Manual Mode) (%: Ranges vary by model/setting) + E_SetPoint_OperationLevel = 0x2601, // Set Point visible/settable in Operation Level (Writable, Range: SP lower to SP upper limit) (Likely mirrors E_SetPoint=0x2103 but accessible differently) + E_RemoteSPMonitor = 0x2602, // Remote SP Monitor (Read-Only, Range: Remote SP lower limit +/-10% FS) + E_HeaterCurrent1ValueMonitor_OpLevel = 0x2604, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) (Likely same value as 0x2003) + E_MVMonitorHeating_OpLevel = 0x2605, // MV Monitor (Heating) (Read-Only, %: -5.0 to 105.0 or 0.0 to 105.0) (Likely same value as 0x2004) + E_MVMonitorCooling_OpLevel = 0x2606, // MV Monitor (Cooling) (Read-Only, %: 0.0 to 105.0) (Likely same value as 0x2005) + E_ValveOpeningMonitor = 0x2607, // Valve Opening Monitor (Read-Only, %: -10.0 to 110.0) + + // --- Adjustment Level / PID / Control Parameters (Addresses ~0x2700 - 0x27FF approx. from page 5-4 and 5-5) --- + E_ProportionalBandCooling = 0x2701, // Proportional Band (Cooling) (Writable, Range: 0.1 to 999.9) [Adjustment Level] + E_IntegralTimeCooling = 0x2702, // Integral Time (Cooling) (Writable, Range: 0 to 9999 s / 0.0 to 999.9 s depending on derivative unit) [Adjustment Level] + E_DerivativeTimeCooling = 0x2703, // Derivative Time (Cooling) (Writable, Same range as Integral) [Adjustment Level] + E_DeadBand = 0x2704, // Dead Band (Writable, Range: -199.9 to 999.9 for temp input / -19.99 to 99.99 for analog input) [Adjustment Level] + E_ManualResetValue = 0x2705, // Manual Reset Value (Writable, Range: 0.0 to 100.0 %) [Adjustment Level] + E_HysteresisHeating = 0x2706, // Hysteresis (Heating) (Writable, Range: 0.1 to 999.9 for temp input / 0.01 to 99.99 for analog input) [Adjustment Level] + E_HysteresisCooling = 0x2707, // Hysteresis (Cooling) (Writable, Same range as Heating) [Adjustment Level] + E_ControlPeriodHeating = 0x2708, // Control Period (Heating) (Writable, Special values or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_ControlPeriodCooling = 0x2709, // Control Period (Cooling) (Writable, Special values or 1 to 99 s) [Initial Setting Level] (See E5C_ControlPeriod_SpecialVal) + E_PositionPropDeadBand = 0x270A, // Position Proportional Dead Band (Writable, Range: 0.1 to 10.0) [Adjustment Level] + E_OpenCloseHysteresis = 0x270B, // Open/Close Hysteresis (Writable, Range: 0.1 to 20.0) [Adjustment Level] + E_SPRampTimeUnit = 0x270C, // SP Ramp Time Unit (Writable) [Advanced Function Setting Level] (See E5C_SPRampTimeUnit_Param) + E_SPRampSetValue = 0x270D, // SP Ramp Set Value (Writable, 0=OFF or 1 to 9999 in units from 0x270C) [Adjustment Level] (See E5C_SPRampSetValue_SpecialVal) + E_SPRampFallValue = 0x270E, // SP Ramp Fall Value (Writable, -1=Same as Set, 0=OFF or 1 to 9999) [Adjustment Level] (See E5C_SPRampFallValue_SpecialVal) + E_MVAtStop = 0x270F, // MV (%) at Stop (Writable, Range: -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVAtPVError = 0x2711, // MV (%) at PV Error (Writable, Range: -5.0 to 105.0 / -105.0 to 105.0 varies) [Advanced Function Setting Level] + E_MVChangeRateLimit = 0x2713, // MV Change Rate Limit (Writable, 0.0=OFF or 0.1 to 100.0 %/s) [Advanced Function Setting Level] + E_PVInputSlopeCoeff = 0x2718, // PV Input Slope Coefficient (Writable, Range: 0.001 to 9.999) [Advanced Function Setting Level] + E_HeaterCurrent1ValueMonitor_Adv = 0x271A, // Heater Current 1 Value Monitor (Read-Only, 0.0 to 55.0 A) [ Seems redundant, matches 0x2003/0x2604] + E_HeaterBurnoutDetection1 = 0x271B, // Heater Burnout Detection 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent1Monitor = 0x271C, // Leakage Current 1 Monitor (Read-Only, 0.0 to 55.0? Units not specified, likely mA) [Operation Level] + E_HSAlarm1 = 0x271D, // HS (Heater Short?) Alarm 1 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_ProcessValueInputShift = 0x2723, // Process Value Input Shift (Writable, Range: -1999 to 9999) [Adjustment Level] + E_HeaterCurrent2ValueMonitor = 0x2724, // Heater Current 2 Value Monitor (Read-Only, 0.0 to 55.0 A) [Operation Level] + E_HeaterBurnoutDetection2 = 0x2725, // Heater Burnout Detection 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_LeakageCurrent2Monitor = 0x2726, // Leakage Current 2 Monitor (Read-Only, 0.0 to 55.0 mA?) [Operation Level] + E_HSAlarm2 = 0x2727, // HS (Heater Short?) Alarm 2 Setting (Writable, 0.0=OFF or 0.1 to 50.0 A) [Adjustment Level] + E_SoakTimeRemain = 0x2728, // Soak Time Remain (Read-Only?, Range: 0 to 9999) [Operation Level] + E_SoakTime = 0x2729, // Soak Time (Writable, Range: 1 to 9999) [Adjustment Level] + E_WaitBand = 0x272A, // Wait Band (Writable, 0=OFF, Range: 0.1 to 999.9 Temp / 0.01 to 99.99 Analog) [Adjustment Level] (See E5C_WaitBand_SpecialVal) + E_RemoteSPInputShift = 0x272B, // Remote SP Input Shift (Writable, Range: -1999 to 9999) [Advanced Function Setting Level] + E_RemoteSPInputSlopeCoeff = 0x272C, // Remote SP Input Slope Coefficient (Writable, Range: 0.001 to 9.999) [Advanced Function Setting Level] + + // --- Advanced Function Setting Level / Initial Setting (Addresses ~0x2800 - 0x2DFF) --- + E_InputDigitalFilter = 0x2800, // Input Digital Filter (Writable, Range: 0.0 to 999.9) [Advanced Function Setting Level] + E_MovingAverageCount = 0x2804, // Moving Average Count (Writable) [Advanced Function Setting Level] (See E5C_MovingAverageCount_Param) + E_ExtractionOfSquareRootLowCutPoint = 0x2808, // Extraction of Square Root Low-cut Point (%) (Writable, Range: 0.0 to 100.0) [Adjustment Level] + + E_InputType = 0x2C00, // Input Type selection (Writable, See E5C_InputType_Param) [Initial Setting Level] + E_TemperatureUnit = 0x2C01, // Temperature Unit selection (Writable, See E5C_TemperatureUnit_Param) [Initial Setting Level] + E_ScalingLowerLimit = 0x2C09, // Scaling Lower Limit (Writable, Range: -1999 to Scaling Upper Limit - 1) [Advanced Function Setting Level] + E_ScalingUpperLimit = 0x2C0B, // Scaling Upper Limit (Writable, Range: Scaling Lower Limit + 1 to 9999) [Advanced Function Setting Level] + E_DecimalPoint = 0x2C0C, // Decimal Point position for PV/SP (Writable, 0-3) [Advanced Function Setting Level] (See E5C_DecimalPoint_Param) + E_RemoteSPUpperLimit = 0x2C0D, // Remote SP Upper Limit (Writable, Range depends on input type/scaling) [Advanced Function Setting Level] + E_RemoteSPLowerLimit = 0x2C0E, // Remote SP Lower Limit (Writable, Range depends on input type/scaling) [Advanced Function Setting Level] + E_PVDecimalPointDisplay = 0x2C0F, // PV Decimal Point Display ON/OFF (Writable, See E5C_PVDecimalPointDisplay_Param) [Advanced Function Setting Level] + + E_ControlOutput1Signal = 0x2D03, // Control Output 1 Signal Type (Writable, See E5C_ControlOutputSignal_Param) [Initial Setting Level] + E_ControlOutput2Signal = 0x2D04, // Control Output 2 Signal Type (Writable, See E5C_ControlOutputSignal_Param) [Initial Setting Level] + E_SPUpperLimit = 0x2D0F, // SP Upper Limit (Writable, Range depends on input type/scaling) [] + E_SPLowerLimit = 0x2D10, // SP Lower Limit (Writable, Range depends on input type/scaling) [] + E_StandardOrHeatingCooling= 0x2D11, // Control Mode: Standard or Heating/Cooling (Writable, See E5C_ControlMode_Param) [] + + // --- Operation Level Parameters (Duplicated Address? / Specific Uses) (Addresses ~0x2900 - 0x29FF) --- + E_SP0_OperationLevel = 0x2900, // SP 0 Setting (Writable, Range: SP lower limit to SP upper limit) [Operation Level] (Likely same as E_SetPoint when SP 0 is selected) + E_AlarmValue1_OperationLevel = 0x2902, // Alarm Value 1 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValue1=0x2104) + E_AlarmValueUpperLimit1_OperationLevel = 0x2903, // Alarm Value Upper Limit 1 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValueUpperLimit1=0x2105) + E_AlarmValueLowerLimit1_OperationLevel = 0x2904, // Alarm Value Lower Limit 1 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValueLowerLimit1=0x2106) + E_AlarmValue2_OperationLevel = 0x2905, // Alarm Value 2 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValue2=0x2107) + E_AlarmValueUpperLimit2_OperationLevel = 0x2906, // Alarm Value Upper Limit 2 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValueUpperLimit2=0x2108) + E_AlarmValueLowerLimit2_OperationLevel = 0x2907, // Alarm Value Lower Limit 2 (Writable, Range: -1999 to 9999) [Operation Level] (May modify E_AlarmValueLowerLimit2=0x2109) + E_AlarmValue3 = 0x2908, // Alarm Value 3 (Writable, Range: -1999 to 9999) [Operation Level] + E_AlarmValueUpperLimit3 = 0x2909, // Alarm Value Upper Limit 3 (Writable, Range: -1999 to 9999) [Operation Level] + E_AlarmValueLowerLimit3 = 0x290A, // Alarm Value Lower Limit 3 (Writable, Range: -1999 to 9999) [Operation Level] + E_AlarmValue4 = 0x290B, // Alarm Value 4 (Writable, Range: -1999 to 9999) [Operation Level] + E_AlarmValueUpperLimit4 = 0x290C, // Alarm Value Upper Limit 4 (Writable, Range: -1999 to 9999) [Operation Level] + E_AlarmValueLowerLimit4 = 0x290D, // Alarm Value Lower Limit 4 (Writable, Range: -1999 to 9999) [Operation Level] + E_SP1_Setting = 0x290E, // SP 1 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 1) + E_SP2_Setting = 0x291C, // SP 2 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 2) + E_SP3_Setting = 0x292A, // SP 3 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 3) + E_SP4_Setting = 0x2938, // SP 4 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 4) + E_SP5_Setting = 0x2946, // SP 5 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 5) + E_SP6_Setting = 0x2954, // SP 6 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 6) + E_SP7_Setting = 0x2962, // SP 7 Setting (Writable, Range: SP lower limit to SP upper limit) [Adjustment Level] (Value for MultiSP selection 7) + + // --- Adjustment Level PID / MV Limits (Addresses ~0x2A00 - ...) --- + E_ProportionalBand = 0x2A00, // Proportional Band (Heating, Standard, or Close Position Control) (Writable, Range: 0.1 to 999.9) [Adjustment Level] + E_IntegralTime = 0x2A01, // Integral Time (Heating, Standard, or Close Position Control) (Writable, Range depends on time unit setting) [Adjustment Level] + E_DerivativeTime = 0x2A02, // Derivative Time (Heating, Standard, or Close Position Control) (Writable, Range depends on time unit setting) [Adjustment Level] + E_MVUpperLimit = 0x2A05, // MV Upper Limit (%) (Writable, Range depends on control type, see manual) [Adjustment Level] + E_MVLowerLimit = 0x2A06, // MV Lower Limit (%) (Writable, Range depends on control type, see manual) [Adjustment Level] + + // NOTE on Status Registers (e.g., E_Status1, E_Status2_LowerWord, E_Status2_UpperWord): + // These are bitfields. Refer to the E5C Communications Manual Section 5-2 "Status" + // for details on individual bit meanings. Explicit enums for these bits can be added if needed. + // Note *1: Not displayed on the Controller display. + // Note *2: In 2-byte mode, the rightmost 16 bits are usually read. + // Note *3: In 2-byte mode, the leftmost 16 bits are usually read. + // This suggests Status 2 (E_Status2_LowerWord/E_Status2_UpperWord) and potentially StatusWord3 (E_StatusWord3_Leftmost) + // might be parts of larger 32-bit status values if the controller supported 4-byte mode reads. +}; + +// --- Parameter Enums for Specific Holding Register Settings --- + +// Parameters for E_OperationAdjustmentProtect (0x2500) +enum class E5C_OperationProtect_Param : uint16_t +{ + E_NoRestrictions = 0x00, // No restrictions in operation and adjustment levels + E_AdjustLevelProhibited = 0x01, // Move to adjustment level is prohibited + E_DisplayChangePV_PVSP = 0x02, // Display and change of only "PV" and "PV/SP" allowed + E_DisplayOnlyPV_PVSP = 0x03, // Display of only "PV" and "PV/SP" allowed +}; + +// Parameters for E_InitialSettingCommsProtect (0x2501) +enum class E5C_InitialProtect_Param : uint16_t +{ + E_MoveToInitialAllowedAdvDisplayed = 0x00, // Move to initial/comms allowed. Adv func displayed. + E_MoveToInitialAllowedAdvNotDisplayed= 0x01, // Move to initial/comms allowed. Adv func not displayed. + E_MoveToInitialProhibited = 0x02, // Move to initial/comms prohibited. +}; + +// Parameters for E_SettingChangeProtect (0x2502) +enum class E5C_SettingChangeProtect_Param : uint16_t +{ + E_OffChangeAllowed = 0x00, // OFF (Changing settings via front panel allowed) + E_OnChangeProhibited = 0x01, // ON (Changing settings via front panel prohibited) +}; + +// Parameters for E_PF_KeyProtect (0x2503) +enum class E5C_PFKeyProtect_Param : uint16_t +{ + E_Off = 0x00, // PF Key Protection OFF + E_On = 0x01, // PF Key Protection ON +}; + +// Parameters for E_ParameterMaskEnable (0x2506) +enum class E5C_ParamMaskEnable_Param : uint16_t +{ + E_Off = 0x00, // Parameter Mask function OFF + E_On = 0x01, // Parameter Mask function ON +}; + +// Parameters for E_ChangedParametersOnly (0x2507) +enum class E5C_ChangedParamsOnly_Param : uint16_t +{ + E_Off = 0x00, // Display all parameters in adjustment level etc. + E_On = 0x01, // Display only parameters changed from default in adjustment level etc. +}; + + +// --- Special Values / Parameter Enums for specific registers --- + +// Special values for E_ControlPeriodHeating (0x2708) and E_ControlPeriodCooling (0x2709) +// Note: Positive values 1 to 99 represent seconds directly. Use raw integers for those. +enum class E5C_ControlPeriod_SpecialVal : int16_t // Use signed type for negative values +{ + E_Period_0_1_Sec = -2, // Represents 0.1 seconds + E_Period_0_2_Sec = -1, // Represents 0.2 seconds + E_Period_0_5_Sec = 0, // Represents 0.5 seconds + // Values 1..99 are direct seconds, do not add them here. Must be written as int16_t. +}; + +// Parameters for E_SPRampTimeUnit (0x270C) +enum class E5C_SPRampTimeUnit_Param : uint16_t +{ + E_EU_Per_Second = 0, // Unit is Engineering Unit / second + E_EU_Per_Minute = 1, // Unit is Engineering Unit / minute + E_EU_Per_Hour = 2, // Unit is Engineering Unit / hour +}; + +// Special value for E_SPRampSetValue (0x270D) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampSetValue_SpecialVal : uint16_t +{ + E_Off = 0, // SP Ramp Set is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as uint16_t. +}; + +// Special values for E_SPRampFallValue (0x270E) +// Note: Positive values 1 to 9999 represent the rate directly. Use raw integers for those. +enum class E5C_SPRampFallValue_SpecialVal : int16_t // Use signed type for negative value +{ + E_SameAsSet = -1, // Fall rate is same as Set rate (defined by 0x270D) + E_Off = 0, // SP Ramp Fall is OFF + // Values 1..9999 are direct rates, do not add them here. Must be written as int16_t. +}; + +// Special value for E_WaitBand (0x272A) +// Note: Positive values represent the band width directly (needs scaling based on Temp/Analog input). +// Use raw values for setting the width. +enum class E5C_WaitBand_SpecialVal : uint16_t +{ + E_Off = 0, // Wait Band function is OFF + // Other values represent the actual width. +}; + +// Parameters for E_MovingAverageCount (0x2804) +enum class E5C_MovingAverageCount_Param : uint16_t +{ + E_Off = 0, // Moving Average OFF + E_2_Times = 1, // Moving Average Count: 2 times + E_4_Times = 2, // Moving Average Count: 4 times + E_8_Times = 3, // Moving Average Count: 8 times + E_16_Times= 4, // Moving Average Count: 16 times + E_32_Times= 5, // Moving Average Count: 32 times +}; + +// Parameters for E_InputType (0x2C00) [Initial Setting Level] +enum class E5C_InputType_Param : uint16_t +{ + E_Pt_neg200_850C = 0, // Pt (-200 to 850°C / -300 to 1500°F) + E_Pt_neg199_500C_1DP = 1, // Pt (-199.9 to 500.0°C / -199.9 to 900.0°F) + E_Pt_0_100C_1DP = 2, // Pt (0.0 to 100.0°C / 0.0 to 210.0°F) + E_JPt_neg199_500C_1DP = 3, // JPt (-199.9 to 500.0°C / -199.9 to 900.0°F) + E_JPt_0_100C_1DP = 4, // JPt (0.0 to 100.0°C / 0.0 to 210.0°F) + E_K_neg200_1300C = 5, // K (-200 to 1300°C / -300 to 2300°F) + E_K_neg20_500C_1DP = 6, // K (-20.0 to 500.0°C / 0.0 to 900.0°F) + E_J_neg100_850C = 7, // J (-100 to 850°C / -100 to 1500°F) + E_J_neg20_400C_1DP = 8, // J (-20.0 to 400.0°C / 0.0 to 750.0°F) + E_T_neg200_400C = 9, // T (-200 to 400°C / -300 to 700°F) + E_T_neg199_400C_1DP = 10, // T (-199.9 to 400.0°C / -199.9 to 700.0°F) + E_E_neg200_600C = 11, // E (-200 to 600°C / -300 to 1100°F) + E_L_neg100_850C = 12, // L (-100 to 850°C / -100 to 1500°F) + E_U_neg200_400C = 13, // U (-200 to 400°C / -300 to 700°F) + E_U_neg199_400C_1DP = 14, // U (-199.9 to 400.0°C / -199.9 to 700.0°F) + E_N_neg200_1300C = 15, // N (-200 to 1300°C / -300 to 2300°F) + E_R_0_1700C = 16, // R (0 to 1700°C / 0 to 3000°F) + E_S_0_1700C = 17, // S (0 to 1700°C / 0 to 3000°F) + E_B_100_1800C = 18, // B (100 to 1800°C / 300 to 3200°F) + E_W_0_2300C = 19, // W (0 to 2,300°C / 0 to 3,200°F) + E_PLII_0_1300C = 20, // PLII (0 to 1,300°C / 0 to 2,300°F) + E_IR_K_140F_60C = 21, // Infrared temperature sensor (K 140°F/60°C) + E_IR_K_240F_120C = 22, // Infrared temperature sensor (K 240°F/120°C) + E_IR_K_280F_140C = 23, // Infrared temperature sensor (K 280°F/140°C) + E_IR_K_440F_220C = 24, // Infrared temperature sensor (K 440°F/220°C) + E_Analog_4_20MA = 25, // 4 to 20 mA + E_Analog_0_20MA = 26, // 0 to 20 mA + E_Analog_1_5V = 27, // 1 to 5 V + E_Analog_0_5V = 28, // 0 to 5 V + E_Analog_0_10V = 29, // 0 to 10 V + E_Analog_0_50mV = 30, // 0 to 50 mV (Only E5CC-U v2.2+ May 2014 or later) +}; + +// Parameters for E_TemperatureUnit (0x2C01) [Initial Setting Level] +enum class E5C_TemperatureUnit_Param : uint16_t +{ + E_Celsius = 0, // °C + E_Fahrenheit = 1, // °F +}; + +// Parameters for E_DecimalPoint (0x2C0C) [Advanced Function Setting Level] +enum class E5C_DecimalPoint_Param : uint16_t +{ + E_DP_0 = 0, // No decimal point (XXX) + E_DP_1 = 1, // One decimal place (XXX.X) + E_DP_2 = 2, // Two decimal places (XXX.XX) + E_DP_3 = 3, // Three decimal places (XXX.XXX) +}; + +// Parameters for E_PVDecimalPointDisplay (0x2C0F) [Advanced Function Setting Level] +enum class E5C_PVDecimalPointDisplay_Param : uint16_t +{ + E_PVDP_OFF = 0, // PV Decimal Point Display OFF + E_PVDP_ON = 1, // PV Decimal Point Display ON +}; + +// Parameters for E_ControlOutput1Signal (0x2D03) and E_ControlOutput2Signal (0x2D04) [Initial Setting Level] +enum class E5C_ControlOutputSignal_Param : uint16_t +{ + E_4_20MA = 0, // 4 to 20 mA + E_0_20MA = 1, // 0 to 20 mA +}; + +// Parameters for E_StandardOrHeatingCooling (0x2D11) [] +enum class E5C_ControlMode_Param : uint16_t +{ + E_Standard = 0, // Standard control (Heating OR Cooling, depending on wiring/config) + E_HeatingAndCooling = 1, // Heating and Cooling control +}; + + +// --- Enums for Status Register Bits (Refer to Manual Section 5-2) --- +// These are *examples* and need to be carefully verified against the specific E5C model manual. +// Define these if you need to decode individual status bits from registers like E_Status1, E_Status2_LowerWord, etc. + +/* +// Example bits for E_Status1 (0x2001) / E_Status1_StatusArea (0x2406) +enum class E5C_Status1_Bits : uint16_t +{ + E_S1_Alarm1_Output = (1 << 0), // Bit 0: Alarm 1 Output Status (0: OFF, 1: ON) + E_S1_Alarm2_Output = (1 << 1), // Bit 1: Alarm 2 Output Status + E_S1_Alarm3_Output = (1 << 2), // Bit 2: Alarm 3 Output Status + E_S1_Alarm4_Output = (1 << 3), // Bit 3: Alarm 4 Output Status (?) + E_S1_HeaterBurnout1 = (1 << 4), // Bit 4: Heater Burnout 1 Status + E_S1_HeaterBurnout2 = (1 << 5), // Bit 5: Heater Burnout 2 Status + E_S1_RunMode = (1 << 8), // Bit 8: RUN/STOP Status (0: STOP, 1: RUN) + E_S1_AutoTuning = (1 << 9), // Bit 9: AT Execution Status (0: OFF, 1: ON) + E_S1_TaskOperating = (1 << 10), // Bit 10: Task Operating Status (Programs) + E_S1_CommWritingDisabled= (1 << 11), // Bit 11: Communications Writing Disabled Status + E_S1_ManualMode = (1 << 12), // Bit 12: Auto/Manual Mode Status (0: Auto, 1: Manual) + E_S1_RemoteSP_Mode = (1 << 13), // Bit 13: SP Mode (0: Local, 1: Remote) + // ... add other relevant bits based on manual section 5-2 +}; +*/ + +/* +// Example bits for E_Status2_LowerWord (0x2408) +enum class E5C_Status2Lower_Bits : uint16_t +{ + E_S2L_RAM_Error = (1 << 0), // Bit 0: RAM Error + E_S2L_MemoryError = (1 << 1), // Bit 1: Memory Error (Non-volatile) + E_S2L_ADC_Error = (1 << 2), // Bit 2: A/D Converter Error + E_S2L_InputTypeError = (1 << 3), // Bit 3: Input Type Error + E_S2L_WatchdogTimeout = (1 << 4), // Bit 4: Watchdog Timer Timeout + E_S2L_OverrunError = (1 << 5), // Bit 5: Overrun Error + E_S2L_FramingError = (1 << 6), // Bit 6: Framing Error + E_S2L_ParityError = (1 << 7), // Bit 7: Parity Error + E_S2L_CommsTimeoutError = (1 << 8), // Bit 8: Communications Timeout Error + E_S2L_CommsError = (1 << 9), // Bit 9: Communications Error + E_S2L_CommsBufferOverrun = (1 << 10),// Bit 10: Communications Buffer Overrun Error + E_S2L_PowerSupplyFreqError = (1 << 11),// Bit 11: Power Supply Frequency Error + // ... add other relevant bits based on manual section 5-2 +}; + */ + +/* +// Example bits for E_Status2_UpperWord (0x2409) - Note: Bit numbering starts from 16 conceptually +enum class E5C_Status2Upper_Bits : uint16_t +{ + E_S2U_PV_InputError = (1 << 0), // Bit 16 (0 in upper word): PV Input Error (Over/Under Range) + E_S2U_RemoteSPInputError = (1 << 1), // Bit 17 (1 in upper word): Remote SP Input Error (Over/Under Range) + E_S2U_MVOutputError = (1 << 2), // Bit 18 (2 in upper word): MV Output Error + E_S2U_ExternalDIError = (1 << 3), // Bit 19 (3 in upper word): Error via External DI (Digital Input) + E_S2U_HeaterShortAlarm1 = (1 << 4), // Bit 20 (4 in upper word): HS (Heater Short) Alarm 1 Status + E_S2U_HeaterShortAlarm2 = (1 << 5), // Bit 21 (5 in upper word): HS (Heater Short) Alarm 2 Status + E_S2U_TempSensorDisconnected= (1 << 6), // Bit 22 (6 in upper word): Temp Sensor Disconnected (Specific models?) + // ... add other relevant bits based on manual section 5-2 +}; +*/ diff --git a/packages/kbot/tests/pdf/omron/prompt.md b/packages/kbot/tests/pdf/omron/prompt.md deleted file mode 100644 index e088d7c1..00000000 --- a/packages/kbot/tests/pdf/omron/prompt.md +++ /dev/null @@ -1,16 +0,0 @@ - -Extract all Modbus read & write registers, as Markdown table. If none can be identified, abort and return message "No registers found, Page Number XX" !! - - -## Columns -- type (read/write holding register/coil) as function code -- description -- address in Hex -- address in decimal -- parameter name -- if exists : settings / range -- if exists : level -- if exists : default -- Dont comment or explain, just return Markdown -- insert new lines before and after headers -- insert a descriptive chapter name, header level 3 with the page number