Reputation: 380
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:
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.
Upvotes: 1
Views: 1079
Reputation: 514
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.
Upvotes: 0
Reputation: 2442
Just use a coil like this
then you can use the appropriate logic to turn off (i.e. equal to 0 ) or turn on (i.e. equal to 1).
Upvotes: 1