4。4 The Microcontroller
Simple closed-loop control, keypad reading, and display control are some of the classic applications of microcontrollers, and this project incorporates all three。 It is therefore an excellent all-around exercise in microcontroller applications。 In addition, because the project is to produce an actual packaged prototype, it won’t do to use a simple evaluation board with the I/O pins jumpered to the target system。 Instead, it’s necessary to develop a complete embedded application。 This entails the choice of an appropriate part from the broad range offered in a typical microcontroller family and learning to use a fairly sophisticated development environment。 Finally, a custom printed-circuit board for the microcontroller and peripherals must be designed and fabricated。
Microcontroller Selection。 In view of existing local expertise, the Motorola line of microcontrollers was chosen for this project。 Still, this does not narrow the choice down much。 A fairly disciplined study of system requirements is necessary to specify which microcontroller, out of scores of variants, is required for the job。 This is difficult for students, as they generally lack the experience and intuition needed as well as the perseverance to wade through manufacturers’ selection guides。
Part of the problem is in choosing methods for interfacing the various peripherals (e。g。, what kind of display driver should be used?)。 A study of relevant Motorola application notes [2, 3, 4] proved very helpful in understandingwhat basic approaches are available, and what microcontroller/peripheral combinations should be considered。
The MC68HC705B16 was finally chosen on the basis of its availableA/D inputs and PWMoutputs as well as 24 digital I/O lines。 In retrospect this is probably overkill, as only one A/D channel, one PWM channel, and 11 I/O pins are actually required (see Figure 3)。 The decision was made to err on the safe side because a complete development system specific to the chosen part was necessary, and the project budget did not permit a second such system to be purchased should the first
prove inadequate。
Microcontroller Application Development。 Breadboarding of the peripheral hardware, development of microcontroller software, and final debugging and testing of a custom printed-circuit board for the microcontroller and peripherals all require a development environment of some kind。 The choice of a development environment, like that of the microcontroller itself, can be bewildering and requires some faculty expertise。 Motorola makes three grades of development environment ranging from simple evaluation boards (at around $100) to full-blown real-time in-circuit emulators (at more like $7500)。 The middle option was chosen for this project: the MMEVS, which consists of _ a platform board (which supports all 6805-family parts), _ an emulator module (specific to B-series parts), and _ a cable and target head adapter (package-specific)。 Overall, the system costs about $900 and provides, with some limitations, in-circuit emulation capability。 It also comes with the simple but sufficient software development environment RAPID [5]。
Students find learning to use this type of system challenging, but the experience they gain in real-world microcontroller application development greatly exceeds the typical first-course experience using simple evaluation boards。
Printed-Circuit Board。 The layout of a simple (though definitely not trivial) printed-circuit board is another practical learning opportunity presented by this project。 The final board layout, with package outlines, is shown (at 50% of actual size) in Figure 8。 The relative simplicity of the circuit makes manual placement and routing practical—in fact, it likely gives better results than automatic in an application like this—and the student is therefore exposed to fundamental issues of printed-circuit layout and basic design rules。 The layout software used was the very nice package pcb,2 and the board was fabricated in-house with the aid of our staff electronics technician。