0% found this document useful (0 votes)
38 views43 pages

Module 1 - 411

The document discusses embedded systems and PIC microcontrollers. It defines embedded systems and microcontrollers, and describes the differences between microprocessors and microcontrollers. It also provides an overview of the PIC32 architecture, peripherals, and memory organization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views43 pages

Module 1 - 411

The document discusses embedded systems and PIC microcontrollers. It defines embedded systems and microcontrollers, and describes the differences between microprocessors and microcontrollers. It also provides an overview of the PIC32 architecture, peripherals, and memory organization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

INTRODUCTION TO REAL TIME

EMBEDDED SYSTEMS AND PIC


MICROCONTROLLERS.
CSE
3 71
OUTLINE
🞆 Definition of Embedded Systems.
🞆 Examples.
🞆 Computer Essentials.
🞆 Microprocessors and Microcontrollers.
🞆 PIC Microcontrollers.
🞆 PIC32 Series.
🞆 Review of Memory Technologies
🞆 The PIC32MX Architecture.
🞆 PIC 32MX795F512L Peripherals
🞆 THE PHYSICAL MEMORY MAP
EMBEDDED SYSTEM:
IS A SYSTEM WHOSE PRINCIPAL FUNCTION IS NOT
COMPUTATIONAL, BUT WHICH IS CONTROLLED BY A
COMPUTER EMBEDDED WITHIN IT.
MICROPROCESSOR :
The microprocessor, also known as the Central
Processing Unit (CPU),is the brain of all computers
and it is used in many household and electronic devices, it
is a processor with one silicon chip.
MICROCONTROLLER :
A microcontroller (sometimes abbreviated µC, uC
or MCU) is a small computer on a single integrated
circuit containing a processor core, memory, and
programmable I/O peripherals.

Microcontrollers are designed for embedded applications, in


contrast to the microprocessors which are used in personal
computers or other general purpose applications.
Computer Essentials:
COMPUTER SYSTEM:
VON NEUMANN & HARVARD COMPUTERS

🞆 Von Neumann Architecture

• Same memory holds data, instructions.


• A single set of address/data buses between CPU and
memory

🞆 Harvard Architecture

• Separate memories for data and instructions.


• Two sets of address/data buses between CPU and
memory
RISC AND CISC ARCHITECTURES:

🞆 Microchip use three method to increase the processing


power of the PIC microcontrollers; which are:
1. Increase the clock frequency of the chip. One drawback
of this method is that the higher frequency the more
power and heat dissipation.
2. Use Harvard architecture, by increasing the number
buses to bring more code & data into the CPU.
3. Change the internal architecture of the CPU and use
what is called RISC architecture.
COMPARISON BETWEEN RISC & CISC:

RISC CISC
Reduced Instruction Set Complex Instruction Set
Computer Computer

• Simple and Small • Complex and large


instruction set instruction set
• Regular and fixed • Irregular instruction format
instruction format • Complex address modes
• Simple address modes • May also pipeline
• Pipelined instruction instruction execution
execution --> 95% is
executed in one cycle
RISC CISC

• Provide large number of • Provide smaller number of


CPU registers CPU registers
• Separated data and • Combined data and
program memory program Memory
• Most operations are • Most operations can be
register to memory
register to register
• Take longer time to design
• Take shorter time to
design and debug and debug
MICROCONTROLLER VERSES GENERAL-
PURPOSE MICROPROCESSOR:

• The general-purpose microprocessor are Intel’s x86


family(8086,80286,80386,80486 and the Pentium)
or Motorola’s PowerPC family.
• Microprocessors contains no RAM, no ROM and no
I/O Ports on the chip.
• System designer using general purpose
microprocessor such as Pentium or PowerPC must
add RAM,ROM, I/O Ports and timers externally.
Advantage: Changeability or Flexibility.
Disadvantage: more expensive.
A microcontroller has a CPU(a microprocessor)
with RAM,ROM,I/O Ports and timer all
embedded together on a single chip.
Advantage:
• The fixed amount of on-chip ROM,RAM and
I/O Ports in microcontrollers makes them ideal
for many applications.
Disadvantage:
• Designer cannot add any external memory,
I/O or timers to it.
History of PIC microcontroller.

In 1989, Microchip Technology Corporation


introduced 8-bit microcontroller called PIC.
PIC Stands for Peripheral Interface Controller.
•PIC had small amount of data RAM, few hundred
bytes of On-chip ROM, one timer and few I/O Ports
with 8-pins.
•PIC 32 Features: low-cost, self-contained, 32-bit,
Harvard structure, pipelined, RISC, single, with reset
and multiple interrupt vectors.
🞆 PIC32MX Peripherals (Overview)
PIC32 FEATURES

