SNS COLLEGE OF TECHNOLOGY
An Autonomous Institution
Coimbatore-35
Accredited by NBA – AICTE and Accreditedby NAAC – UGC with ‘
A+’Grade
Approved by AICTE, New Delhi & Affiliated to Anna University,Chennai
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
III YEAR/ VI SEMESTER
19ECO302 MICROCONTROLLERS FOR INDUSTRIAL APPLICATION
UNIT-II PIC MICROCONTROLLER
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• PIC microcontrollers was developed by General Instruments
Microelectronics Divisions in the year 1993.
• PIC microcontrollers are a family of microcontrollers manufactured
by Microchip Technology.
• The term "PIC" originally stood for "Peripheral Interface Controller,"
but now it's commonly understood to mean "Programmable
Intelligent Computer."
• These microcontrollers are widely used in various embedded
systems applications due to their versatility, low cost, and ease of
use.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Characteristics:
• Architecture: PIC microcontrollers typically employ a Harvard
architecture, where program memory and data memory are
separate. This allows for simultaneous access to both program
instructions and data, which can improve performance in certain
applications.
• Instruction Set: PIC microcontrollers use a reduced instruction set
computing (RISC) architecture, which simplifies programming and
typically results in more efficient code execution.
• Memory: PIC microcontrollers usually have on-chip Flash memory
for program storage and SRAM for data storage. Some models also
include EEPROM for non-volatile data storage.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Characteristics:
• Peripheral Integration: PIC microcontrollers come with a wide
range of integrated peripherals such as timers, UARTs (Universal
Asynchronous Receiver/Transmitter), SPI (Serial Peripheral
Interface), I2C (Inter-Integrated Circuit), ADCs (Analog-to-Digital
Converters), PWM (Pulse Width Modulation) modules, etc. This
integration simplifies system design and reduces the need for
external components.
• Low Power Consumption: Many PIC microcontrollers are
designed to operate at low power, making them suitable for battery-
powered applications.
• Development Tools: Microchip provides a comprehensive suite of
development tools for PIC microcontrollers, including integrated
development environments (IDEs), compilers, simulators, and
debuggers. These tools facilitate software development, debugging,
and testing.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Characteristics:
• Variety of Models: The PIC microcontroller family encompasses a
wide range of models with varying features and capabilities, catering
to different application requirements. This includes different memory
sizes, clock speeds, peripheral configurations, and package options.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Applications:
PIC microcontrollers find applications in various fields, including:
•Consumer electronics
•Industrial automation
•Automotive systems
•Medical devices
•Home appliances
•IoT (Internet of Things) devices
•Robotics
•Embedded control systems
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• A flash chip refers to a type of non-volatile memory integrated
circuit (IC) that can be electrically erased and reprogrammed.
• It is commonly used in various electronic devices such as USB
drives, solid-state drives (SSDs), memory cards, and embedded
systems.
• Flash chips are popular due to their relatively fast access times,
high reliability, low power consumption, and cost-effectiveness
compared to other types of non-volatile memory.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• The PIC microcontroller architecture comprises of CPU, I/O ports, memory
organization, A/D converter, timers/counters, interrupts, serial communication,
oscillator and CCP module which are discussed in detailed below.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
CPU (Central Processing Unit)
• It is not different from other microcontrollers CPU and the
PIC microcontroller CPU consists of the ALU, CU, MU and
accumulator, etc.
• Arithmetic logic unit is mainly used for arithmetic operations and to
take logical decisions.
• Memory is used for storing the instructions after processing.
• To control the internal and external peripherals, control unit is used
which are connected to the CPU
• Accumulator is used for storing the results and further process.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Memory Organization:
• The memory module in the PIC microcontroller architecture consists of RAM
(Random Access Memory), ROM (Read Only Memory) and STACK.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• Random Access Memory (RAM):
• RAM is an unstable memory which is used to store the data temporarily in its
registers.
• The RAM memory is classified into two banks, and each bank consists of so
many registers.
• The RAM registers are classified into two types: Special Function Registers
(SFR) and General Purpose Registers (GPR).
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
•General Purpose Registers (GPR)
• These registers are used for general purpose only as the name implies.
For example, if we want to multiply two numbers by using the PIC
microcontroller. Generally, we use registers for multiplying and storing the numbers
in other registers. So these registers don’t have any special function,- CPU can
easily access the data in the registers.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
•Special Function Registers
• These registers are used for special purposes only as the name SFR
implies.
•
• These registers will perform according to the functions assigned to
them , and they cannot be used as normal registers.
For example, if you cannot use the STATUS register for storing
the data, these registers are used for showing the operation or status of
the program. So, user cannot change the function of the SFR; the function
is given by the retailer at the time of manufacturing.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• The SPI module allows for full-duplex synchronous serial
communication(data transmission) between the microcontroller
and external devices, such as sensors, memory chips, display
controllers, and other microcontrollers.SPI-Serial Peripheral
Interface
• .SPI Block consist of following components
• SPI Control Registers
• Data Registers (Tx and Rx)
• Serial Clock (SCK) Line
• Master Out Slave In (MOSI) Line
• Master In Slave Out (MISO) Line
• Slave Select (SS) Lines (Optional)
• SPI Interrupts (Optional)
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• SPI Control Registers: These registers control the operation and
configuration of the SPI module.
• Data Registers (Tx and Rx): These registers are used for transmitting
and receiving data through the SPI module.
• Serial Clock (SCK) Line: This is the clock signal generated by the
microcontroller and used to synchronize data transmission between the
microcontroller and external devices.
• Master Out Slave In (MOSI) Line: This is the data line used for
transmitting data from the microcontroller to external devices. The
microcontroller drives data onto this line during transmission.
• Master In Slave Out (MISO) Line: This is the data line used for
receiving data from external devices to the microcontroller.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• Slave Select (SS) Lines (Optional): These are optional lines used for
selecting individual slave devices on the SPI bus when multiple devices
are connected.
• SPI Interrupts (Optional): Some PIC microcontrollers may feature
interrupts associated with the SPI module. These interrupts can be used
to trigger events in the microcontroller based on the completion of SPI
transactions or the detection of specific conditions.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Read Only Memory (ROM)
• Read only memory is a stable memory which is used to store the data
permanently.
• In PIC microcontroller architecture, the architecture ROM stores the
instructions or program, according to the program the microcontroller acts.
• The ROM is also called as program memory, wherein the user will write the
program for microcontroller and saves it permanently, and finally the program
is executed by the CPU. The microcontrollers performance depends on the
instruction, which is executed by the CPU.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Electrically Erasable Programmable Read Only Memory
(EEPROM)
• In the normal ROM, we can write the program for only once we cannot
use again the microcontroller for multiple times. But, in the EEPROM, we
can program the ROM multiple times.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Flash Memory
• Flash memory is also programmable read only memory (PROM) in which we
can read, write and erase the program thousands of times. Generally, the
PIC microcontroller uses this type of ROM.
• It is commonly used in various electronic devices such as USB drives, solid-
state drives (SSDs), memory cards, and embedded systems.
• Flash chips are popular due to their relatively fast access times, high reliability,
low power consumption, and cost-effectiveness compared to other types of non-
volatile memory.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Stack
• When an interrupt occurs, first the PIC microcontroller has to execute the
interrupt and the existing process address.
• Then that is being executed is stored in the stack.
• After completing the execution of the interrupt, the microcontroller calls the
process with the help of address, which is stored in the stack and get executes
the process
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
I/O Ports
•The series of PIC16 consists of five ports such as Port A, Port B, Port C, Port D &
Port E.
•Port A is an 16-bit port that can be used as input or output port based on the
status of the TRISA (Tri state port A) register.
 "TRI-state" refers to the ability of the microcontroller to configure the pins
