Page 1 of 1

Modbus Slave Register Mapping??

Posted: Sat Aug 26, 2017 1:37 am
by derfleznew
I have created a program for an ATMEGA328P, with an RS485 transciever chip tied to UART1, and need to be able to assign Modbus holding registers to Global variables, specifically for 40001+ registers that can be polled from an external Modbus Master. There is nothing anywhere I can find in FlowCode7 references for how to do this. The ModbusSlave1 component allows for setting up the number of coils, inputs, and Holding registers, however, that allocation needs to be tied to specific global variables. Does anyone know how to achieve this, or has done it and can share a code example?

Re: Modbus Slave Register Mapping??

Posted: Tue Aug 29, 2017 12:59 pm
by Benj
Hello,

The modbus slave RAM registers are created for you by the component and serviced by the CheckForIncoming macro.

The various Readxxx macros allow you to get the values of the modbus registers meaning you don't have to re-create the registers as global variables.

Hope this helps.