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

illegal function #68

Open
Zichen0829 opened this issue Oct 23, 2020 · 1 comment
Open

illegal function #68

Zichen0829 opened this issue Oct 23, 2020 · 1 comment

Comments

@Zichen0829
Copy link

modbus: exception '1' (illegal function), function '131'
Always inform there is a error.
I only used very simple modbus/Tcp example like that.
What's wrong with that? I also used modbus slave and choose 03 holding register.

package main

import (
"fmt"
"github.com/goburrow/modbus"
)

func main() {
cli := modbus.TCPClient("127.0.0.1:502")
res, err := cli.ReadHoldingRegisters(0, 3)
fmt.Println(res)
fmt.Println(err)

}

@nimahkh
Copy link

nimahkh commented Nov 10, 2020

Did you test the device with modpoll? first test the device and be sure that data is coming from tools. then check that the addresses and quantity are right. some time, this error happened when you give wrong address. mot of devics are working with slave 1. and also check the port, maybe our port is 1000 or 1001, you can check it with telnet.

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