D
Hi,
I'm having trouble understanding Modbus Function Code FC22 (0x16) Mask Write Register.
Modbus aside, as I understand it if I was to write a single bit inside a register I could use an AND or OR mask depending on the value. eg, Register && AND_mask, Register || OR_mask.
I can't relate this to the functions algorithm of:
Result = (Current Contents AND And_Mask) OR (Or_Mast AND (NOT And_Mask)
Please could somebody explain this algorithm a little more for me, and maybe give an example of how to write to a specific bit inside an integer using this function. That would really help!
Thanks in advance
DB
I'm having trouble understanding Modbus Function Code FC22 (0x16) Mask Write Register.
Modbus aside, as I understand it if I was to write a single bit inside a register I could use an AND or OR mask depending on the value. eg, Register && AND_mask, Register || OR_mask.
I can't relate this to the functions algorithm of:
Result = (Current Contents AND And_Mask) OR (Or_Mast AND (NOT And_Mask)
Please could somebody explain this algorithm a little more for me, and maybe give an example of how to write to a specific bit inside an integer using this function. That would really help!
Thanks in advance
DB