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

Serial I/O #129

Open
SY6502 opened this issue Sep 14, 2024 · 1 comment
Open

Serial I/O #129

SY6502 opened this issue Sep 14, 2024 · 1 comment
Labels

Comments

@SY6502
Copy link

SY6502 commented Sep 14, 2024

I found "ReadTimeout { get; set; } = 1000;" in ModbusRtuClient.cs. Is this 1s timeout the best value? I read in some device's Modbus docs that max timeout for response is 5 seconds. I am not sure is this the Modbus standard or specific timeout for this device.

I also see that default baud rate is 9600. Is this recommended speed? If devices support 115200, is there reason not to use it?

And one recommendation - it may be good to have method like RawRW. Instead of ReadHoldingRegisters or WriteSingleCoil, its parameters include byte array of whole command (without CRC for RTU). unitIdentifier can be included in command or sent as separate parameter.

@Apollo3zehn Apollo3zehn added the v6 label Sep 19, 2024
@Apollo3zehn
Copy link
Owner

Apollo3zehn commented Sep 19, 2024

I found "ReadTimeout { get; set; } = 1000;" in ModbusRtuClient.cs. Is this 1s timeout the best value? I read in some device's Modbus docs that max timeout for response is 5 seconds. I am not sure is this the Modbus standard or specific timeout for this device.

I am not aware of any timeout mentioned in the specs. Could you point me to the document where the 5s timeout is mentioned?

I also see that default baud rate is 9600. Is this recommended speed? If devices support 115200, is there reason not to use it?

9600 is the default value of the underlying System.IO.Ports.SerialPort, so I just copied the default from Microsoft. Also, I've found that 9600 is a pretty common value for serial communication devices. You can change to 115200 if you need more speed, but the downside is that the higher the BAUD rate, the more susceptible the signal becomes to signal interference, and the need for proper cable shielding rises.

And one recommendation - it may be good to have method like RawRW. Instead of ReadHoldingRegisters or WriteSingleCoil, its parameters include byte array of whole command (without CRC for RTU). unitIdentifier can be included in command or sent as separate parameter.

Thanks, I will put it on my v6 TODO list.

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

No branches or pull requests

2 participants