1

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.

Seppe Mariën
  • 355
  • 1
  • 13
  • I don't think it's possible without using bit operations. Out of curiosity, why is a standard coil unavailable? – lcecl May 24 '21 at 20:18
  • It is for a school assignment and I actually didn't think about just using the coil as out. This is just a little part of my education and just to give an intro to PLC programming and I'm not used to it. I was so focussed on the move part that I didn't think about this. – Seppe Mariën May 25 '21 at 21:01

3 Answers3

1

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

enter image description here

lcecl
  • 326
  • 2
  • 11
1

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).

mrsargent
  • 2,267
  • 3
  • 19
  • 36
0

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.

kolyur
  • 457
  • 2
  • 13