News:

  • December 13, 2025, 08:00:50 PM

Login with username, password and session length

Author Topic: Modbus Scanner Write Registers with Offset  (Read 3461 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Modbus Scanner Write Registers with Offset
« on: March 03, 2022, 05:39:38 PM »
I'm trying to build a profile using the scanner tool. When I attempt to write two consecutive registers with no offset say (2799-2800) and only write to these two registers, the write performs as expected. If I instead start the write addresses at 2783 with a count of 18 in the comm setup then build a field attempting to write to 2799 using an offset of 16, this no longer performs the write as expected. Thoughts?   

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3774
    • Host Engineering
Re: Modbus Scanner Write Registers with Offset
« Reply #1 on: March 03, 2022, 05:42:46 PM »
I think there's a limit to the count to be 16.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6136
  • Yes Pinky, Do-more will control the world!
Re: Modbus Scanner Write Registers with Offset
« Reply #2 on: March 03, 2022, 05:50:10 PM »
Appears to be working fine.

@Franj - Only with the register defs.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6136
  • Yes Pinky, Do-more will control the world!
Re: Modbus Scanner Write Registers with Offset
« Reply #3 on: March 03, 2022, 05:55:07 PM »
And did it as two different conversion fields from N0 and N1. Worked there too.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Re: Modbus Scanner Write Registers with Offset
« Reply #4 on: March 03, 2022, 06:41:21 PM »
I tried it with the offset on a different device and it appears to be working correctly there. I'll have to do some more testing with the original device. 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6136
  • Yes Pinky, Do-more will control the world!
Re: Modbus Scanner Write Registers with Offset
« Reply #5 on: March 03, 2022, 06:50:38 PM »
I tried it with the offset on a different device and it appears to be working correctly there. I'll have to do some more testing with the original device.

Your device may be the issue. Many Modbus devices get weird over ranged accesses. You can open the scanner monitor to see if any errors are being reported.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Re: Modbus Scanner Write Registers with Offset
« Reply #6 on: March 03, 2022, 11:28:02 PM »
It appears to be the original device. With the attempted ranged access it's continuously incrementing the .ErrorCount. It also zeros the first address in the range (possibly all of the other addresses in the range as well). When I switch back to the non-ranged access, it appears to be working without issue with no increase in .ErrorCount. Reading with ranged access doesn't appear to be an issue. That's interesting. I've never seen this before. I guess I'll just have to individually access all of the registers I want to write to.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3774
    • Host Engineering
Re: Modbus Scanner Write Registers with Offset
« Reply #7 on: March 03, 2022, 11:51:47 PM »
Some devices don't support the Multiple Write FC (FC16 Write Multiple HRs), only the Single Write (FC6 Write Single HR).  Some are the opposite (force ou to do FC16 with count of 1).  The Master is a Slave to the Slave's implementation  ;)

OR, it could be that specific range is not supported - possibly try writing 2 in one comm and then the rest singles and see if that works.

ADC Product Engineer

  • Hero Member
  • *****
  • Posts: 270
Re: Modbus Scanner Write Registers with Offset
« Reply #8 on: March 04, 2022, 10:28:55 AM »
Also a lot of devices have "holes" in the memory ranges which will cause an error as well.  I don't understand why the vendors choose to do this other than lazy/inefficient/poor programming techniques.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6136
  • Yes Pinky, Do-more will control the world!
Re: Modbus Scanner Write Registers with Offset
« Reply #9 on: March 04, 2022, 11:14:58 AM »
Also a lot of devices have "holes" in the memory ranges which will cause an error as well.  I don't understand why the vendors choose to do this other than lazy/inefficient/poor programming techniques.

It's not always that straightforward. DL scratch pad is an excellent example. Some portions of memory are actual memory, some portions of memory are computed as requested, and some portions are really neither, they are effectively task codes masquerading as memory. The effort to make that appear to be flat memory can be considerable and with very low performance. Sometimes the juice isn't worth the squeeze.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO