MODBUS

Post Reply
DAVIDJOINER
Posts: 134
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 15 times

MODBUS

Post by DAVIDJOINER »

Hi

A general question

I have used Modbus many years ago so i know the general operation but have a question

Roughly how fast (order of magnitude) can i poll the slave and read back multiple 16bit holding registers (approx 16) from the ECIO using the set up below

The hardware i am using is

windows 11 7 core processor & APP developer
ECIO40P16 dspic

For fastest speed should i use serial RTU via the coms port or TCP/IP or ? (coms port would be easier for me if not much slower than TCP/IP ?)

The reason i ask is that the ECIO is monitoring and manipulating I/O ports locally continuously (ie micro seconds) ie very fast and i do not wish a

poll request to slow down this action as i could lose data whilst data is being sent backward / forward from slave to APP developer

Perhaps some interrupt philosophy could be used to help to interlace the relatively slow communication between the APP developer and the ECIO

fast local port monitoring and control any rough ideas or so

So before i start testing this in a hardware implementation on my bench any general hints / advice

Note i do realise that modbus is not the fastest protocol nowadays but for other reasons i would like to use it in this case

Best regards
David

DAVIDJOINER
Posts: 134
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 15 times

Re: MODBUS

Post by DAVIDJOINER »

Hi Folks

Managed to answer my own question

Over the weekend i was able to set up a physical hardware system and with aid of a logic analyser and using additional

interrupts on the RX line and timers was able to reduce the max loading in the slave down to less than 0.3mS after detecting rx activity from a

master to single slave at 115200 baud

This will now be fine for me to incorporate into my project

David

DAVIDJOINER
Posts: 134
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 15 times

Re: MODBUS

Post by DAVIDJOINER »

Hi Steve

Enclosed is a simple APP program for illustrating the point i was raising

The program scans 11 registers from Modbus slave 1 ( also updates the slave register 6 to test the writing)

This all works fine when connected to an ECIO40P16 running Modbus RTU at 115200 Baud

The issue i have is that the APP developer seems to have a fastest scan rate around .4 seconds

I would like to be able to scan around 100mS

I also note that the event comment in the APP has a minimum event time of 1 second ie i would like to be able to set it to 100mS as above

Any possibility to do this

Best Regards
David
Attachments
DAJ MODBUS APP TEST REV 0.fcsx
(14.38 KiB) Downloaded 20 times

BenR
Matrix Staff
Posts: 1009
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 243 times
Been thanked: 334 times

Re: MODBUS

Post by BenR »

Hi David,

The Modbus Master SCADA component currently reads data in until it gets a timeout to ensure it has collected everything. You could try reducing the UART Receive Timeout property and this should speed things up a bit. I'll see if I can rework the component a bit so that it doesn't rely on getting a timeout.

The Silent interval property also sets a delay in ms between messages so you can also reduce this to speed up the comms.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

DAVIDJOINER
Posts: 134
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 15 times

Re: MODBUS

Post by DAVIDJOINER »

Hi Ben

Thanks for your comments

Have reduced further the receive and timeout properties and a bit better

Also as i said before is it possible to modify the APP event trigger to enter miili seconds rather than seconds as this would be better

Although do not reaaly want to but if i were to change to MODBUS TCP would that speed the overall screen response time or is it limited by the APP developer itself

David

BenR
Matrix Staff
Posts: 1009
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 243 times
Been thanked: 334 times

Re: MODBUS

Post by BenR »

Hi David,

For millisecond based timed events it might be better to use the built in API timer, note that delays using this will be approximate and delays less than 50ms will end up being at least 50ms due to the nature of the Windows OS.

For the example I enabled the following events using the Events tab of the project explorer window:

System -> Timer - Ev_Timer - Performs the regular timed background event and rearms the timer.

Simulation -> Start - Ev_Start - Starts the timer running
Simulation -> Resume - Ev_Start - Starts the timer running

Simulation -> Stop - Ev_Stop - Stops the timer running
Simulation -> Pause - Ev_Stop - Stops the timer running

The rate of the timer is controlled via the TIMERDELAYMS constant.

TimerExample.fcsx
(11.36 KiB) Downloaded 19 times

The delay with using the serial modbus is down to the current need for a timeout, we should be able to remove this for you and then it should run much faster.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

BenR
Matrix Staff
Posts: 1009
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 243 times
Been thanked: 334 times

Re: MODBUS

Post by BenR »

I've pushed an update to the Modbus component onto the library update system for you. Hopefully it should improve things further.

Let us know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

DAVIDJOINER
Posts: 134
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 15 times

Re: MODBUS

Post by DAVIDJOINER »

Hi Ben

That's great now faster and suitable for my current Project needs

As an aside over next week or so i will also now try the MODUS TCP option using a ESP32 WROOM just to see if any benefits switching from my dspic33 to ESP32

Many thanks again

David

Post Reply