PIC Microcontroller

The microcontrollers played revolutionary role in embedded industry after the invention of Intel 8051. The steady and progressive research in this field gave the industry more efficient, high-performance and low-power consumption microcontrollers. The AVR, PIC and ARM are the prime examples. The new age microcontrollers are getting smarter and richer by including latest communication protocols like USB, I2C, SPIEthernet, CAN etc.  
PIC microcontrollers
 PIC Microcontroller

History:The PIC microcontroller was developed by General Instruments in 1975. PIC was developed when Microelectronics Division of General Instruments was testing its 16-bit CPU CP1600. Although the CP1600 was a good CPU but it had low I/O performance. The PIC controller was used to offload the I/O the tasks from CPU to improve the overall performance of the system. In 1985, General Instruments converted their Microelectronics Division to Microchip Technology. PIC stands for Peripheral Interface Controller. The General Instruments used the acronyms Programmable Interface Controller and Programmable Intelligent Computer for the initial PICs (PIC1640 and PIC1650). In 1993, Microchip Technology launched the 8-bit PIC16C84 with EEPROM which could be programmed using serial programming method. The improved version of PIC16C84 with flash memory (PIC18F84 and PIC18F84A) hit the market in 1998.

1.Development

Since 1998, Microchip Technology continuously developed new high performance microcontrollers with new complex architecture and enhanced in-built peripherals. PIC microcontroller is based on Harvard architecture. At present PIC microcontrollers are widely used for industrial purpose due to its high performance ability at low power consumption. It is also very famous among hobbyists due to moderate cost and easy availability of its supporting software and hardware tools like compilers, simulators, debuggers etc. The 8-bit PIC microcontroller is divided into following four categories on the basis of internal architecture: 1. Base Line PIC2. Mid-Range PIC3. Enhanced Mid-Range PIC4. PIC18 1. Base Line PICBase Line PICs are the least complex PIC microcontrollers. These microcontrollers work on 12-bit instruction architecture which means that the word size of instruction sets are of 12 bits for these controllers. These are smallest and cheapest PICs, available with 6 to 40 pin packaging.  The small size and low cost of Base Line PIC replaced the traditional ICs like 555, logic gates etc. in industries. 2. Mid-Range PICMid-Range PICs are based on 14-bit instruction architecture and are able to work up to 20 MHz speed. These controllers are available with 8 to 64 pin packaging. These microcontrollers are available with different peripherals like ADC, PWM, Op-Amps and different communication protocols like USART, SPI, I2C (TWI), etc. which make them widely usable microcontrollers not only for industry but for hobbyists as well.

3.Enhanced Mid-Range PIC These controllers are enhanced version of Mid-Range core. This range of controllers provides additional performance, greater flash memory and high speed at very low power consumption. This range of PIC also includes multiple peripherals and supports protocols like USART, SPI, I2C and so on.

4. PIC18PIC18 range is based on 16-bit instruction architecture incorporating advanced RISC architecture which makes it highest performer among the all 8-bit PIC families. The PIC18 range is integrated with new age communication protocols like USB, CAN, LIN, Ethernet (TCP/IP protocol) to communicate with local and/or internet based networks. This range also supports the connectivity of Human Interface Devices like touch panels etc.
The following table compares the above four categories: 
Base Line
Mid-Range
Enhanced Mid-Range
PIC18
No. of Pins
6-40
8-64
8-64
18-100
Program Memory
Up to 3 KB
Up to 14 KB
Up to 28 KB
Up to 128 KB
Data Memory
Up to 134 Bytes
Up to 368 Bytes
Up to 1.5 KB
Up to 4 KB
Instruction Length
12-bit
14-bit
14-bit
16-bit
No. of instruction set
33
35
49
83
Speed
5 MIPS*
5 MIPS
8 MIPS
Up to 16 MIPS
Feature
• Comparator
• 8-bit ADC
• Data Memory
•Internal Oscillator
In addition of baseline
·   SPI
·   I2C
·   UART
·   PWM
·   10-bit ADC
·   OP-Amps
In addition of Mid-range
·   High Performance
·   Multiple communication peripherals
In addition of Enhanced Mid-range
• CAN
• LIN
• USB
• Ethernet
• 12-bit ADC
Families
PIC10,PIC12, PIC16
PIC12, PIC16
PIC12F1XXX, PIC16F1XXX
PIC18
 *MIPS stand for Millions of Instructions per Second

Besides 8-bit microcontrollers, Microchip also manufactures 16-bit and 32-bit microcontrollers. Recently Microchip developed XLP (Extreme Low Power) series microcontrollers which are based on NanoWatt technology. These controllers draw current in order of nanoamperes(nA).

Memory variations:
The PIC microcontrollers are available with different memory options which are mask ROM, EPROM and flash memory. They are denoted with different symbols as given in the following table:

Symbol
Memory Type
Example
C
EPROM
PIC16Cxxx
CR
Mask ROM
PIC16CRxxx
F
Flash memory
PIC16Fxxx


PIC microcontrollers are also available with extended voltage ranges which reduce the frequency range. The operating voltage range of these PICs is 2.0-6.0 volts. The letter ‘L’ is included in controller’s name to denote extended voltage range controllers. For example, PIC16LFxxx (Operating voltage 2.0-6.0 volts).

The following section covers the PIC architecture in further detail. PIC18 series has been selected for the study because it is enhanced series of 8-bit PIC microcontroller. In this series, PIC18F4550 has been chosen to describe the architecture and other features due its moderate complexity.

2. Architecture

PIC microcontrollers are based on advanced RISC architecture. RISC stands for Reduced Instruction Set Computing. In this architecture, the instruction set of hardware gets reduced which increases the execution rate (speed) of system.

PIC microcontrollers follow Harvard architecture for internal data transfer. In Harvard architecture there are two separate memories for program and data. These two memories are accessed through different buses for data communication between memories and CPU core. This architecture improves the speed of system over Von Neumann architecture in which program and data are fetched from the same memory using the same bus. PIC18 series controllers are based on 16-bit instruction set.

The question may arise that if PIC18 are called 8-bit microcontrollers, then what about them being based on 16-bit instructions set. ‘PIC18 is an 8-bit microcontroller’ this statement means that the CPU core can receive/transmit or process a maximum of 8-bit data at a time. On the other hand the statement ‘PIC18 microcontrollers are based on 16-bit instruction set’ means that the assembly instruction sets are of 16-bit.

The data memory is interfaced with 8-bit bus and program memory is interfaced with 16-bit bus as depicted in the following figure.
 PIC Microcontroller Memory


3.PIC18 Harvard Architecture 

PIC microcontroller contains an 8-bit ALU (Arithmetic Logic Unit) and an 8-bit Working Register (Accumulator). There are different GPRs (General Purpose Registers) and SFRs (Special Function Registers) in a PIC microcontroller. The overall system performs 8-bit arithmetic and logic functions. These functions usually need one or two operands. One of the operands is stored in WREG (Accumulator) and the other one is stored in GPR/SFR. The two data is processed by ALU and stored in WREG or other registers.

 PIC18 Harvard ArchitectureThe above process occurs in a single machine cycle. In PIC microcontroller, a single machine cycle consists of 4 oscillation periods. Thus an instruction needs 4 clock periods to be executed. This makes it faster than other 8051 microcontrollers.

Pipelining:
Early processors and controllers could fetch or execute a single instruction in a unit of time. The PIC microcontrollers are able to fetch and execute the instructions in the same unit of time thus increasing their instruction throughput. This technique is known as instruction pipelining where the processing of instructions is split into a number of independent steps.

 Instruction Pipelining - PIC Microcontroller

4.Features and Peripherals

The PIC18F consists of the following features and peripherals.

Features:
·         C Compiler Optimized Architecture with Optional Extended Instruction Set
·         100,000 Erase/Write Cycle Enhanced Flash
·         Program Memory Typical
·         1,000,000 Erase/Write Cycle Data EEPROM Memory Typical
·         Flexible oscillator option
o    Four Crystal modes, including High-Precision PLL for USB
o    Two External Clock modes, Up to 48 MHz
o    Internal Oscillator: 8 user-selectable frequencies, from 31 kHz to 8 MHz
o    Dual Oscillator Options allow Microcontroller and USB module to Run at different Clock Speeds

Peripherals:
The PIC18F4550 microcontroller consists of following peripherals:

·         I/O Ports: PIC18F4550 have 5 (PORTA, PORTB, PORTC, PORTD and PORTE) 8-bit input-output ports. PortB & PortD have 8 I/O pins each. Although other three ports are 8-bit ports but they do not have eight I/O pins. Although the 8-bit input and output are given to these ports, but the pins which do not exist, are masked internally.

 ·         Memory: PIC18F4550 consists of three different memory sections: 
1.      Flash Memory: Flash memory is used to store the program downloaded by a user on to the microcontroller. Flash memory is non-volatile, i.e., it retains the program even after the power is cut-off. PIC18F4550 has 32KB of Flash Memory.

2.      EEPROM: This is also a nonvolatile memory which is used to store data like values of certain variables. PIC18F4550 has 256 Bytes of EEPROM.

3.      SRAM: Static Random Access Memory is the volatile memory of the microcontroller, i.e., it loses its data as soon as the power is cut off. PIC18F4550 is equipped with 2 KB of internal SRAM.

·         ADC Interface: PIC18F4550 is equipped with 13 ADC (Analog to Digital Converter) channels of 10-bits resolution. ADC reads the analog input, for example, a sensor input and converts it into digital value that can be understood by the microcontroller.

·         Timers/CountersPIC18F4550 has four timer/counters. There is one 8-bit timer and the remaining timers have option to select 8 or 16 bit mode. Timers are useful for generating precision actions, for example, creating precise time delays between two operations.

·         Interrupts: PIC18F4550 consists of three external interrupts sources. There are 20 internal interrupts which are associated with different peripherals like USART, ADC, Timers, and so on.

·         EUSART: Enhanced USART (Universal Synchronous and Asynchronous Serial Receiver and Transmitter) module is full-duplex asynchronous system. It can also be configured as half-duplex synchronous system. The Enhanced USART has the feature for automatic baud rate detection and calibration, automatic wake-up on Sync Break reception and 12-bit Break character transmit. These features make it ideally suited for use in Local Interconnect Network bus (LIN bus) systems.

·         ICSP and ICD: PIC18F series controllers have In Circuit Serial Programming facility to program the Flash Memory which can be programmed without removing the IC from the circuit. ICD (In Circuit Debugger) allows for hardware debugging of the controller while it is in the application circuit.

·         SPI: PIC18F supports 3-wire SPI communication between two devices on a common clock source. The data rate of SPI is more than that of USART.

·         I2C: PIC18F supports Two Wire Interface (TWI) or I2C communication between two devices. It can work as both Master and Slave devic.

·         USB: PIC18F supports full-speed USB with different clock options.





·         Oscillator: The PIC18F series has flexible clock options. An external clock of up to 48 MHz can be applied to this series. These controllers also consist of an internal oscillator which provides eight selectable frequency options varying from 31 KHz to 8 MHz.
 ·         8x8 Multiplier: The PIC18F4550 includes an 8 x 8 multiplier hardware. This hardware performs the multiplications in single machine cycle. This gives higher computational throughput and reduces operation cycle & code length.

THANK YOU FOR VISITING..!!
PLEASE COMMENT

No comments:

Post a Comment