Page 406 - Programming Microcontrollers in C
P. 406

Summary      391

                          board. Loading the code into this board requires the use of another
                          development board, an HC12 FLASH PROGRAMMER. This board
                          contains an M68EVB912B32 board also. The code is downloaded
                          into the programmer board and from there it is transferred to the
                          FLASH memory on the second evaluation board. This combination
                          worked to program the FLASH, and it must be noted that the final
                          program worked as designed after one error was corrected.

            Summary

                              In writing this chapter, I have attempted to show that modular
                          development of a program can yield very satisfying results. The program
                          here was reduced to several relatively small functions that could each
                          be developed and tested separately. Then these functions were integrated
                          one-by-one to build the whole program. This is not to say that this
                          approach is less work. Several of the modules listed above are very
                          complicated and require careful design to make certain that they work
                          as desired. Some of these modules require almost invention. For
                          example, the means used to express the Huffman table in the decode
                          routine needed several different starts before a satisfactory one was
                          found. Recall that the complete binary tree needed to express a Huffman
                          code requires 2n–1 nodes where n is the number of items being encoded.
                          I felt that it was desirable to express this tree by an array with no more
                          than 2n–1 members. The array shown in Listing 7-7 contains exactly
                          2n–1 bytes. It took six different tries to arrive at this particular
                          representation, and hence the code to decode the data.
                              The reward was that the final code worked in the embedded
                          product with almost no error.
   401   402   403   404   405   406   407   408   409   410   411