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

How to send a non-standard function code #86

Open
larrybarello opened this issue May 7, 2022 · 2 comments
Open

How to send a non-standard function code #86

larrybarello opened this issue May 7, 2022 · 2 comments
Labels
Usage Usage questions

Comments

@larrybarello
Copy link

larrybarello commented May 7, 2022

For a particular vendor, a custom function code ($78) with a payload of 0x0000, 0x0001, causes a reset to factory defaults. The response appears to be an echo of the request.

Is this possible without modifying minimalmodbus code?

i'm a newbie and attempted a subclass, and ran into trouble pretty quick when making a stripped down "read" method that just jammed in the values.

Could a generic write be exposed and allow the user jam in OEM functions? Or maybe a magic method that overrides the function code on the next transaction? Then the user can pick the closest transaction, override the function code. In my case "read_register(0)" and poke in the $78 This is an ugly solution, but presumably the user would know what they are doing if they tried it.

edit: this particular vendor also uses 0xFF as the broadcast address :(

@pyhys
Copy link
Owner

pyhys commented Jul 5, 2023

Hi!
It is possible to use the _perform_command() functionality as described in
https://minimalmodbus.readthedocs.io/en/stable/develop.html#extending-minimalmodbus

Note that it is outside the official API and is subject to future changes.

@pyhys pyhys added the Usage Usage questions label Jul 5, 2023
@larrybarello
Copy link
Author

larrybarello commented Jul 6, 2023 via email

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

No branches or pull requests

2 participants