Bit-Level Addressing Function Code

Hi guys, currently I facing a problem with the Function Code.

My device address is [SIG]HR1.10 and when I write a boolean "True" it will give me Function Code 22.
When I changed my device address to [SIG]HR1 and it will give me Function Code 06 or 16 depends on the device I have force or unforce the multiple write option but the input is not write on the number 10-bit.

As I saw in manual, when I use Bit-Level Addressing, it will auto do Mask Write which is Function Code 22.

My question is do I have method to use [SIG]HR1.10 (Bit-Level Addressing) to achieve Function Code 06 or 16?

Function codes 6 and 16 write one or more whole registers. Function code 22 can manipulate one or more individual bits. Only function code 22 can do that.

What do you really need to happen?

If it's because your device doesn't support Mask Write Register, you can use the workaround described here.

It basically forces the masking to happen at a higher level, and then a whole register to be written, with the drawback that it's prone to a race condition where the register can change underneath you causing bits to be clobbered.

2 Likes

Actually the situation is:
Tag A = Memory Tag (Boolean)
Tag B = [SIG]HR1.10 (Boolean)

The Tag A value will write to Tag B when Tag Change. I will get Function Code 22.

Is there any method to get Function Code 06 or 16 if I want to manipulating the bit?

Only what I suggested above.

Am I allow to write without mask for manipulating the bit?

No, without the mask function code, the actual write is for the whole register. If you follow the linked topic, it shows how to read the register, do the mask in Ignition, and then write the register.

(I'm going out on a limb--you probably have a Schneider PLC. In spite of being the commercial heirs to the creators of the Modbus protocol, they have the worst implementation. Specifically, lacking function 22.)