🞆 The peripherals are connected to the CPU core via two


peripheral buses which enable you to optimize peripheral
operating speed while allowing the CPU to run at
maximum speed (100 MHz):
🞆 SYSCLK Peripheral Bus
⚫ Peripherals operating at the CPU speed
🞆 PBCLK Peripheral Bus
⚫ Peripherals operating at a lower speed
🞆 Available peripherals in PIC32MX cover many categories
and contain several key features:
🞆 Direct Memory Access (DMA)
🞆 Up to eight channels with automatic data size detection
PIC32 PERIPHERALS :

🞆 Programmable Cyclic Redundancy Check (CRC)


🞆 Six additional channels dedicated to USB, Ethernet, and CAN modules
🞆 Communications Interfaces
🞆 USB 2.0-compliant Full-Speed (12 Mbit/s) On-The-Go (OTG) controller
🞆 CAN module (with dedicated DMA channels):
⚫ 2.0 B Active with DeviceNet™ addressing support
🞆 Six Universal Asynchronous Receiver Transmitter (UART) modules
(20 Mbps):
⚫ Supports LIN 1.2 and IrDA  protocols
®

🞆 Up to four 4-wire Serial Peripheral Interface (SPI) modules


🞆 Up to five I2C modules (up to 1 Mbaud) with SMBus support
🞆 Parallel Master Port (PMP)
🞆 Peripheral Pin Select (PPS) to enable function to remap to
digital I/O pins
🞆 Hi-Speed Communications Interfaces
🞆 10/100 Mbps Ethernet MAC with MII and RMII interface
🞆 Timers & Input Capture/Output Compare/PWM
🞆 Five 16-bit or up to two 32-bit timers/counters
🞆 Five Output Compare (OC) modules
🞆 Five Input Capture (IC) modules
🞆 Real-Time Clock and Calendar (RTCC) Module
🞆 Digital Input/Output
🞆 5 V-tolerant pins with up to 22 mA source/sink
🞆 Selectable open drain, pull-ups, and pull-downs
🞆 External interrupts on all I/O pins
🞆 Analog Input/Output
🞆 ADC Module:
⚫ 10-bit 1 Msps rate with one Sample and Hold (S&H)
⚫ 16 analog inputs
⚫ Can operate during Sleep mode
🞆 Flexible and independent Analog-to-Digital Converters
(ADC) trigger sources
🞆 Comparators:
⚫ Two dual-input Comparator modules
⚫ Programmable references with 32 voltage points
🞆 Audio/Graphics/Touch Interfaces
🞆 External graphics interface with up to 34 PMP pins:
⚫ Interface to external graphics controller
⚫ Capable of driving LCD directly with DMA and
internal or external memory
🞆 Audio data communication: I2S, LJ, RJ, USB
🞆 Audio data control interface: SPI and I2C
🞆 Audio data master clock:
⚫ Generation of fractional clock frequencies
⚫ Can be synchronized with USB clock
⚫ Can be tuned at run-time
🞆 Charge Time Measurement Unit (CTMU)
🞆 Supports mTouch™ capacitive touch sensing
🞆 Provides high-resolution time measurement (1 ns)
PIC32 ARCHITECTURE:
🞆 General-purpose, high-performance microcontrollers.
🞆 Microcontroller chip implements industry standard M4K
MIPS32 core processor from MIPS technology Inc.
⮚ Up to 80 MIPS performance
🞆 Core processor connects to the rest of the chip via Bus
Matrix and Peripheral Bus
⮚ Bus Matrix:
• runs at the same speed as the core processor
• connects high-speed modules: USB, DMA, Memory
⮚ peripheral bus:
• can be programmed to run at slower speeds
• connects to slower modules such as A/D converter, USART, SPI, Real-
Time Clock and Calendar (RTCC), and so on
CONT.
🞆 Note that the peripherals are on two different buses: one is
clocked by the System Clock SYSCLK, and the other is
clocked by the Peripheral Bus clock PBCLK. A third clock,
USBCLK, is used for USB communication. The timing
generation block that creates these clock signals and other
elements of the architecture in are briefly described in the
following figure.
OTHER CHIPS: INTERRUPT CONTROLLER

🞆 The job of the interrupt controller is to present any interrupt


