Advanced PIC Microcontroller Projects in C: From USB to RTOS with the PIC18F Series

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 2.0 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 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...