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

如何往多个寄存器分开写值 #20

Open
chakloong883 opened this issue Jun 15, 2022 · 4 comments
Open

如何往多个寄存器分开写值 #20

chakloong883 opened this issue Jun 15, 2022 · 4 comments

Comments

@chakloong883
Copy link

我想用modbustcp在一个地址的连续两个寄存器分开写两个值,请问是如何写入?实例好像都是写一个值

@zhaopeiym
Copy link
Owner

https://github.com/zhaopeiym/IoTClient/blob/master/README-zh_CN.md#modbustcp%E8%AF%BB%E5%86%99%E6%93%8D%E4%BD%9C

//6、批量读取
var list = new List<ModBusInput>();
list.Add(new ModBusInput()
{
    Address = "2",
    DataType = DataTypeEnum.Int16,
    FunctionCode = 3,
    StationNumber = 1
});
list.Add(new ModBusInput()
{
    Address = "2",
    DataType = DataTypeEnum.Int16,
    FunctionCode = 4,
    StationNumber = 1
});

@chakloong883
Copy link
Author

var list = new List();
list.Add(new ModBusInput()
{
Address = "2",
DataType = DataTypeEnum.Int16,
FunctionCode = 3,
StationNumber = 1
});
list.Add(new ModBusInput()
{
Address = "2",
DataType = DataTypeEnum.Int16,
FunctionCode = 4,
StationNumber = 1
})

这个是批量读取,我是想写入数值,功能码是16的话该怎么写?

@zhaopeiym
Copy link
Owner

批量写入暂时没提供。

@chakloong883
Copy link
Author

但是功能码16不是应该可以写入多个寄存器?

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