Posts: 102
Threads: 28
Joined: Apr 2022
Reputation:
0
How do I define a bit number to an address?
51/0/0 should be bit 1
51/0/1 should be bit 2
mb.setswap('w')
mb.setfloat16precision(2)
mb.setmapping({
['*'] = {
registers = {
[12288] = '51/0/0',
[12288] = '51/0/1',
}
}
})
Posts: 5062
Threads: 28
Joined: Aug 2017
Reputation:
230
For bits you should use coli.
------------------------------
Ctrl+F5
Posts: 102
Threads: 28
Joined: Apr 2022
Reputation:
0
I´m trying to replicate exact modbuss points for a client, so we don´t have to change anything on their end.
We have 10 points first one 1288bit1 second 12288bit2 etc but how do I define that in the modbus slave script?
Posts: 5062
Threads: 28
Joined: Aug 2017
Reputation:
230
Register is just 2 byte value regardless of what value you write. This script allows only using numeric objects for registers so you must use extra script which will convert your bits into single value you use on this register.
------------------------------
Ctrl+F5
Posts: 55
Threads: 13
Joined: Oct 2023
Reputation:
1
You don't have a script where I can set the bit mask in a register?
So that i write a boolean value to a single bit in a holding register instead of converting to an int?
Posts: 8211
Threads: 43
Joined: Jun 2015
Reputation:
474
For master mode use profile together with value_bitmask and write_bitmask fields.
Posts: 55
Threads: 13
Joined: Oct 2023
Reputation:
1
But I can't set the LM up as SLAVE and define a bool value to bitmask in holding register?