Author Topic: Modbus RTU questions  (Read 1394 times)

kallileo

  • Newbie
  • *
  • Posts: 7
    • View Profile
Modbus RTU questions
« on: February 28, 2021, 06:35:36 AM »
I use Modbus RTU driver to connect to a Modbus slave.
The addressing scheme of the slave is 0 based so in order to read HR 400050 I have to put the address 400051 in basic label.
Is it possible to setup the AHMI driver to be 0 based as well?

The method modbusRTUCom1.CloseConnection() can be used to close the connection.
How can I reopen it?
« Last Edit: February 28, 2021, 06:42:43 AM by kallileo »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus RTU questions
« Reply #1 on: February 28, 2021, 07:44:00 AM »
The 0 base is the register offset. The 1 base is the Modicon style addressing. This follows the majority of the industry standard.

To re-open a connection, simply perform another read or write.

kallileo

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Modbus RTU questions
« Reply #2 on: March 03, 2021, 08:06:04 AM »
I trying to give the user the option to select the Com port through a ComboBox, as well as BaudRate and Modbus slave address.
As far as I understand if I drag n drop the Modbus driver into the form then the connection will be started automatically when the Form loads.
What if I want to start the connection manually after selecting the port, baudrate and slave address for example on button click and also be able to disconnect change comms settings and then connected again.
Do I need to read and write registers connected to BasicLabels manually?

Is there any example project that could help understanding how AdvancedHMI works?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus RTU questions
« Reply #3 on: March 09, 2021, 01:45:40 PM »
You can set the DisableSubscriptions to True in design view, then set it to false using code behind a button.

You can find some sample projects here:

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/SampleProjects/