We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
sendbuf := []byte{0x40, 0x02, 0x00, 0x00, 0x00, 0x6E, 0xF6, 0xF7} n, err := s.Write(sendbuf) if err != nil { s.Close() fmt.Println("write close") log.Fatal(err) } buf := make([]byte, 128) n, err = s.Read(buf) if err != nil { fmt.Println("read close") log.Fatal(err) }
c := &serial.Config{Name: "COM5", Baud: 9600, ReadTimeout: time.Second * 5}
The text was updated successfully, but these errors were encountered:
You need to put read in a loop. Use the third byte to calculate total length.
If you need something that also takes timing into consideration and handles more opcodes, you can check out my code here https://github.com/xiegeo/modbusone/blob/master/packet_reader.go
Sorry, something went wrong.
Thanks ,I got it.
No branches or pull requests
run on window
The text was updated successfully, but these errors were encountered: