IOT

Introduction to PIC Microcontroller and its Architecture

Intel created the first microcontroller (8051) with Harvard Architecture 8051 in 1980, and microcontrollers have revolutionized the electronics and embedded industries ever then. With the evolution of technology, we now have several more efficient and low-power microcontrollers such as AVR, PIC, and ARM. These microcontrollers are more capable and simple to use, as they support the most recent communication protocols such as USB, I2C, SPI, and CAN. In this article, we’ll look at what a PIC microcontroller is, what it can do, and why it’s so popular in Embedded systems.

PIC stands for Peripheral Interface Microcontroller, and it was created by General Instruments Microcontrollers in 1993. It is controlled by software and is configured to do various jobs as well as control a generation line. PIC microcontrollers are now being employed in a wide range of new applications, including cellphones, audio accessories, and advanced medical devices.

What is a Microcontroller?

In simple terms, it is a single-chip CPU with add-on components such as flash memory, RAM, EEPROM, and ADC. Microcontrollers have low-speed processors and are simple to include into a programme. It is relatively simple to connect a circuit and programme it.

Microcontrollers are commonly employed in 8-bit mode, but they are also available in 16-bit, 32-bit, and 64-bit modes. When compared to Microprocessors, it does not require special interfacing hardware for use with Microcontrollers. Microcontrollers operate at frequencies of KHz, MHz, and GHz. They are low-power gadgets that can be operated at low voltages as low as 2V.

PIC MICRO CONTROLLER

Peripheral Interface Controller (PIC) is an acronym for Peripheral Interface Controller. It was created to assist PDP computers in controlling their peripheral devices, hence the name Peripheral Interface Controller. PIC microcontrollers are inexpensive, as well as quick and simple to programme and execute. It’s also simple to connect them to other peripherals.

Microchip Company’s PIC microcontrollers are grouped into four broad groups. 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 rating.They are:

  • First family:PIC10 (10FXXX) called Low End
  • Second family: PIC12 (PIC12FXXX) called Mid-Range
  • Third family:PIC16 (16FXXX)
  • Fourth family: PIC 17/18 (18FXXX)

Every PIC has some major and common units like:

  • Processor
  • Memory (RAM, ROM, EPROM)
  • Input/ Output ports
  • Serial and Parallel ports
  • Timer
  • counter
  • A-D converter or D-A converter
  • Flash memory (program memory)
  • SRAM memory (Data memory)
  • various crystal oscillators

ARCHITECTURE:

PIC Microcontroller architecture is based on Harvard architecture and supports RISC architecture (Reduced Instruction Set Computer). Memory organisation (ram, rom, stack), CPU, timers, counter, ADC, DAC, serial communication, CCP module, and I/O ports are all part of the PIC microcontroller architecture. For communicating with additional peripherals, the PIC microcontroller supports protocols such as CAN, SPI, and UART.

  1. CPU (Central Processing Unit):

PIC microcontroller’s CPU consists of:

  • Arithmetic logic unit (ALU)
  • Memory unit (MU)
  • Control unit (CU)
  • Accumulator

ALU is used to perform arithmetic and logical operations. After the instructions have been processed, memory is employed to store them. The internal and external peripherals attached to the CPU are controlled by the control unit, and the results are stored in the accumulator. It supports normally RISC architecture.

Reduced Instruction Set Computer, or RISC, is a microprocessor design that uses a limited, highly optimised set of instructions rather than the more specialised set of instructions found in other architectures.

  1. MEMORY ORGANIZATION:

PIC micro controller memory module consists of mainly 3 types of memories

  • PROGRAM MEMORY:

It contains the programme that was written and burned into the microcontroller. Program Counter sequentially executes commands contained in the programme memory. The Pic microcontroller has an 8K words x 14 bit Flash programme memory that can be erased and reprogrammed electrically. We erase an old programme and write a new one every time we burn a programme into the micro.

  • DATA MEMORY:

It is a form of RAM that is used to temporarily store data in its registers. Banks are used to organize RAM memory. Each bank has a 7Fh limit (128 bytes). Depending on the microcontroller, the number of banks may vary. There are only two banks on the PIC16F84. Special Function Registers (SFR) and General Purpose Registers (GPR) are both found in banks (GPR). Special Function Registers are kept in the bottom locations of each bank, whereas General Purpose Registers are kept in the upper places.

  • General Purpose Registers (GPR):

These registers have no particular purpose. These are used for general multiplication, addition, and subtraction, with the results being stored in other registers. The data in these registers is easily accessible by the CPU.

  • 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
  • DATA EEPROM:

