Page 302 - Programming Microcontrollers in C
P. 302

Chapter 6










            Large Microcontrollers



                              In this chapter we’ll examine the programming of systems em­
                          ploying large microcontrollers. The realm of the large-microcontroller
                          system is not all that different from the 8-bit systems. One of the
                          main advantages of the use of a high-level language is that it keeps
                          the nasty details of the underlying computer hidden from the pro­
                          grammer. Usually, the programmer will not see much difference
                          between the code for different types of computers. The fallacy to this
                          idea is that when programming any microcontroller, the program­
                          mer must know about and use all of the on-board peripherals found
                          on the microcontroller. These peripherals will vary from machine to
                          machine, and how they are accessed will differ from device to de­
                          vice. In this chapter, however, we are going to see an application
                          where a substantial amount of assembly language is required. The
                          chip that we are going to use here has a Digital Signal Processor
                          section. This processor is accessed through special core chip regis­
                          ters and the core condition code register. The abstract machine that
                          the compiler creates code for contains no registers. Therefore, the
                          only access to these features is through assembly language. We will
                          show how to create assembly language functions that can be accessed
                          from your C program.
                              The part that we will use for the 16-bit discussions is the Motorola
                          MC68HC16 family of components. These are similar to the MC68HC11
                          in many ways, but there are important differences. First, there are some
                          new registers that must be programmed directly to make the
                          MC68HC16 work as desired. (The only register in the MC68HC11
                          that must receive special assembly instructions is the condition code
                          register.) Also, the MC68HC16 does not have automatic stacking of its
                          registers when an exception occurs, unlike the MC68HC11. There­
                          fore, all interrupt service routines must begin with code that saves the

                                                                                       287
   297   298   299   300   301   302   303   304   305   306   307