Page 402 - Programming Microcontrollers in C
P. 402
Putting It All Together 387
your program, you can automatically compile only those files
modified since they were last compiled.
There are a couple of additional files needed to complete the
program for the phone book. The first is the interrupt vector table.
The vector table is stored in nonvolatile memory on this system, and
as such, it is best to write a C program that creates this table. This
little program is compiled and linked just like any other module in
the program. It will be linked as a constant section at the address
0xFFCE. The interrupt vector table program is shown in Listing 7
18. There is only one external module to be linked to this particular
table. It is _stext(). The function prototype for this function is
included at the beginning of the program, and its name is placed in
the proper vector location. Recall from our earlier discussion of
complicated declarations that the line of code
void (* const _vectab[])()
tells us that _vectab is an array of constant pointers to functions
that return the type void. The addresses of the various entries in the
array of pointers to functions begin at the memory location 0xFFCE.
The remainder of the vectors that follow each have a specific use,
and if there were an interrupt service routine needed for the program,
its address would be placed in the corresponding location.
/* INTERRUPT VECTORS TABLE 68HC912B32
* Copyright (c) 1997 by COSMIC Software
*/
void _stext(); /* startup routine */
void (* const _vectab[])() = { /* 0xFFCE */
0, /* Reserved */
0, /* BDLC */
0, /* ATD */
0, /* SCI 1 */
0, /* SCI 0 */
0, /* SPI */
0, /* Pulse acc input */
0, /* Pulse acc overf */
0, /* Timer overf */
0, /* Timer channel 7 */