Page 356 - Programming Microcontrollers in C
P. 356

Digital Signal Processor Operations   341

                              Next, the circular convolution program is executed 64 times. These
                          results are stored in the array point[]. This array is then sent out
                          the terminal eight numbers at a time. A few lines of code are ex­
                          tracted from Figure 6-2 to make the putchar() function. Finally,
                          the function dprint() sends the data out of the serial port to the
                          terminal. The output from this program is as follows :
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64
                          64 64 64 64 64 64 64 64

                              This program is merely a test program to show that the circular
                          convolution does indeed work. The fact that the output data is always
                          the same value, decimal 64, shows that the addresses are handled
                          correctly inside of the circular convolution. Let us examine first to
                          determine why the answer should be 64. The coefficients and data
                          are each 0x100. Two of these values are multiplied and summed 32
                          or 0x20 times. Therefore, one would expect that the result would be
                          0x20000. However, you must remember that each of the above
                          products is in fact the product of two binary fractional numbers. The
                          binary point in each case is between bit numbers 14 and 15. The
                          product of these numbers will yield 0x1000, but in that case, with
                          the binary point between bits 29 and 30. Actually, the binary point
                          dictated by the microcontroller is between bits 30 and 31. The an­
                          swer is corrected to this binary point location in the M register, and
                          the result of the product is then 0x20000. This number is summed
                          32 times and the final result is 0x400000. When the M register is
                          moved into the E register and then into the D register, the value that
                          is saved is 0x40, or 64, as the test program showed.
                              Remember Equation 6-1 for the convolution:

                                   n–1
                              y =     x   h
                               k  ∑  k–i   i
                                   i=0
   351   352   353   354   355   356   357   358   359   360   361