Write bit to Word using mark

Dear everyone
May you show me how to write a bit with mask to word?.
You can write for me “start without closing GCB” for an instance with mask: 2000h.
You can see in the attached file in the red circle.
Please attache the image.
Thank you very much
Best regards,
Bach


You just need to convert the mask from hex to binary and see which individual bit number it is masking - then you can address just that bit as a SQLTag and write to it.

8000h == 0x8000 == 0b1000000000000000 == bit 15

Hi Travis,
I tried but it dont operate.
I am not good at coding. So I dont know what is this error
I need your help
Best regards,
Bach


Can you post your code?

Kevin says:

You just need to convert the mask from hex to binary and see which individual bit number it is masking - then you can address just that bit as a SQLTag and write to it.

Jay says:

I’ll bet dollars to donuts that the Woodward Governor 3400/3500 Marine Genset doesn’t support Modbus bit-masked writes.

I talked to bach on the phone. The main problem was using Modbus address templating. You cannot use system.opc.readValue on a templated address so we had to convert all SQLTags to use regular Modbus address.

Secondly, the word he highlighted above was read-only but we could write to other words. Once all of that was figured out it was easy to figure out which bit based on the mask.