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

关于eMBMasterRegHoldingCB函数和eMBMasterFuncReadHoldingRegister函数的一点疑问 #22

Open
Vandoul opened this issue Aug 30, 2022 · 1 comment

Comments

@Vandoul
Copy link

Vandoul commented Aug 30, 2022

在user_mb_app_m.c的eMBMasterRegHoldingCB函数中直接将eMode赋值为MB_REG_WRITE了,然后
在mbfuncholding_m.c的eMBMasterFuncReadHoldingRegister函数中,使用MB_REG_READ 模式调用eMBMasterRegHoldingCB函数。
这种方式导致使得eMBMasterRegHoldingCB的eMode参数失去了意义,
感觉将eMBMasterRegHoldingCB中的eMode = MB_REG_WRITE;代码去掉,然后
eMBMasterFuncReadHoldingRegister函数中使用MB_REG_WRITE作为参数调用eMBMasterRegHoldingCB函数,这样从操作是否更合理一点?
同样的问题也存在线圈操作相关的接口。

@Vandoul
Copy link
Author

Vandoul commented Aug 30, 2022

也不合适,这样从机代码实现也就出问题了,最好的方式是修改主机接口的实现,目的是为了给APP提供访问寄存器表的接口,而不是使用全局变量直接访问数据

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

1 participant