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

Register value out of range : 65280 #52

Open
Andrii10 opened this issue Jun 17, 2020 · 3 comments
Open

Register value out of range : 65280 #52

Andrii10 opened this issue Jun 17, 2020 · 3 comments

Comments

@Andrii10
Copy link

Hello I have problem with last version jlibmodbus 1.2.9.7
when I use function x05 WriteSingleRegister
in
public void setValue(int value) throws ModbusNumberException {
if (!Modbus.checkRegisterValue(value)) {
throw new ModbusNumberException("Register value out of range", value);
}
this.value = ((short) value) & 0xffff;
}

I take error Register value out of range : 65280
in method
static public boolean checkRegisterValue(int value) {
return checkRange((short)value, 0, Modbus.MAX_REGISTER_VALUE);
}

And I fix the checkRange(value, 0, Modbus.MAX_REGISTER_VALUE) after that it worked for me
Did this right or not help me?

@FutureGUIs
Copy link

I just had to do the same thing, remove the 'short' cast. and so far it's working fine for me.

@jonasgerne
Copy link

Having the same issue, using writeMultipleCoils as a workaround...

@kochedykov
Copy link
Owner

Yes. It is a bug. Please make a pull request.

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

4 participants