Page 1 of 1

modbus slave

Posted: Thu Mar 02, 2023 1:27 am
by flowcode-developer
Hello,
I am using the AVR chipset with ATMEGA2560. I am really close to wrapping up my program. in my project I am sending a command to a device, get the data from the device and clean it, and lastly put the data into modbus registers.

My issue is with the modbus slave. I set the poll definition to slave ID 2, Function 03 reading holding registers. I have put my data into registers 100-104. I connect it to docklight to check if I have any errors. I do not have any error messages. I then modbus poll to read the registers but I keep getting error messages "Timeout Error" or "No Connection". Any advice? Thank you for your time. Attached is my code.

Re: modbus slave

Posted: Thu Mar 02, 2023 9:56 am
by RGV250
Hi,
Have you tried the master and slave simulators from here https://www.simplymodbus.ca/ to check that you are sending the right data format. It probably has enought capability in demo mode.

Bob

Re: modbus slave

Posted: Sat Mar 04, 2023 12:18 am
by flowcode-developer
Hi,
I got it going somewhat. I have some questions on the ModbusSlave::CheckforIncoming(). Does the return bit act like a bool? Does it work like a UART initialize? Do I need an interupt? I saw an example program on the wiki but I think it was a bit simple.

Re: modbus slave

Posted: Tue Mar 07, 2023 5:12 pm
by flowcode-developer
RGV250 wrote:
Thu Mar 02, 2023 9:56 am
Hi,
Have you tried the master and slave simulators from here https://www.simplymodbus.ca/ to check that you are sending the right data format. It probably has enought capability in demo mode.

Bob
Can I use this with flowcode simulation? How would I set it up in the simulation properties?

Re: modbus slave

Posted: Tue Mar 07, 2023 7:07 pm
by RGV250
Can I use this with flowcode simulation? How would I set it up in the simulation properties?
Probably not, I onlt used it with real hardware.

Bob