modbus slave

For general Flowcode discussion that does not belong in the other sections.
Post Reply
flowcode-developer
Posts: 37
http://meble-kuchenne.info.pl
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

Flowcode v10 modbus slave

Post 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.
Attachments
HexStrToInt.fcm
(3.04 KiB) Downloaded 27 times
Inspectra_macro.fcfx
(33.93 KiB) Downloaded 29 times

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: modbus slave

Post 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

flowcode-developer
Posts: 37
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

Re: modbus slave

Post 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.

flowcode-developer
Posts: 37
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

Re: modbus slave

Post 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?

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: modbus slave

Post 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

Post Reply