PIC MICROCONTROLLER ARCHITECTURE (original) (raw)

PIC MICROCONTROLLER ARCHITECTURE: PIC stands for Peripheral Interface Controller. PIC microcontroller was developed by microchip technology in 1993. It was developed for supporting PDP computers to control its peripheral devices and that’s why it was named Peripheral Interface Controller. PIC microcontrollers are of low cost, very fast and easy for the programming and execution of program. Their interfacing with other peripherals is also very easy. PIC Microcontrollers from Microchip Company are divided into 4 large families. In this PIC MICROCONTROLLER ARCHITECTURE article, I will explain step by step about PIC MICROCONTROLLER ARCHITECTURE and components used in pic microocntrollers. I recommend you to check a list of Pic microcontroller project here.

Each family has a variety of components along with built in special features. It offers a lot of memory sizes and pin packages and different clock ratings.

ARCHITECTURE:

PIC Microcontroller architecture is based on Harvard architecture and supports RISC architecture (Reduced Instruction Set Computer). PIC microcontroller architecture consists of memory organization (ram, rom, stack), CPU, timers, counter, ADC, DAC, serial communication, CCP module and I/O ports. PIC microcontroller also supports the protocols like CAN, SPI, UART for interfacing with other peripherals.

PIC MICROCONTROLLER ARCHITECTURE block diagram

  1. CPU (Central Processing Unit):

PIC microcontroller’s CPU consists of

ALU is used for arithmetic operations and for logical decisions. Memory is used for storing the instructions after processing. Control unit is used to control the internal and external peripherals which are connected to the CPU and accumulator is used for storing the results.

  1. MEMORY ORGANIZATION:

PIC microcontroller memory module consists of mainly 3 types of memories:

It contains the written program after we burned it in microcontroller. Program Counter executes commands stored in the program memory, one after the other. Pic microcontroller can have 8K words x 14 bits of Flash program memory that can be electrically erased and reprogrammed. Whenever we burn program into the micro, we erase an old program and write a new one.

It is a RAM type which is used to store the data temporarily in its registers. The RAM memory is classified into banks. Each bank extends up to 7Fh (128 bytes). Number of banks may vary depending on the microcontroller. PIC16F84 has only two banks. Banks contain Special Function Registers (SFR) and General Purpose Registers (GPR). The lower locations of each bank are reserved for the Special Function Registers and upper locations are for General Purpose Registers.

General Purpose Registers (GPR):

These registers don’t have any special function. These are used for general purpose for multiplying, addition or subtraction and then storing the results in other registers. CPU can easily access the data in these registers.

Special Function Registers (SFR):

These registers are used for special purposes and they cannot be used as normal registers. Their function is set at the time of manufacturing. They perform the function assigned to them and user cannot change the function of SFR. Three important SFRs for programming are:

STATUS register: It changes the bank

PORT registers: It assigns logic values 0 or 1 to the ports

TRIS registers: It is a data direction register for input and output

This memory allows storing the variables as a result of burning the written program. It is readable and writable during normal operation (over the full VDD range). This memory is not directly mapped in the register file. It is indirectly addressed through the SFRs. There are six SFRs which are used to read and write to this memory (EECON1, EECON2, EEDATA, EEDATH, EEADR, EEADRH).

  1. SERIAL COMMUNICATION:

The transfer of one bit of data at time consecutively over a communication channel is called Serial Communication. There are three protocols of serial communication:

Serial Communication

  1. INTERRUPTS:

There are 20 internal interrupts and three external interrupt sources in PIC microcontrollers which are related with different peripherals like ADC, USART, Timers, and CCP etc.

  1. I/O PORTS:

Let us take PIC16 series, it consists of five ports, such as Port A, Port B, Port C, Port D and Port E.

6. CCP MODULE:

A CCP module works in the following three modes:

  1. Timers:

Timers and counters are important as timers can tell the time and count. PIC microcontroller can have up to four timers (depending upon the family) Timer0, Timer1, Timer2 and Timer3. Timer0 and Timer2 are of 8-bits while the Timer1 and Timer3 are of 16-bits, which can also be used as a counter. These timers work according to the selected modes.

  1. D/A CONVERTER:

There are no analog outputs in PIC Microcontroller. To get analog output we have to use external Digital-to-Analog Converter (DAC). It can convert 8 bits of digital number from the eight digital outputs of PIC microcontroller.

  1. A/D CONVERTER:

It converts the analog voltage levels to digital voltage values. In PIC Microcontroller, ADC has 8-channels and has resolution of 10-bit, which means that if we have to convert an analog voltage between 0V to 5V the converter will divide it to 2^10 levels (1024 levels). The special function registers ADCON0 and ADCON1 control the operation of ADC. The converter stores the lower 8 bits in ADRESL register and the upper bits in the ADRESH register. Reference voltage of 5V is required for the operation of the converter.