Page 434 - Programming Microcontrollers in C
P. 434

A Clock Program     419

                              Table 8-2 Interrupt Controller Assignments
                                  Bit
                                                   Use
                                Number
                                 0, 1, 2        Software
                                   3              unused
                                   4             unused
                                   5        UART0 RTS_DELTA
                                   6           KPP control
                                   7        Time-of-day alarm
                                   8               PIT
                                   9             unused
                                   10            PWM0
                                   11            PWM1
                                   12            PWM2
                                   13            PWM3
                                   14            PWM4
                                   15            PWM5
                                   16        UART0 transmit
                                   17        UART1 transmit
                                   18         UART0 receive
                                   19         UART1 receive
                                   20             ISPI
                                   21             INT0
                                   22             INT1
                                   23             INT2
                                   24             INT3
                                   25             INT4
                                   26             INT5
                                   27             INT6
                                   28             INT7
                                   29            unused
                                   30            unused
                                   31            unused

            A Clock Program

                              A clock program is an excellent program for demonstrating the
                          use of interrupts on a microcontroller. The MMC2001 has a rather
                          extensive timer subsystem. It is broken into three parts. There is a
                          time of day clock, TOD, with a built-in alarm, a watchdog timer and
                          a programmable interval timer, PIT. We will use the PIT in this
                          example. Briefly, the timers are driven by a separate clock. The clock
                          here is a 32768-Hz clock controlled by a watch crystal. The TOD
   429   430   431   432   433   434   435   436   437   438   439