Hi everyone,
I'm working on a project involving the Arduino MEGA 2560 and Modbus TCP. (I am using the "mudbus" library)
I've set a Modbus master object, a Modbus slave object, 13 Do channels, one Di channel and 3 Ai channels.
I made one Modbus object for each type of channel (function code Write multiple coils for the one with Do channels, Read coils for the one with Di channel and Read holding registers with Ai channels).
I represented the Do and Di channels in bit8, and the Ai in Int16.
I've set the number of channels in the following manner:
Do channels - from 0 to 12
Di channel - 13
Ai channels - 14 to 16
And I've set the Modbus settings in the Arduino IDE sketch exactly in the same pattern - according to the channel numbers
I performed a number of tests so far on the Do Channels, and I notice such anomalies:
Only channels from number 0 to 7 could be turned on and off (by setting their value in the object graph in the runtime) and their corresponding devices respond correctly. But, even though the channels number 8 to 12 could be turned on and off as well on Proview, there's no response from their corresponding devices. I've tried bit16 representation but it's still not working, and worse, the channels' relationship with their corresponding devices got distorted a bit (When turning on the value of a channel, it's the corresponding device of an another channel which respond by turning on)
So, please, I need help about to find out the answers to the following questions:
-Is it correct to configure the Modbus input/output settings in the Arduino IDE according to the channel numbers on Proview?
-Is there something to have with the address setting in the Modbus module?
-When and how to use the different representations: bit8, bit16, bit32, bit64...? And how could it affect the Modbus settings on the Arduino IDE sketch?
-Could I place channels of different types into the same Modbus module? If yes, how should I proceed?
I've sent screenshots of my settings on Arduino IDE and on Proview
Any help greatly appreciated.
Best regards.
/Maverick