This memory permits variables to be stored as a result of burning a programme. During regular functioning, it is readable and writable (over the full VDD range). The register file does not directly map this memory. The SFRs are used to address it in a roundabout way. This memory is read and written with the help of six SFRs (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:

  • USART: It stands for Universal synchronous and Asynchronous Receiver and Transmitter which provides a serial communication in two devices. In this protocol data is transmitted and received bit by bit through a single wire according to the clock pulses. To send and receive data serially the PIC microcontroller has two pins TXD and RXD.
  • SPI Protocol: Serial Peripheral Interface (SPI) is an acronym for Serial Peripheral Interface. It is used to communicate data between PIC microcontrollers and other devices such as sensors, shift registers, and SD cards. The PIC microcontroller supports three-wire SPI communications between two devices using the same clock source. The SPI protocol is capable of handling more data than the USART protocol. The I2C protocol, which stands for Inter Integrated Circuit, is used to connect low-speed devices such as microcontrollers, EEPROMs, and A/D converters. The PIC microcontroller supports two-wire interface (I2C) communication between two devices that can function as both Master and Slave.
  1. INTERRUPTS:

PIC microcontrollers have 20 internal interrupts and three external interrupt sources that are connected to various peripherals such as ADC, USART, Timers, and CCP.

  1. I/O PORTS:

Consider the PIC16 series, which has five ports: Port A, Port B, Port C, Port D, and Port E.

  • Port A:It  is a 7-bit wide port that can be used for input and output. The TRISA register’s status determines whether it is utilised as an input or output port.
  • Port B:It’s an 8-bit port. This port can be used as both an input and an output. In addition, four of its bits are configurable in input mode based on interrupt signals.
  • Port C: It is likewise an 8-bit port that can be used as an input or output port, depending on the TRISC register’s status.
  • Port D: Unlike Ports A, B, and C, this 8-bit port is not an input/output port; instead, it serves as a slave port for connecting to the CPU. All pins on Port D should have Schmitt Trigger buffers while in I/O mode.
  • Port E: It is a 3-bit port that serves as an additional feature of the A/D converter’s control signals.

6.      CCP MODULE:

  • A CCP module can operate in one of three modes:
  • Capture Mode: When a signal is received, time is captured, or we can say that when the CCP pin is high, the value of the Timer1 is captured.
  • Compare Mode: It functions like an analogue comparator, which means that when the value of timer 1 hits a certain threshold, it generates an output signal.
  • PWM Option: This mode provides a configurable 10 bit resolution pulse and duty cycle.
  1. TIMERS:

Timers and counters are useful because they can keep track of time and count. Timer0, Timer1, Timer2, and Timer3 are the four timers that a PIC microcontroller can have (depending on the family). Timer0 and Timer2 are 8-bit timers, while Timer1 and Timer3 are 16-bit timers that can be used as counters. These timers operate in accordance with the modes selected.

  1. D/A CONVERTER:

The PIC Microcontroller has no analogue outputs. We need to employ an external Digital-to-Analog Converter to get analogue output (DAC). It can convert 8 bits of digital data from the PIC microcontroller’s eight digital outputs.

9. A/D CONVERTER:

The PIC Microcontroller has an analogue to digital converter with eight channels and a resolution of ten bits. ADCON0 and ADCON1 are special function registers that govern the A/D converter’s operation. The converter’s lower bits are stored in the ADRESL register (8 bits), while the upper bits are saved in the ADRESH register. Its operation necessitates a 5V analogue reference voltage.

10.  OSCILLATORS:

Oscillators are used to generate timing. External oscillators, such as crystals or RC oscillators, are used in PIC microcontrollers. The crystal is connected between two oscillator pins in crystal oscillators, and the value of the capacitor attached to each pin controls the oscillator’s mode of operation. Low-power mode, crystal mode, and high-speed mode are the three modes available. The clock frequency of RC oscillators is determined by the value of the Resistor and Capacitor. The clock frequency is adjustable between 30 kHz and 4 MHz.

A Watchdog timer, which resets the microcontroller in the event of any software failure, and a Brownout reset, which resets the microcontroller in the event of any power fluctuation, are among the other unique peripherals. We’ve included a practical project that makes use of the PIC microcontroller for a better understanding of how it works.

ADVANTAGES OF PIC MICROCONTROLLER:

  • PIC microcontrollers are reliable, and the percentage of PIC microcontrollers that are defective is relatively low. Because to its RISC design, the PIC microcontroller has an extremely quick performance.
  • It is a RISC (Reduced Instruction Set Computer) design
  • Only thirty seven instructions to remember
  • It is low cost, high clock speed
  • Because of its efficient coding, the PIC can run with significantly less programme memory than its larger competitors.
  • When comparing to other microcontrollers, power consumption is very less and programming is also very easy.
  • Interfacing of an analog device is easy without any extra circuitry

DISADVANTAGES OF PIC MICROCONTROLLER:

  • Because of the RISC architecture, the software is somewhat long (35 instructions)
  • One single accumulator is present and program memory is not accessible
  • Program memory is not accessible and only one single accumulator is present.

APPLICATIONS:

Leave a Reply

Your email address will not be published.