of Port A as either inputs, outputs, or high-impedance states. The TRISA
register controls the direction of these pins, determining whether they
function as inputs or outputs.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
I/O Ports
•Port B is an 8- bit port that can be used as both input and output port.
•Port C is an 8-bit and the input of output operation is decided by the status of the
TRISC(Tri state port C) register.
•Port D is an 8-bit port acts as a slave port for connection to the microprocessor
BUS.
 "8-bit port" means that Port D consists of 8 individual pins or
lines, each capable of transmitting or receiving one bit of data
simultaneously.
 "Slave port" implies that Port D is designed to interface with a
microprocessor or microcontroller as a peripheral device, rather
than being directly controlled by the microprocessor itself.
 "Connection to the microprocessor bus" indicates that Port D is
connected to the data bus of the microprocessor, allowing data
transfer between the microprocessor and external devices.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
I/O Ports
•Port E is a 3-bit port which serves the additional function of the control signals to
the analog to digital converter.
 3-bit port: Port E consists of 3 individual pins or lines, each
capable of transmitting or receiving one bit of data
simultaneously. These pins can be used for general-purpose
digital I/O operations.
 Control signals to the analog-to-digital converter (ADC):
In addition to its role in general-purpose I/O, Port E is utilized
to send control signals to the ADC module. These control
signals may include commands to start conversion, select
input channels, configure reference voltage, or other
parameters related to the ADC operation.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
BUS
BUS is used to transfer and receive the data from one peripheral to another. It is
classified into two types such as data bus and address.
 Data Bus: It is used for only transfer or receive the data.
 Address Bus: Address bus is used to transmit the memory address from the
