DRV_mbus Slave Configuration – Using Multiple CS1030 Modules on X20CP0410

Hello, community. I have a question about the DRV_mbus slave.

I am working on a setup where I have one X20CP0410 CPU with seven CS1030 modules installed, and I am writing a program so that each module functions as an individual Modbus slave.

VCB_Sim[i].Comms.MBSOpen_0.pCoilStat   := ADR(VCB_Sim[i].Mem.MB0); (* FC 05 Control *)
VCB_Sim[i].Comms.MBSOpen_0.pInputStat  := ADR(VCB_Sim[i].Mem.MB1); (* FC 02 Status *)
VCB_Sim[i].Comms.MBSOpen_0.pInputReg   := ADR(VCB_Sim[i].Mem.MB3); (* FC 04 Measurement *)
VCB_Sim[i].Comms.MBSOpen_0.pHoldingReg := ADR(VCB_Sim[i].Mem.MB4); (* FC 03 Register *)

I have written my code like this. Am I using the MB variables incorrectly? I would like to know if there is an issue with structuring the code this way.

When configuring the MODBUS slave with the DRV_mbus library, the register variable name must be fixed in the MBx(arrary).

Hello,

You can also use local variables. However, please note the following:

  1. You must assign the address to a string containing the variable name.

  2. If you are using an array, you cannot use an index variable instead, you must assign a fixed index.

Regards,

Stephan