request (IRQ) to the CPU. An IRQ may generated by a
variety of sources, i.e changing input on one of the
notification pins; if CPU accepts the request , it will suspend
whatever it is doing and jump to an interrupt service
routine(ISR), after completing the ISR, program control
returns to where it was suspended.
MEMORY: PROGRAM FLASH AND DATA RAM
The PIC32 has two types of memory: Flash and RAM.
🞆Flash
It is generally more plentiful on PIC32's (e.g., 512 KB CASH vs. 128 KB RAM
on the PIC32MX795F512L), nonvolatile (meaning that its contents are
preserved when powered off, unlike RAM), but slower to read and write than
RAM.
🞆RAM
Your program is stored in flash memory and your temporary data is stored in
RAM. When you power cycle your PIC32, your program is still there but your
data in RAM is lost.
Because flash is slow, with a max speed of 30 MHz for the PIC32MX795F512L,
reading a program instruction from flash may take three CPU cycles when
operating at 80 MHz .One job of the pre-fetch cache module (below) is to
minimize or eliminate the need for
the CPU to wait around for program instructions to load.
PRE-FETCH CACHE MODULE:
🞆 The pre-fetch cache module stores recently executed program instructions,
which are likely to be executed again soon.
⮚ The goal is to have the next instruction requested by the CPU already in the cache.
🞆 When the CPU requests an instruction, the cache is first checked. If the
instruction at that memory address is in the cache (a cache hit ), the pre-fetch
module provides the instruction to the CPU immediately. If there is a miss,
the slower load from flash memory begins.
🞆 In some cases, the pre-fetch module can provide the CPU with one instruction
per cycle, hiding the delays due to slow flash access. The module can cache
all instructions in small program loops, so that flash memory does not have to
be accessed while executing the loop.
🞆 For linear code, the 128-bit wide data path between the pre-fetch module and
flash memory allows the pre-fetch module to run ahead of execution despite
the slow flash load times. The pre-fetch cache module can also store constant
data.
CLOCKS AND TIMING GENERATION:
🞆 There are three clocks on the PIC32: SYSCLK, PBCLK, and USBCLK.

🞆 USBCLK is a 48 MHz clock used for USB communication.

🞆 SYSCLK clocks the CPU at a maximum frequency of 80 MHz, adjustable all


the way down to 0 Hz. Higher frequency means more calculations per second
but higher power usage, approximately proportional to frequency.

🞆 PBCLK is used by a number of the peripherals, and its frequency is set to


SYSCLK's frequency divided by 1, 2, 4, or 8. You might want to set
PBCLK's frequency lower than SYSCLK's if you want to save power. If
PBCLK's frequency is less than SYSCLK's, then programs with back-to-back
peripheral operations will cause the CPU to wait cycles before issuing the
second peripheral command to ensure that the first one has completed.
CLOCKS AND TIMING GENERATION:

🞆 All clocks are derived either from an oscillator internal to the PIC32 or
an external resonator or oscillator provided by the user. High-speed
operation requires an external circuit to use a phase-locked loop (PLL)
on the PIC32 to multiply this frequency by a factor of 10, generating a
SYSCLK of 80 MHz.
The PBCLK is set to the same frequency.
🞆 The USBCLK is also derived from the 8 MHz resonator by a PLL
multiplying the frequency by 6.
DIGITAL INPUT AND OUTPUT:

🞆 A digital I/O pin configured as an input: can be used to detect


whether the input voltage is low or high. On the PIC32 is powered by
3.3 V, so voltages close to 0 V are considered low and those close to 3.3
V are considered high. Some input pins can tolerate up to 5.5 V, while
voltages over 3.3 V on other pins could damage the PIC32.
🞆 A digital I/O pin configured as an output: can produce a voltage of 0
or 3.3 V. An output pin can also be configured as open drain. In this
configuration, the pin is connected by an external pull-up resistor to a
voltage of up to 5.5 V. This allows the pin's output transistor to either
sink current (to pull the voltage down to 0 V) or turn off (allowing the
voltage to be pulled up as high as 5.5 V). This increases the range of
output voltages the pin can produce.
COUNTER/TIMERS:

🞆 The PIC32 has five 16-bit counters. Each can count from 0 up to 2ˆ16-
1, or any preset value less than 2 ˆ 16 -1 that we choose, before rolling
over. Counters can be configured to count external events, such as
pulses on a TxCK pin, or internal events, like PBCLK ticks. In the
latter case, we refer to the counter as a timer.
🞆 The counter can be configured to generate an interrupt when it rolls
over. This allows the execution of an ISR on exact timing intervals.
🞆 Two 16-bit counters can be configured to make a single 32-bit counter.
This can be done with two different pairs of counters, giving one 16-bit
counter and two 32-bit counters.
ANALOG INPUT:

