Setting single bit Siemens ladder

721 views Asked by At

I have a value stored in MW20 and I need to set to most significant bit to 0 without using bit operations but I don't find how I need to do this. I know this:

     ----> MB20 = D7
    /
MW20 = D7C5
    \
     ----> MB21 = C5

So I need to set the last bit of MB20 to 0. I thought this was going to be as easy of doing a move from 0 to M20.7 but no I get this error:

enter image description here

I don't understand that it is this hard to set an individual bit. I have searched far and wide but can't find a solution. As a reminder I cannot use bit operations and I'm use LADDER on Siemens PLC.

3

There are 3 answers

0
lcecl On BEST ANSWER

You could use a standard coil tied to the bit in question.

enter image description here

0
mrsargent On

Just use a coil like this

enter image description here

then you can use the appropriate logic to turn off (i.e. equal to 0 ) or turn on (i.e. equal to 1).

0
kolyur On

You could logically AND the MW20 register with 0x7FFF (that's 2#0111111111111111) to clear the most significant bit. I believe the Siemens instruction is WAND_W.