peripherals to the CPU. I/O pins are used to interface the external peripherals;
UART and USART both are serial communication protocols which are used for
interfacing serial devices like GSM, GPS, Bluetooth, IR , etc.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
A/D converters
• The main intention of this analog to digital converter is to convert analog
voltage values to digital voltage values.
• A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8
inputs for 40 pin devices.
• The operation of the analog to digital converter is controlled by ADCON0 and
ADCON1 special registers.
• The upper bits of the converter are stored in register ADRESH and lower bits of
the converter are stored in register ADRESL.
• For this operation, it requires 5V of an analog reference voltage.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
A/D converters
• The main intention of this analog to digital converter is to convert analog
voltage values to digital voltage values.
• A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8
inputs for 40 pin devices.
• The operation of the analog to digital converter is controlled by ADCON0 and
ADCON1 special registers.
• The upper bits of the converter are stored in register ADRESH and lower bits of
the converter are stored in register ADRESL.
• For this operation, it requires 5V of an analog reference voltage.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Timers/ Counters
PIC microcontroller has four timer/counters wherein the one 8-bit timer and the
remaining timers have the choice to select 8 or 16-bit mode. Timers are used for
generating accuracy actions, for example, creating specific time delays between two
operations.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Interrupts
• PIC microcontroller consists of 20 internal interrupts and three external interrupt
sources which are associated with different peripherals like ADC, USART,
Timers, and so on.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Serial Communication
• Serial communication is the method of transferring data one bit at a time
sequentially over a communication channel.
• USART: The name USART stands for Universal synchronous and Asynchronous
Receiver and Transmitter which is a serial communication for two protocols. It is
used for transmitting and receiving the data bit by bit over a single wire with
respect to clock pulses. The PIC microcontroller has two pins TXD and RXD.
These pins are used for transmitting and receiving the data serially.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
• USART has following registers,
• USART Control Registers
• Transmit Data Register (TXREG)
• Receive Data Register (RCREG)
• Baud Rate Generator
• Transmit Shift Register
• Receive Shift Register
• USART Pins (TX and RX)(connect external device)
• USART Interrupts
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
•SPI Protocol:
•The term SPI stands for Serial Peripheral Interface. This protocol is used to
send data between PIC microcontroller and other peripherals such as SD
cards, sensors and shift registers.
• PIC microcontroller support three wire SPI communications between two
devices on a common clock source. The data rate of SPI protocol is more than
that of the USART.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
•I2C Protocol:
•The term I2C stands for Inter Integrated Circuit , and it is a serial protocol which is
used to connect low speed devices such as EEPROMS, microcontrollers, A/D
converters, etc
•. PIC microcontroller support two wire Interface or I2C communication between two
devices which can work as both Master and Slave device.
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
Oscillators
• Oscillators are used for timing generation
• Pic microcontroller consist of external oscillators like RC oscillators or crystal
oscillators. Where the crystal oscillator is connected between the two
oscillator pins.
• The value of the capacitor is connected to every pin that decides the mode of
the operation of the oscillator.
• The modes are crystal mode, high-speed mode and the low-power mode.
• In case of RC oscillators, the value of the resistor & capacitor determine the
clock frequency and the range of clock frequency is 30KHz to 4MHz
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
PIC MICROCONTROLLER
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
Advantages of PIC Microcontroller
•PIC microcontrollers are consistent and faulty of PIC percentage is very less. The
performance of the PIC microcontroller is very fast because of using RISC
architecture.
•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
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
Disadvantages of PIC Microcontroller:
•The length of the program is high due to using RISC architecture (35 instructions)
•One single accumulator is present and program memory is not accessible
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
Street Light that Glows on Detecting Vehicle Movement
The main intention of this project is to detect the movement of vehicles on highways
to switch on a block of street lights ahead of it, and also switch off the trailing lights
to conserve energy. In this project, a PIC microcontroller is done by using embedded
C
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
Street Light that Glows on Detecting Vehicle Movement
.
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
Street Light that Glows on Detecting Vehicle Movement
• The power supply gives the power to the total circuit by stepping down,
rectifying, filtering and regulating AC mains supply.
• When there are no vehicles on highway, then all lights will turn OFF so that the
power can be conserved.
• The IR sensors are placed on the road to sense the vehicle movement. When
there are vehicles on highway, then the IR sensor senses the vehicle movement
immediately, it sends the commands to the PIC microcontroller to switch
ON/OFF the LEDs. A bunch of LEDS will be turned on when a vehicle come near
to the sensor and once the vehicle passes away from the sensor the intensity
will become lower than the LEDs will turn OFF
THANK YOU
Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT

Unit-2-PIC Microcontroller engineering.pptx

  • 1.
    SNS COLLEGE OFTECHNOLOGY An Autonomous Institution Coimbatore-35 Accredited by NBA – AICTE and Accreditedby NAAC – UGC with ‘ A+’Grade Approved by AICTE, New Delhi & Affiliated to Anna University,Chennai DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING III YEAR/ VI SEMESTER 19ECO302 MICROCONTROLLERS FOR INDUSTRIAL APPLICATION UNIT-II PIC MICROCONTROLLER Introduction/19ECO302 – MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT
  • 2.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • PIC microcontrollers was developed by General Instruments Microelectronics Divisions in the year 1993. • PIC microcontrollers are a family of microcontrollers manufactured by Microchip Technology. • The term "PIC" originally stood for "Peripheral Interface Controller," but now it's commonly understood to mean "Programmable Intelligent Computer." • These microcontrollers are widely used in various embedded systems applications due to their versatility, low cost, and ease of use.
  • 3.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Characteristics: • Architecture: PIC microcontrollers typically employ a Harvard architecture, where program memory and data memory are separate. This allows for simultaneous access to both program instructions and data, which can improve performance in certain applications. • Instruction Set: PIC microcontrollers use a reduced instruction set computing (RISC) architecture, which simplifies programming and typically results in more efficient code execution. • Memory: PIC microcontrollers usually have on-chip Flash memory for program storage and SRAM for data storage. Some models also include EEPROM for non-volatile data storage.
  • 4.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Characteristics: • Peripheral Integration: PIC microcontrollers come with a wide range of integrated peripherals such as timers, UARTs (Universal Asynchronous Receiver/Transmitter), SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), ADCs (Analog-to-Digital Converters), PWM (Pulse Width Modulation) modules, etc. This integration simplifies system design and reduces the need for external components. • Low Power Consumption: Many PIC microcontrollers are designed to operate at low power, making them suitable for battery- powered applications. • Development Tools: Microchip provides a comprehensive suite of development tools for PIC microcontrollers, including integrated development environments (IDEs), compilers, simulators, and debuggers. These tools facilitate software development, debugging, and testing.
  • 5.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Characteristics: • Variety of Models: The PIC microcontroller family encompasses a wide range of models with varying features and capabilities, catering to different application requirements. This includes different memory sizes, clock speeds, peripheral configurations, and package options.
  • 6.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Applications: PIC microcontrollers find applications in various fields, including: •Consumer electronics •Industrial automation •Automotive systems •Medical devices •Home appliances •IoT (Internet of Things) devices •Robotics •Embedded control systems
  • 7.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 8.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • A flash chip refers to a type of non-volatile memory integrated circuit (IC) that can be electrically erased and reprogrammed. • It is commonly used in various electronic devices such as USB drives, solid-state drives (SSDs), memory cards, and embedded systems. • Flash chips are popular due to their relatively fast access times, high reliability, low power consumption, and cost-effectiveness compared to other types of non-volatile memory.
  • 9.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • The PIC microcontroller architecture comprises of CPU, I/O ports, memory organization, A/D converter, timers/counters, interrupts, serial communication, oscillator and CCP module which are discussed in detailed below.
  • 10.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 11.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER CPU (Central Processing Unit) • It is not different from other microcontrollers CPU and the PIC microcontroller CPU consists of the ALU, CU, MU and accumulator, etc. • Arithmetic logic unit is mainly used for arithmetic operations and to take logical decisions. • Memory is used for storing the instructions after processing. • To control the internal and external peripherals, control unit is used which are connected to the CPU • Accumulator is used for storing the results and further process.
  • 12.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Memory Organization: • The memory module in the PIC microcontroller architecture consists of RAM (Random Access Memory), ROM (Read Only Memory) and STACK.
  • 13.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • Random Access Memory (RAM): • RAM is an unstable memory which is used to store the data temporarily in its registers. • The RAM memory is classified into two banks, and each bank consists of so many registers. • The RAM registers are classified into two types: Special Function Registers (SFR) and General Purpose Registers (GPR).
  • 14.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER •General Purpose Registers (GPR) • These registers are used for general purpose only as the name implies. For example, if we want to multiply two numbers by using the PIC microcontroller. Generally, we use registers for multiplying and storing the numbers in other registers. So these registers don’t have any special function,- CPU can easily access the data in the registers.
  • 15.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER •Special Function Registers • These registers are used for special purposes only as the name SFR implies. • • These registers will perform according to the functions assigned to them , and they cannot be used as normal registers. For example, if you cannot use the STATUS register for storing the data, these registers are used for showing the operation or status of the program. So, user cannot change the function of the SFR; the function is given by the retailer at the time of manufacturing.
  • 16.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • The SPI module allows for full-duplex synchronous serial communication(data transmission) between the microcontroller and external devices, such as sensors, memory chips, display controllers, and other microcontrollers.SPI-Serial Peripheral Interface • .SPI Block consist of following components • SPI Control Registers • Data Registers (Tx and Rx) • Serial Clock (SCK) Line • Master Out Slave In (MOSI) Line • Master In Slave Out (MISO) Line • Slave Select (SS) Lines (Optional) • SPI Interrupts (Optional)
  • 17.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • SPI Control Registers: These registers control the operation and configuration of the SPI module. • Data Registers (Tx and Rx): These registers are used for transmitting and receiving data through the SPI module. • Serial Clock (SCK) Line: This is the clock signal generated by the microcontroller and used to synchronize data transmission between the microcontroller and external devices. • Master Out Slave In (MOSI) Line: This is the data line used for transmitting data from the microcontroller to external devices. The microcontroller drives data onto this line during transmission. • Master In Slave Out (MISO) Line: This is the data line used for receiving data from external devices to the microcontroller.
  • 18.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • Slave Select (SS) Lines (Optional): These are optional lines used for selecting individual slave devices on the SPI bus when multiple devices are connected. • SPI Interrupts (Optional): Some PIC microcontrollers may feature interrupts associated with the SPI module. These interrupts can be used to trigger events in the microcontroller based on the completion of SPI transactions or the detection of specific conditions.
  • 19.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 20.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Read Only Memory (ROM) • Read only memory is a stable memory which is used to store the data permanently. • In PIC microcontroller architecture, the architecture ROM stores the instructions or program, according to the program the microcontroller acts. • The ROM is also called as program memory, wherein the user will write the program for microcontroller and saves it permanently, and finally the program is executed by the CPU. The microcontrollers performance depends on the instruction, which is executed by the CPU.
  • 21.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Electrically Erasable Programmable Read Only Memory (EEPROM) • In the normal ROM, we can write the program for only once we cannot use again the microcontroller for multiple times. But, in the EEPROM, we can program the ROM multiple times.
  • 22.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Flash Memory • Flash memory is also programmable read only memory (PROM) in which we can read, write and erase the program thousands of times. Generally, the PIC microcontroller uses this type of ROM. • It is commonly used in various electronic devices such as USB drives, solid- state drives (SSDs), memory cards, and embedded systems. • Flash chips are popular due to their relatively fast access times, high reliability, low power consumption, and cost-effectiveness compared to other types of non- volatile memory.
  • 23.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Stack • When an interrupt occurs, first the PIC microcontroller has to execute the interrupt and the existing process address. • Then that is being executed is stored in the stack. • After completing the execution of the interrupt, the microcontroller calls the process with the help of address, which is stored in the stack and get executes the process
  • 24.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER I/O Ports •The series of PIC16 consists of five ports such as Port A, Port B, Port C, Port D & Port E. •Port A is an 16-bit port that can be used as input or output port based on the status of the TRISA (Tri state port A) register.  "TRI-state" refers to the ability of the microcontroller to configure the pins of Port A as either inputs, outputs, or high-impedance states. The TRISA register controls the direction of these pins, determining whether they function as inputs or outputs.
  • 25.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER I/O Ports •Port B is an 8- bit port that can be used as both input and output port. •Port C is an 8-bit and the input of output operation is decided by the status of the TRISC(Tri state port C) register. •Port D is an 8-bit port acts as a slave port for connection to the microprocessor BUS.  "8-bit port" means that Port D consists of 8 individual pins or lines, each capable of transmitting or receiving one bit of data simultaneously.  "Slave port" implies that Port D is designed to interface with a microprocessor or microcontroller as a peripheral device, rather than being directly controlled by the microprocessor itself.  "Connection to the microprocessor bus" indicates that Port D is connected to the data bus of the microprocessor, allowing data transfer between the microprocessor and external devices.
  • 26.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER I/O Ports •Port E is a 3-bit port which serves the additional function of the control signals to the analog to digital converter.  3-bit port: Port E consists of 3 individual pins or lines, each capable of transmitting or receiving one bit of data simultaneously. These pins can be used for general-purpose digital I/O operations.  Control signals to the analog-to-digital converter (ADC): In addition to its role in general-purpose I/O, Port E is utilized to send control signals to the ADC module. These control signals may include commands to start conversion, select input channels, configure reference voltage, or other parameters related to the ADC operation.
  • 27.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER BUS BUS is used to transfer and receive the data from one peripheral to another. It is classified into two types such as data bus and address.  Data Bus: It is used for only transfer or receive the data.  Address Bus: Address bus is used to transmit the memory address from the peripherals to the CPU. I/O pins are used to interface the external peripherals; UART and USART both are serial communication protocols which are used for interfacing serial devices like GSM, GPS, Bluetooth, IR , etc.
  • 28.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 29.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER A/D converters • The main intention of this analog to digital converter is to convert analog voltage values to digital voltage values. • A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8 inputs for 40 pin devices. • The operation of the analog to digital converter is controlled by ADCON0 and ADCON1 special registers. • The upper bits of the converter are stored in register ADRESH and lower bits of the converter are stored in register ADRESL. • For this operation, it requires 5V of an analog reference voltage.
  • 30.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER A/D converters • The main intention of this analog to digital converter is to convert analog voltage values to digital voltage values. • A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8 inputs for 40 pin devices. • The operation of the analog to digital converter is controlled by ADCON0 and ADCON1 special registers. • The upper bits of the converter are stored in register ADRESH and lower bits of the converter are stored in register ADRESL. • For this operation, it requires 5V of an analog reference voltage.
  • 31.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 32.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Timers/ Counters PIC microcontroller has four timer/counters wherein the one 8-bit timer and the remaining timers have the choice to select 8 or 16-bit mode. Timers are used for generating accuracy actions, for example, creating specific time delays between two operations.
  • 33.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Interrupts • PIC microcontroller consists of 20 internal interrupts and three external interrupt sources which are associated with different peripherals like ADC, USART, Timers, and so on.
  • 34.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Serial Communication • Serial communication is the method of transferring data one bit at a time sequentially over a communication channel. • USART: The name USART stands for Universal synchronous and Asynchronous Receiver and Transmitter which is a serial communication for two protocols. It is used for transmitting and receiving the data bit by bit over a single wire with respect to clock pulses. The PIC microcontroller has two pins TXD and RXD. These pins are used for transmitting and receiving the data serially.
  • 35.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER • USART has following registers, • USART Control Registers • Transmit Data Register (TXREG) • Receive Data Register (RCREG) • Baud Rate Generator • Transmit Shift Register • Receive Shift Register • USART Pins (TX and RX)(connect external device) • USART Interrupts
  • 36.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER •SPI Protocol: •The term SPI stands for Serial Peripheral Interface. This protocol is used to send data between PIC microcontroller and other peripherals such as SD cards, sensors and shift registers. • PIC microcontroller support three wire SPI communications between two devices on a common clock source. The data rate of SPI protocol is more than that of the USART.
  • 37.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER •I2C Protocol: •The term I2C stands for Inter Integrated Circuit , and it is a serial protocol which is used to connect low speed devices such as EEPROMS, microcontrollers, A/D converters, etc •. PIC microcontroller support two wire Interface or I2C communication between two devices which can work as both Master and Slave device.
  • 38.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER Oscillators • Oscillators are used for timing generation • Pic microcontroller consist of external oscillators like RC oscillators or crystal oscillators. Where the crystal oscillator is connected between the two oscillator pins. • The value of the capacitor is connected to every pin that decides the mode of the operation of the oscillator. • The modes are crystal mode, high-speed mode and the low-power mode. • In case of RC oscillators, the value of the resistor & capacitor determine the clock frequency and the range of clock frequency is 30KHz to 4MHz
  • 39.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT PIC MICROCONTROLLER
  • 40.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT Advantages of PIC Microcontroller •PIC microcontrollers are consistent and faulty of PIC percentage is very less. The performance of the PIC microcontroller is very fast because of using RISC architecture. •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
  • 41.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT Disadvantages of PIC Microcontroller: •The length of the program is high due to using RISC architecture (35 instructions) •One single accumulator is present and program memory is not accessible
  • 42.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT Street Light that Glows on Detecting Vehicle Movement The main intention of this project is to detect the movement of vehicles on highways to switch on a block of street lights ahead of it, and also switch off the trailing lights to conserve energy. In this project, a PIC microcontroller is done by using embedded C
  • 43.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT Street Light that Glows on Detecting Vehicle Movement
  • 44.
    . Introduction/19ECO302 – MICROCONTROLLERSFOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT Street Light that Glows on Detecting Vehicle Movement • The power supply gives the power to the total circuit by stepping down, rectifying, filtering and regulating AC mains supply. • When there are no vehicles on highway, then all lights will turn OFF so that the power can be conserved. • The IR sensors are placed on the road to sense the vehicle movement. When there are vehicles on highway, then the IR sensor senses the vehicle movement immediately, it sends the commands to the PIC microcontroller to switch ON/OFF the LEDs. A bunch of LEDS will be turned on when a vehicle come near to the sensor and once the vehicle passes away from the sensor the intensity will become lower than the LEDs will turn OFF
  • 45.
    THANK YOU Introduction/19ECO302 –MICROCONTROLLERS FOR INDUSTRIAL APPLICATION /J.Prabakaran/ECE/SNSCT