PIC microcontroller PIC Peripheral Interface Controller – by Microchip Technology These devices have been very successful in 8-bit microcontrollers. Why? Microchip Technology has continuously upgraded the device architecture and added needed peripherals to the microcontroller to suit customers' requirements. The development tools [assembler and simulator] are freely available at
Low-end PIC architecture have limited program/code memory for applications requiring simple interface functions and small program & data memories Some device nos. – 12C5XX 16C5X 16C505
Mid-range PIC arc… more number of peripherals, more number of registers and more data/program memory. Some devices are – 16C6X 16C7X 16F87X Program memory type is indicated by alphabet: C = EPROM OTM (one-time programmable) F = Flash RC = Mask ROM [cheapest, burnt while IC fabrication]
read Simple 33 (12-bit wide) instruction set for ease of use and quick development 2K word (3 KB) addressable program memory 144 bytes RAM (max) 2 level hardware stack 1 (8-bit) file select register Multiple product options and easy migration
read 35 (14-bit wide) instructions 8K word (14 KB) addressable program memory 46 bytes RAM (max) 8 level hardware stack 1 (9-bit) file select register Hardware interrupt handling Highly integrated feature set, including EEPROM, LCD, mTouch™ sensing solutions and serial communications
Enhanced Mid-Range PIC
read 49 (14-bit wide) instructions 32K word (56 KB) addressable program memory 4KB RAM (max) 16 level hardware stack 2 (16-bit) file select registers Hardware interrupt handling with content save Advanced feature set, multiple serial communications and motor control capability
read K series Provides the highest performance with benchmark nanoWatt XLP extreme low power consumption. 83 (16-bit wide) powerful C-optimized Up to 2 MB addressable program memory 4KB RAM (max) 32 level hardware stack 1 (8-bit) file select register Integrated 8x8 hardware multiply Highest performance 8-bit architecture
Why PIC is popular? Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles. Instruction set simplicity: The instruction set has 35 instructions for PIC16 (as opposed to 111 instructions for 8051).
Why PIC is popular?... Power-on-reset and brown-out reset. Brown-out-reset means when the power supply goes below a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided. A watchdog timer (user programmable) resets the processor, if the software/program ever malfunctions and deviates from its normal operation.
Why PIC is popular?... PIC microcontroller has 4 optional clock sources. – Low power crystal – Mid range crystal – High range crystal – RC oscillator (low cost). Programmable timers and on-chip ADC. Up to 12 independent interrupt sources.
Why PIC is popular?... – EPROM/ – OTP[one-time programmable] ROM/ – Masked version/ – Flash memory option. I/O port expansion capability. Free assembler and simulator support from Microchip at
PIC CPU archi.
PIC Memory Organization has 13 bits of program/code memory address. Hence it can address up to 8k [2 13 =8192] of program memory. The program counter is 13-bit. PIC 16C6X or 16C7X program memory is 2k or 4k. While addressing 2k of program memory, only 11-bits are required. Hence two MSBs of the program counter are ignored. Similarly, while addressing 4k of memory, 12 bits are required. Hence the MSB of the program counter is ignored. – 2^10 = 10242^11 = 2048 – 2^12=40962^13=8192 – 2^14=16384…2^16=65536
Data mem. / RAM Data memory (Register Files): Data Memory aka Register File. Register File consists of two components. – General purpose register file (same as RAM). – Special purpose register file (similar to SFR in 8051: Special Function Registers (SFRs) of 128 bytes) – fixed & every microcontroller must have them It consists of I/O ports and control registers Recall registers of 8086 & compare
PIC18 has a max of 4096 bytes (4K) [ 2^12=4096 ]of data RAM space. Size of special-purpose reg [SPR] is fixed Size of general-purpose reg [GPR] varies from 256 B to 4096 B. GPR is divided into banks of 256B each [more – ch.6]
Data mem map
PIC18 – I/O pins Can have from 16 to 72 pins – dedicated for I/O [more ch. 4]
PIC18 - peripherals All PIC18 family have the following standard peripherals – – ADC – Timers – USART [universal synchronous asynchronous receiver transmitter] – it allows us to connect the PIC18-based system to serial ports (e.g., COM port of the IBM PC)
29 PIC µC peripherals CAN- (Controller Area Network), LIN- (Local Interconnect Network), USB- (Universal Serial Bus), I²C- (Inter-Integrated Circuit), SPI- (Serial Peripheral Interface), Serial or Ethernet Interface ADC - Analog Digital Converter USART- Universal Synchronous Asynchronous Receiver Transmitter
Courtesy – ‘PIC Microcontroller and Embedded Systems, by MA Mazidi et al., Pearson, 2012