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

The maximum number of supported Modbus functions is too short (IDFGH-10913) #34

Open
fj0207 opened this issue Aug 21, 2023 · 3 comments

Comments

@fj0207
Copy link

fj0207 commented Aug 21, 2023

The maximum number of supported Modbus functions MB_FUNC_HANDLERS_MAX is actually set to 16 and cannot be changed by configuration variable.
However Modbus specifications allow to define 19 user-defined functions in addition to the basic modbus functions.

MB_FUNC_HANDLERS_MAX should be increased or at least configurable. Using SDK config.

@github-actions github-actions bot changed the title The maximum number of supported Modbus functions is too short The maximum number of supported Modbus functions is too short (IDFGH-10913) Aug 21, 2023
@alisitsyn
Copy link
Collaborator

Hi fj0207,

Thank you for the issue. The current stack supports only the standard commands. The change of the MB_FUNC_HANDLERS_MAX to configurable value will not allow you to add your custom command. The custom function handler should be registered appropriately with specific API call. This functionality is not supported in stack v1.x.x because it is hard to support and track all related user issues later. However, it is planned to add this functionality later.
You will have to manually add your command handler to xMasterFuncHandlers(xFuncHandlers) function table . You can raise a feature request or submit a patch if you have one handy.

@fj0207
Copy link
Author

fj0207 commented Aug 21, 2023

Yes, indeed.
I simply did it by calling the eMBRegisterCB from my code. This function should be changed as public in modbus component to avoid adding declaration in user code.
Our modbus devices are using 9 user-defined functions with such modifications.

@alisitsyn
Copy link
Collaborator

alisitsyn commented Aug 21, 2023

This sounds good to me. I don't think it is good solution to make the function public. The external API interface will not be changed in this version of stack but the internal freemodbus API designed to be isolated from user application by upper modbus controller layer. Please consider this change as a private update for now.

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

No branches or pull requests

3 participants