PIC16-series microcontrollers have been around for many years. Although these are excellent general purpose microcontrollers, they have certain limitations. For example, the program and data memory capacities are limited, the stack is small, and the interrupt structure is primitive, all interrupt sources sharing the same interrupt vector. PIC16- series microcontrollers also do not provide direct support for advanced peripheral interfaces such as USB, CAN bus, etc., and interfacing with such devices is not easy. The instruction set for these microcontrollers is also limited. For example, there are no multiplication or division instructions, and branching is rather simple, being a combination of skip and goto instructions.
Microchip Inc. has developed the PIC18 series of microcontrollers for use in high-pin- count, high-density, and complex applications. The PIC18F microcontrollers offer cost- efficient solutions for general purpose applications written in C that use a real-time operating system (RTOS) and require a complex communication protocol stack such as TCP/IP, CAN, USB, or ZigBee. PIC18F devices provide flash program memory in sizes from 8 to 128Kbytes and data memory from 256 to 4Kbytes, operating at a range of to 5.0 volts, at speeds from DC to 40MHz.
The basic features of PIC18F-series microcontrollers are:
• 77 instructions
• PIC16 source code compatible
• Program memory addressing up to 2Mbytes
• Data memory addressing up to 4Kbytes
• DC to 40MHz operation
• 8 x 8 hardware multiplier
• Interrupt priority levels
• 16-bit-wide instructions, 8-bit-wide data path
• Up to two 8-bit timers/counters
• Up to three 16-bit timers/counters
• Up to four external interrupts
• High current (25mA) sink/source capability
• Up to five capture/compare/PWM modules
• Master synchronous serial port module (SPI and I2C modes)
• Up to two USART modules
• Parallel slave port (PSP)
• Fast 10-bit analog-to-digital converter
• Programmable low-voltage detection (LVD) module
• Power-on reset (POR), power-up timer (PWRT), and oscillator start-up timer (OST)
• Watchdog timer (WDT) with on-chip RC oscillator
• In-circuit programming
In addition, some microcontrollers in the PIC18F family offer the following special features:
• Direct CAN 2.0 bus interface
• Direct USB 2.0 bus interface
• Direct LCD control interface
• TCP/IP interface
• ZigBee interface
• Direct motor control interface
Most devices in the PIC18F family are source compatible with each other. Table 2.1 gives the characteristics of some of the popular devices in this family. This chapter offers a detailed study of the PIC18FXX2 microcontrollers. The architectures of most of the other microcontrollers in the PIC18F family are similar.
The reader may be familiar with the programming and applications of the PIC16F series. Before going into the details of the PIC18F series, it is worthwhile to compare the features of the PIC18F series with those of the PIC16F series.
The following are similarities between PIC16F and PIC18F:
• Similar packages and pinouts
• Similar special function register (SFR) names and functions
• Similar peripheral devices
• Subset of PIC18F instruction set
• Similar development tools
The following are new with the PIC18F series:
• Number of instructions doubled
• 16-bit instruction word
• Hardware 8 x 8 multiplier
• More external interrupts
• Priority-based interrupts
• Enhanced status register
• Increased program and data memory size
• Bigger stack
• Phase-locked loop (PLL) clock generator
• Enhanced input-output port architecture
• Set of configuration registers
• Higher speed of operation
• Lower power operation