Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Preset) Write Single Register (6) incorrect value transmission #16

Open
Pratched opened this issue Mar 20, 2023 · 3 comments
Open

(Preset) Write Single Register (6) incorrect value transmission #16

Pratched opened this issue Mar 20, 2023 · 3 comments
Assignees

Comments

@Pratched
Copy link

Pratched commented Mar 20, 2023

I was trying to see if my FunctionCode 0x06 works alright, but realised that the implementation in Modbusmechanic v2.5 seems to be a little bit faulty?

When I setup the simulator as Holding Register 50000 (UINT16), no swaps, I am not able to overwrite this value with FnC 0x06 correctly. No matter what I want to write, it always defaults to 0. Attached youl find screenshots of the WireShark capture of different write requests, always with the same data value.

ModbusMechanic client with 0x06 request and value=5.
grafik

WireShark Output for my own implementation, same settings.
grafik

ModbusMechanic client with 0x10 request and value=5 seems to work okay...
grafik
... but as far as I understand simply writing one register (u16) should be possible with 0x06 as well?

Sorry in advance, if I missed something.
EDIT: My understandings in this are based on "MODBUS APPLICATION PROTOCOL SPECIFICATION
V1.1b3" from Modbus.org but might be oudated.
grafik
grafik

@SciFiDryer
Copy link
Owner

Thanks for testing and reporting this bug. I was able to reproduce and correct it to the extent that I can in f6d0839. I identified an underlying bug in JLibModbus that prevents values larger than 32767 from being accepted as the register value, so the values for the write single register function will be limited from 0-32767.

@Pratched
Copy link
Author

Pratched commented Mar 21, 2023

No worries. Address 50000 was just the easiest workaround for testing purposes. Some sources additionally limit the register address to specific ranges based on functioncode (Ive never seen 50000 used somewhere anyway).

Cheers.
PS: The english word Register as a noun (not a verb in terms of to register) translates in German to Register as well. Its not commonly used very much, but still valid. Registrieren would be the verb.

@SciFiDryer
Copy link
Owner

Feedback from a native speaker is helpful. I am using auto translation for the localization. The DE localization has been updated. You'll see it in the next release which also includes a TCP and RTU register scanner for devices where the register numbers are not known.

Just to clarify, the value of the register being written using function code 6 is what is limited to 32768. The registers themselves can go up to the full 65535. Of course you could always use function code 16 to write a value higher than 32768 if you need to do it in the GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants