PIC is an abbreviation used for Peripheral Interface Controller. PIC microcontroller is the smallest microcontroller in the world and are programmed to execute large number of operations. These were initially designed to support PDP (programmed data processor) computers, for controlling the peripheral devices. It is based on RISC architecture.
PIC microcontrollers hold the ability of faster execution of programs than microcontrollers. It was invented in 1989 by microchip technology corporation and was an 8-bit microcontroller.
We know a microcontroller is nothing but a combination of processor, memory and peripherals in a single chip. In a similar way PIC microcontroller consists of data RAM with some hundred bytes of ROM for storing the desired program, some I/O ports, one timer on a single chip having 8 pins.
As it was designed to perform simple control applications thus called peripheral interface controller. But now-a-days it is commonly known as programmable intelligent computer.
We know that basically the components of the microcontroller are embedded in one chip. Thus further addition of external memory, I/O port or timers to it is not achievable. However, this property is also utilized in a way that microcontrollers are used in various applications.
Whenever, we talk about embedded systems then it is very clear that these systems hold internal microcontroller despite having an external controller. The ROM of microcontroller in embedded system, typically stores functions which the system desires to perform.
Architecture of PIC Microcontroller
The figure below shows the architectural representation of PIC microcontroller:
As we have already discussed that it consists of a processor, I/O ports, timers, memory organization etc. in a single chip. So, let us move further and understand the operation of each component of the PIC microcontroller.
- CPU: CPU is the central processing unit that has ALU, CU, MU within it. The ALU performs arithmetic and logic operations according to the instructions received. The memory unit stores the instructions that are to be processed and also the data and instruction after being processed.
While the control unit controls the I/O devices connected to the system. As it is based on RISC architecture i.e., reduced instruction set computer, then it is to be noteworthy here that:
The number of instructions is small approximately around a total of 35 instructions,
Due to less number of instructions, the operation performed by the CPU will be quite fast,
Processing of the instruction takes less time as the length of the instructions is small,
RISC architecture also supports less complex compilation and easy debugging.
- Memory: Basically there exist two types of memory in PIC microcontroller-
1.Program or code memory: As the name itself is suggesting that program memory holds the set of instructions that are desired to be performed by the microcontroller. It is basically referred as ROM. The memory space provided by this is 8K Χ 14 bits that can store 13-bit instruction or program. The PC accesses the program memory, and increments itself after fetching an instruction.
EEPROM: ROM allows the program to be stored only once. But EEPROM i.e., electrically erasable programmable read only memory permits the multiple times writing of the code on the ROM.
Flash memory: Flash memory is another PROM for this microcontroller. The program in the flash memory can be erased as many times as required.
2.Data memory: Data memory stores the data in it. Basically these are Random Access Memory i.e., RAM. It stores the data on a temporary basis in the registers. PIC microcontroller holds 368 bytes of RAM which is divided into banks. The register were the data is stored are classified as:
General Purpose register: These are the registers that perform the general functions. Like addition, subtraction, multiplication etc. and further storing the results in other register. Hence no special function is assigned to these registers, the PIC holds the ability to directly access the data present in these registers.
Special Purpose register: It is abbreviated as SFR. These registers are assigned some special functions by the processor and hence are not used for any general purpose. The operation to be performed by these registers are already set when the system is manufactured. Hence the functions of these registers are not variable. Some important special function registers are:
- STATUS register
- TRIS register
- PORT register
Like, the function of the STATUS register is to show the status of the program being performed.
- I/O ports: The number I/O ports is different for different PIC series. The PIC16 series has 5 I/O port. These are port A, port B, port C, port D and port E.
- Bus: Bus in this microcontroller is used to communicate between different units within it. PIC has 2 types of buses, data bus and address bus.
The data bus transfers the data between memory and I/O unit. Whereas the address bus holds the address of the location to/ from where the data is loaded or fetched.
- Stack: As the priority of interrupts are higher. Thus whenever, an interrupt is generated then the processor of the PIC microcontroller must switch to handle the interrupt by stopping the operation which is being executed currently. So, the stack stores the address of the program currently being in execution, until the PIC microcontroller handles the generated interrupt.
Once the interrupt handling is done, then the processor switches back to the main program whose address is stored in the stack.
- Timers: PIC microcontroller consists of 3 timers. Out of the 3, 2 timers i.e., timer 0 and timer 2 are of 8-bit each while timer 1 is of 16 bit.
Advantages of PIC Microcontroller
- The basis of PIC microcontroller is RISC architecture thus operates faster.
- It offers easy interfacing of analog device.
- It exhibits lower power consumption.
Disadvantages of PIC Microcontroller
- Less number of instructions increases the length of the program.
- It holds only a single accumulator.
Basically there exist 4 family of PIC microcontroller. Here, in this article we have provided a generalized view of PIC microcontrollers and not of any specified family.