Chapter 8: The PIC18Fxx2: System Startup and Parallel Port IO
This chapter introduces the hardware side of the PIC18Fxx2 by exploring reset behavior and parallel port IO. In addition, the nuances of writing C code for PIC18Fxx2 applications are examined.
8.1 LEARNING OBJECTIVES
After reading this chapter, you will be able to:
-
Implement a simple PIC18F242 system that has an oscillator, power supply, and reset switch.
-
Write C code for the PIC18 that implements IO via pushbutton switches and LEDs using a finite state machine approach.
-
Discuss the different features of the PIC18 parallel ports such as bidirectional capability, weak pullups, and open-drain outputs.
-
Describe the factors that affect dynamic power consumption in CMOS circuits.
-
Identify common features of integrated circuit datasheets.
-
Discuss the use of sleep mode in the PIC18 and its effect on power consumption.
-
Describe the operation of the watchdog timer and its interaction with sleep mode.
-
Implement a parallel interface between a PIC18 and a liquid crystal display module.
8.2 HIGH-LEVEL LANGUAGES VERSUS ASSEMBLY LANGUAGE
Previous chapters explored the instruction set of the PIC18 and assembly language programming in the context of C programming. This was done so that the linkage from high-level language constructs such as data types, conditional statements, loop structures, subroutines, signed/unsigned arithmetic, and so forth to assembly language is clear. This understanding is needed, as most programming of microprocessors and microcontrollers is done in a high-level language such as C, not assembly language, and therefore one must be cognizant of the performance and memory usage repercussions when using...