How to add MODBUS coils in MCXD

Danfoss How to add MODBUS coils in MCXD User guide

  • I've reviewed the provided operating guide and I'm ready to help with any questions you have regarding adding MODBUS coils in MCXD. The document explains how to configure the system to support reading single or groups of 16 coils by editing several code files, as well as assigning coils to different types of variables. Feel free to ask me anything about it.
  • What is the purpose of this guide?
    How many coils can be read per task?
    Which files need to be edited to enable MODBUS coils?
Summary
Description
How to make the MCXD support MODBUS coils.
Following are the steps to support MODBUS coils with MCXD.
Will be allowed to read a single coil or group of 16 coils per task:
1. Add the functionalities into the "InitDefines.c" file:
//Enable to use Coils for Modbus Slave
#define MODBUS_SUPPORTCOILS
#ifdef MODBUS_SUPPORTCOILS
#define MODBUS_COILS_OFFSET 50000
#endif
2. Add the file "AdditionalCoilTable.c" into the folder... \App
3. Edit "AdditionalCoilTable.c" setting the boolean variables to the coils:
a. For "Alarms": the variables' name are in the column "Variable name" in the tab called "Alarms"
b. For "Digital Input": the variables' name are in the column "Name" in the tab called "Digital
Input"
c. For "Digital Output": the variables' name are in the column "Name" in the tab called "Digital
Output"
d. For "Hot Spot": the variables' name is "MyApp. Hot spot name"
Operating Guide
How to add MODBUS coils in MCXD
AQ397218417593en-000101 | 1
© Danfoss | Climate Solutions | 2021.11
4. Edit the "main.c" file by adding "TTimer MainLoopTimer"; just before the instruction:
#ifdef MODBUS_SUPPORTCOILS
#include "AdditionalCoilTable.c"
#endif
5. Edit the "main.c" file by adding "IOMng.Run( )"; just before the instruction:
#ifdef MODBUS_SUPPORTCOILS
SetValuesOfCoils( );
#endif
© Danfoss | Climate Solutions | 2021.11 AQ397218417593en-000101 | 2
/