Hello Guest it is April 18, 2024, 09:20:55 AM

Author Topic: Best way work with Modbus  (Read 606 times)

0 Members and 1 Guest are viewing this topic.

Best way work with Modbus
« on: February 04, 2022, 12:55:44 AM »
i have question about the way work with modbus
i can each  time i want data or send data open the com send then close the com
second way is establish the com then not close it until close much
first option have advantage that less problems with com fail and save computer time
but second option give me the advantage of listen of avent like error..
what do you think?
Re: Best way work with Modbus
« Reply #1 on: February 07, 2022, 07:01:39 AM »
I'm not an expert on this (see my previous posts for evidence  ;)) but I think it's pretty much the standard to open the channel (I'm assuming Serial/RS485 or similar) and keep it open.

Opening the COM port and establishing a connection is orders of magnitude slower than sending actual traffic once the port is open. Also, if you want to read information via MODBUS then you'll be polling the COM port many times per second.

With regard to saving computer time, the processing power needed to maintain a serial connection is negligible to any modern computer and by modern, in this case I mean any PC less than 20 years old.

If you're having regular communication port failures then it could be that you've a lot of electrical noise in your system and it could be worth trying to resolve that. VFDs can be a particular source of electrical noise. In my experience the popular low cost Huanyang brand of VFDs were incredibly noisy, I gave up trying to resolve that with shielding and grounding and just replaced them with other brands.

Hope this helps

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: Best way work with Modbus
« Reply #2 on: February 16, 2022, 02:15:13 PM »
To me, the overhead of opening and closing the com ports will consume far more processor power than just leaving the connection open.  You can then determine and/or vary the interval to poll the devices to save CPU if needed.  If you have com failures, just close and reopen the port.  However, you should NOT have com failures.  If you do, then you have to fix that problem first.

Steve
Re: Best way work with Modbus
« Reply #3 on: February 17, 2022, 04:13:39 PM »
thanks alot (each time i see steve you back here its give me good feeling of real good back )no i dont have any problems with com failure
i just not know whic way more bother the cpu