Page 370 - Analog and Digital Filter Design
P. 370

Introduction to Digital Filters   3




                      Many DSP specific programs such as FIR filters and Fast Fourier Transforms
                      need  multiplication  and  addition,  and  possibly  subtraction,  so  before  the
                      budding  DSP engineer can have  programs running  he  should understand  the
                      basics of  signal-processing mathematics.

                      Many  devices (particularly  low-cost  ones)  use  fixed  point  numbers,  and  the
                      mathematics requires some thought. Fixed point DSP devices that have  16-bit
                      busses usually  use the notation  of  Q15: the Q represents the sign and the  15
                      represents the number of  binary characters after the decimal point; thus in this
                      notation all numbers have a magnitude of  less than one.


                      Binary and Hexadecimal
                      Each data sample, or filter coefficient, is a binary word of  16 or more bits. A
                      long series of  ones and zeroes is difficult to describe. In the computing world,
                      multiples of  3 bits are grouped together. Each group is  then converted into a
                      hexadecimal number and thus represents a decimal number between 0 and  16.
                      TQ signify a hexadecimal number a lower case h is appended. Decimal numbers
                      0 to 9 are the same in hexadecimal, but  decimal numbers  10 to  16 are repre-
                      sented by  A to F in hexadecimal. For the whole range,  binary 0000 becomes
                      Oh  and binary  11 11 becomes Fh. Many processors have a  16-bit bus; in  16-bit
                      format  1100,101 1,0110,flOl becomes CB6Dh.

                      How do we handle negative numbers? For these there is a different system where
                      the  most  significant bit  represents the  sign. The  sign  bit  is  a  0  for  positive
                      numbers  and a 1 for  negative numbers. In  16-bit hexadecimal, 7FFFh is  the
                      highest positive number (which is 32767 in decimal). Numbers 8000 h to FFFFh
                      are negative, with a maximum value of  -32768.  It would be possible for us to
                      simply change  the most  significant bit, depending on whether  the  number  is
                      positive or negative. Unfortunately this makes the mathematics difficult, so an
                      alternative method is used where all the bits are inverted and then one is added.
                      This system is known as two’s complement. To see where the name comes from,
                      and to explain further, I will have to use binary notation.


                      Two’s Complement
                      The complement of a binary number is found by inverting each bit in turn. This
                      is known as one’s complement:

                            Binary Number          100 1 ,0 101,110 1,lO 1 1

                            One’s Complement       0 1 10,lO 10,0010,0 100
                      A two’s-complement number is found by taking the one’s complement and then
                      adding a binary one to it. In simple terms this can be remembered as one plus
   365   366   367   368   369   370   371   372   373   374   375