09.02.2022, 22:09
(09.02.2022, 07:52)admin Wrote: The value that you are writing has both bits 0 and 2 set which the Modbus device might reject. Log the returned write result. It might have an error indication.
Code:value = 4 -- bit 2 set to 1
res, err = mb:writeregisters(33471, value)
log(res, err)
Also keep in mind that using scripts can lead to random errors if two scripts try to access the same serial port in parallel. It is recommended to use profiles instead.
Hi Admin,
I tried the above and this is the result in de errorlog:
"* arg: 1
* nil
* arg: 2
* string: Illegal function"
Do you have tips where to move ahead?
I also have a modbus profile in place (attached) and this works great for reading values, I didn't yet try to use this for writing values.
Greets,
Jeroen
* arg: 1
* nil
* arg: 2
* string: Illegal function
* arg: 1
* nil
* arg: 2
* string: Illegal function