ADC:
🞆The PIC32 has a single analog-to-digital converter (ADC), but 16
different pins can be connected to it, one at a time. This allows up to 16
analog voltage values (typically sensor inputs) to be monitored.
🞆The ADC can be programmed to continuously read in data from a
sequence of input pins, or to read in a single value when requested. Input
voltages must be between 0 and 3.3 V.
🞆The ADC has 10 bits of resolution, allowing it to distinguish 1024
different voltage levels.
🞆Conversions are theoretically possible at a maximum rate of 1 million
samples per second on the PIC32MX795F512L.
OUTPUT COMPARE AND INPUT CAPTURE :
🞆 Output compare: pins are used to generate a single pulse of specified
duration, or a continuous pulse train of specified duty cycle and
frequency. They work with timers to generate the precise timing.
A common use of output compare pins is to generate PWM (pulse-
width modulated) signals as control signals for motors.
Pulse trains can also be low-pass filtered to generate approximate
analog outputs.
(There are no analog outputs on the PIC32.)
🞆 Input Capture:
A changing input on an input capture pin can be used to store the
current time measured by a timer.
This allows precise measurements of input pulse widths and signal
frequencies. Optionally, the input capture pin can generate an interrupt.
CHANGE NOTIFICATION , COMPARATORS, AND
REAL-TIME CLOCK AND CALENDAR(RTCC) :

🞆 Change Notification Pin:


A change notification pin can be used to generate an interrupt when the
input voltage changes from low to high or vice-versa.
🞆 Comparator:
A comparator is used to compare which of two analog input voltages is
larger.
A comparator can generate an interrupt when one of the inputs exceeds the
other.
🞆 RTCC:
The RTCC module is used to maintain accurate time, day, month, and year
over extended periods of time while using little power and requiring no
attention from the CPU.
It uses a separate clock, allowing it to run even when the PIC32 is in sleep
mode.
PARALLEL MASTER PORT(PMP) AND
DIRECT MEMORY ACCESS (DMA) CONTROLLER:

🞆 PMP Module:
The PMP module is used to read data from and write data to
external parallel devices with 8-bit and 16-bit data buses.

🞆 DMA Controller:
The Direct Memory Access controller is useful for data transfer
without involving the CPU. For example, DMA can allow an
external device to dump data through a UART directly into
PIC32 RAM.
SPI SERIAL COMMUNICATION THE
SERIAL PERIPHERAL INTERFACE:

🞆 SPI Serial Communication :


The Serial Peripheral Interface bus provides a simple method for serial
communication between a master device (typically a microcontroller)
and one or more slave devices.
Each slave device has four communication pins: a Clock (set by the
master), Data In (from the master), Data Out (to the master), and Select.
The slave is selected for communication if the master holds its Select pin
low.
The master device controls the Clock, has a Data In and a Data Out line,
and one Select line for each slave it can talk to.
Communication rates can be up to tens of megabits per second.
I2C SERIAL COMMUNICATION AND UART SERIAL COMMUNICATION :

🞆 The Inter-Integrated Circuit protocol I2C:


(pronounced “I squared C") is a somewhat more complicated serial
communication standard that allows several devices to communicate over only
two shared lines. Any of the devices can be the master at any given time. The
maximum data rate is less than for SPI.
🞆 The Universal Asynchronous Receiver Transmitter module: provides
another method for serial communication between two devices. There is no
clock line, hence “asynchronous,“ but the two devices communicating must be
set to the same communication rate. Each of the two devices has a Receive
Data line and a Transmit Data line, and typically a Request to Send line (to ask
for permission to send data) and a Clear to Send line (to indicate that the
device is ready to receive data).
Typical data rates are 9600 bits per second (9600 baud) up to hundreds of thousands of
bits per second.
THE UNIVERSAL SERIAL BUS(USB) AND
CONTROLLER AREA NETWORKS(CAN):
🞆 USB The Universal Serial Bus: is a popular asynchronous
communication protocol. One master communicates with one or more
slaves over a four-line bus: +5 V, ground, D+ and D- (differential data
signals).
The PIC32MX795F512L implements USB 2.0 full-speed and low-
speed options, and can communicate at theoretical data rates of up to
several megabits per second.

🞆 CAN Controller Area Networks: are heavily used in electrically noisy


environments (particularly industrial and automotive environments) to
allow many devices to communicate over a single two-wire bus.
Data rates of up to 1 megabit per second are possible.
ETHERNET AND WATCHDOG TIMER:

🞆 The Ethernet module: uses an external PHY chip (physical


layer protocol transceiver chip)and direct memory access
(DMA) to offload from the CPU the heavy processing
requirements of Ethernet communication.

🞆 Watchdog Timer: If the Watchdog Timer is used by your


program, your program must periodically reset the timer
counter. Otherwise, when the counter reaches a specified
value, the PIC32 will reset. This is a way to have the PIC32
restart if your program has entered an unexpected state where
it doesn't pet the watchdog.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy