Rockwell-automation 1771-OFE/B Analog Output Module User Manual Manuel d'utilisateur Page 77

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 84
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 76
C-3
   
Two’s complement binary is used with PLC-3 processors when
performing mathematical calculations internal to the processor. To
complement a number means to change it to a negative number. For
example, the following binary number is equal to decimal 22.
10110
2
= 22
10
First, the two’s complement method places an extra bit (sign bit) in
the left-most position, and lets this bit determine whether the number
is positive or negative. The number is positive if the sign bit is 0 and
negative if the sign bit is 1. Using the complement method:
0 10110 = 22
To get the negative using the two’s complement method, you must
invert each bit from right to left after the first “1” is detected.
In the above example:
0 10110 = +22
Its two’s complement would be:
1 01010 = -22
Note that in the above representation for +22, starting from the right,
the first digit is a 0 so it is not inverted; the second digit is a 1 so it is
not inverted. All digits after this one are inverted.
If a negative number is given in two’s complement, its complement
(a positive number) is found in the same way:
1 10010 = -14
0 01110 = +14
All bits from right to left are inverted after the first “1” is detected.
The two’s complement of 0 is not found, since no first “1” is ever
encountered in the number. The two’s complement of 0 then is still 0.
Two's Complement Binary
Vue de la page 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 83 84

Commentaires sur ces manuels

Pas de commentaire