Page 371 - Analog and Digital Filter Design
P. 371

368 Analog and Digital Filter Design




                        one equals two. This is  a bit corny but  “one’s-complement, plus  one, equals
                        two’s-complement.  ”

                              Binary Number         01 1 1,011 1,0001,1010   (771Ah)
                              One’s Complement      1000,1000,1110,0101     (88E5h)
                              +1                    0000,0000,0000,000 1

                              Two’s Complement      1000,1000,1110,0110     (88E6h)

                        The two’s complement number 88E6h is therefore the negative signed equiva-
                        lent of  771Ah.

                        We can transform a hexadecimal number directly into a number with the same
                        magnitude but with a negative sign. This can be done without having to convert
                        it  into  binary  first. Transformation  is  done  by  subtracting  the  hexadecimal
                        number from FFFFh and then adding one:

                                                   FFFF
                              Subtract Number      771A
                              Result               88E5

                              Add 000 1 h          88E6

                        The result is a number with a magnitude equal to 771Ah but with a negative
                        sign. Alternatively, subtract the hexadecimal number from 1,0000h, or 2” where
                        n is the number of  bits in the original number. In this case  = 4.

                        Strangely, these techniques also work when going from a negative number to
                        find  its  positive  magnitude.  Logic indicates that  a  lh should  be  subtracted
                        instead of  added in this case. However, by using the same numbers, it can be
                        easily shown that an addition of lh is still required. The inversion process works
                        whether the number being inverted is positive or negative. The technique should
                        perhaps be thought of  as a sign-changing process.

                                                   FFFF
                              Subtract Number      88E6

                              Result               7719
                              Add 000 1 h          771A

                        The result is the magnitude of  the negative number. I will be using this tech-
                        nique in examples given later.
   366   367   368   369   370   371   372   373   374   375   376