News:

  • May 30, 2026, 03:11:33 PM

Login with username, password and session length

Author Topic: How to invert all bits within a word.  (Read 5810 times)

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
How to invert all bits within a word.
« on: August 13, 2021, 06:46:30 PM »
What is the best, quickest way to invert all bits within a u-word?
   I want to write commands (start/stop/auto/off) to a Genset, which requires a  code number to be written to one register, and the same write action has to write the ones-complement of that code to a second register.   Attached are a few rungs of code that accomplish this, but I'm sure there is such an instruction somewhere.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: How to invert all bits within a word.
« Reply #1 on: August 13, 2021, 09:09:14 PM »
MATH V102=~V101. Bit-wise invert, Help Topic DMD0537.

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: How to invert all bits within a word.
« Reply #2 on: August 14, 2021, 10:18:39 AM »
  Great, thanks.