Author Topic: Modbus 16bit addresses  (Read 200 times)

zipfrog2022

  • Newbie
  • *
  • Posts: 3
    • View Profile
Modbus 16bit addresses
« on: February 12, 2024, 01:21:17 PM »
I am working on setting up some fairly basic actuator controls. All my single bit items work fine. What I need to know is how to read a 16bit address or write a 16bit address.

To send a operation command lets say for open / closed its function code 06, offset is 4096, bit 0= open, bit 1=closed, bit 2= setpoint.

How would I read these or write these. I would like to either use selector switch to change from open close using the bits above or push button to send the open / closed commands.

Help understanding how to work with the 16bit addresses would be greatly appreciated.

Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Modbus 16bit addresses
« Reply #1 on: February 12, 2024, 01:31:03 PM »
AdvancedHMI uses function code 3 to read 16 bit registers and function code 16 to write them.

Normally you use addresses in the 40000+ range, such as 40001

I

zipfrog2022

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Modbus 16bit addresses
« Reply #2 on: February 12, 2024, 06:04:36 PM »
Can you not use function code 6? 16 is to write multiple registers and 6 is to write a single register.
AdvancedHMI uses function code 3 to read 16 bit registers and function code 16 to write them.

Normally you use addresses in the 40000+ range, such as 40001

I

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Modbus 16bit addresses
« Reply #3 on: February 12, 2024, 07:16:33 PM »
I checked the code and it will use function code 6 if there is only a single register to read.

zipfrog2022

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Modbus 16bit addresses
« Reply #4 on: February 13, 2024, 12:03:50 AM »
Ok

Thank You
I checked the code and it will use function code 6 if there is only a single register to read.