Page 1 of 1

Modbus Component

Posted: Sun Mar 12, 2017 9:37 pm
by Steve001
Evening All

Just having a play with modbus component and reading wiki

The frame type is this only available on the master or is it available on the slave component also

Code: Select all

Frame Type
This property is of type Fixed list of ints and can be referenced with the variable name FrameType.
Switches between RTU and ASCII forms of Modbus
Is there an example on how to set it ?

Steve

Re: Modbus Component

Posted: Tue Mar 14, 2017 10:49 am
by Benj
Hi Steve,

Both the Master and the Slave components should have the Frame type property allowing you to switch between RTU and ASCII communications methods for ModBus. There is currently no way to switch modes on the fly, is this what you were after?

The ASCII mode is probably less well tested by users so there is possibly bugs lurking that I'm not aware of.

Re: Modbus Component

Posted: Tue Mar 14, 2017 1:44 pm
by Steve001
Hi Ben

I was going to set the mode in a setup menu along with other things

Steve

Re: Modbus Component

Posted: Tue Mar 14, 2017 1:50 pm
by Benj
The only way I can think to allow this currently is to have two modbus master components in your program. One configured to be RTU and the other ASCII. You then decide which one to use based on which one has been specified.

I could allow it to be set in software using a single component but it will increase both the ROM and the RAM usage slightly. i.e. currently it only includes code for one method or the other but with a variable setting it would have to include code for both modes. Maybe I can add a third option to the property which is specified in software and this way it only adds bloat if you want to be able to switch between.

Re: Modbus Component

Posted: Tue Mar 14, 2017 6:51 pm
by Steve001
Hi Ben

Thank you for that, it was only a thought at the moment for playing with

Regards

Steve

Re: Modbus Component

Posted: Tue Mar 14, 2017 8:08 pm
by EtsDriver
If the framer could be set on the fly, the speed could also be set on the fly maybe? :)

Re: Modbus Component

Posted: Tue Mar 14, 2017 8:21 pm
by Benj
I'll have a play with the comms mode and see if it's a simple addition.

Speed change on the fly is certainly possible, it already exists in the CAL so we just need to expose it in the component.

Would you want these additions for both the master and slave?

Auto baud for the slave might be nice but would need to be added to the CAL for devices that support it, which certainly isn't all of them.

Re: Modbus Component

Posted: Wed Mar 15, 2017 11:37 am
by Benj
Right here are the new components with the variable frame type and baud rate.
Modbus.fcpx
(19 KiB) Downloaded 408 times
ModbusSlave.fcpx
(90.62 KiB) Downloaded 377 times
Let me know how you get on.

Re: Modbus Component

Posted: Fri Mar 17, 2017 11:47 am
by Benj
Just so you are aware, the Slave has had another couple of bug fixes here.
viewtopic.php?f=63&t=18424&start=25#p80279

Re: Modbus Component

Posted: Fri Mar 17, 2017 1:38 pm
by Steve001
hope to have a play this weekend

Cheers ben

Steve