Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

ECE 513

The PIC Microcontroller


Family
INTRODUCTION
• The PIC microcontroller family is
manufactured by Microchip Technology Inc.
• The name PIC initially referred to
“Programmable Interface Controller”, but
shortly thereafter was renamed
“Programmable Intelligent Computer”.
• The PIC microcontroller architecture is based
on a modified Harvard RISC (Reduced
Instruction Set Computer) instruction set
with dual-bus architecture.
Basic Concepts

Register
 A register or a memory cell is an electronic
circuit which can memorize the state of
one byte.
Basic Concepts

 Special Function Register


 registers whose function is predetermined
by the manufacturer.
Basic Concepts

 Input/Output Ports
 registers (called a “port”) connected to the
microcontroller pins.
Basic Concepts

 Memory Unit
 part of the microcontroller used for data
storage.
 Each memory address
corresponds to one
memory location.
The content of any location
becomes known by its
addressing. Memory can
either be written to or read
From.
…types of memory within the
microcontroller
 Read Only Memory (ROM)
 is used to permanently save the program
being executed.
 Masked ROM
 this ROM are reserved for the great
manufacturers.
 One Time Programmable ROM (OTP
ROM)
 Programming the chip can be done only
once
…types of memory within the
microcontroller
 UV Erasable Programmable ROM (UV
EPROM)

 Flash memory
 the successor to the UV EPROM.
 contents of this memory can be written and
cleared practically an unlimited number of
times
…types of memory within the
microcontroller
 Random Access Memory (RAM)
 It is used for temporary storing data and
intermediate results created and used
during the operation of the microcontroller
 Electrically Erasable Programmable
ROM (EEPROM)
 The contents of the EEPROM may be
changed during operation (similar to RAM),
but remains permanently saved even upon
the power supply goes off (similar to ROM)
Basic Concepts

 Central Processor Unit (CPU)


 a unit which monitors and controls all
processes within the microcontroller
Sub units of the CPU:
 Instruction Decoder is a part of the
electronics which recognizes program
instructions and runs other circuits on the
basis of that.
 Arithmetical Logical Unit (ALU) performs all
mathematical and logical operations upon
data.
 Accumulator is a SFR closely related to the
operation of the ALU.
 Bus
 consists of 8, 16 or more wires.
 two types of buses:
 The address bus consists of as many lines
as necessary for memory addressing. It is
used to transmit the address from the CPU
to the memory.
 The data bus is as wide as the data, in our
case it is 8 bits or wires wide. It is used to
connect all circuits inside the
microcontroller.
 Serial Communication
 Serial communication (also called RS232
communication) enables a microcontroller
to be connected to another microcontroller
or to a PC using a serial cable.
 OSCILLATOR
 is usually configured so as to use quartz
crystal or ceramic resonator for frequency
stability, but it can also operate as a stand-
alone circuit (like RC oscillator).
 POWER SUPPLY CIRCUIT
 Brown out - resets the whole electronics
as soon as the microcontroller incurs a
state of emergency (voltage drops to a
minimum due to electric noise).
 Reset pin is usually marked as MCLR
(Master Clear Reset). It is used for external
reset of the microcontroller by applying a
logic zero (0) or one (1) to it, which
depends on the type of the microcontroller.
 TIMERS/COUNTERS
 These are commonly 8-
or 16-bit SFRs the
contents of which is
automatically
incremented by each
coming pulse. Once a
register is completely
loaded, an interrupt
may be generated.
 INTERRUPT
 Instead of checking each pin or bit
constantly, the microcontroller delegates the
‘wait issue’ to a ‘specialist’ which will
respond only when something attention
worthy happens
 make your programs react to the hardware
of the microcontrollers, which may be a
reaction from the circuit/evironment outside
of the microcontoller.
 WATCHDOG TIMER
 is an electronic timer that is used to
detect and recover from computer
malfunctions.
 A/D CONVERTER
 is an electronic circuit which converts
continuous signals to discrete digital
numbers typically a binary number and
passes it to the CPU for further processing.
 PIC microcontrollers are upward
compatible with each other, a program
developed for one model can very
easily, in many cases with no
modifications, be run on other models
of the family
 The basic assembler instruction set
of PIC microcontrollers consists of only
33 instructions and most of the family
members (except the newly developed
devices) use the same instruction set.
How to choose a microcontroller
for an application
• Number of I/O pins required
• Required peripherals (e.g., USART,
USB)
• The minimum size of program memory
• The minimum size of RAM
• Whether or not EEPROM nonvolatile
data memory is required
• Speed
• Physical size
• Cost
Microcontroller Core Families

 Program memory is where the instructions


are stored and is also called Core Memory.
 Data memory is where data values are
kept.
 The number of instructions a microcontroller
can have is determined by how many bits
are in the program word or Core Memory.
Microcontroller Core Families

BASELINE ARCHITECTURE
 The Baseline Architecture includes the
PIC10 family and portions of the PIC12
and PIC16 families.
 These devices utilize a 12-bit program
word architecture with 6 to 28-pin package
options and support 33 instructions.
 12-bit instruction word (e.g., 12C5XX,
16C5X) (aka 12 Series and the 16C5X
Series)
Microcontroller Core Families

MID-RANGE ARCHITECTURE
 The Mid-Range Architecture includes
members of the PIC12 and PIC16 families
that feature a 14-bit program word
architecture.
 Have 35 instructions. The nice thing is that
the same 33 instructions available on the
Baseline units are still available
 14-bit instruction word (e.g., 16F8X,
16F87X) (aka 16 Series)
Microcontroller Core Families

HIGH PERFORMANCE ARCHITECTURE


 Microchip’s High Performance Architecture
encompasses the PIC18 family of devices.
 These microcontrollers utilize a 16-bit
program word architecture with 18 to 80-pin
package options and have 75 to 83
instructions depending on the particular unit
chosen.
 16-bit instruction word (e.g., 17C7XX,
18C2XX) (aka 17 Series and the 18 Series).
PIC microcontrollers designed
by Microchip Technology
PIC microcontrollers designed
by Microchip Technology
Identifying your uC
Program Memory
 The “C” version of this family (e.g.,
PIC12C08) is based on EPROM program
memory (OTP)
 the “CE” version of the family (e.g.,
PIC12CE518) offers an additional 16-byte
nonvolatile EEPROM data memory.
(OTP+EEPROM)
 The “F” version of this family (e.g., PIC16F84)
is based on flash program memory and “LF”
are Low Voltage Flash
ECE 513
The PIC Microcontroller PIC
16F84A
II. TOPIC OUTLINE:

PIC 16F84A
Introduction
Pin Diagram
 Features
Memory Organization
Introduction

PIC 16F84A
• PIC16F84
belongs to a class
of 8-bit
microcontrollers
of RISC
architecture. Its
general structure
is shown on the
following map
representing
basic blocks.
PIC 16F84A
Pin Diagram
Features
Memory Organization

Refer to data sheet


PIC 16F84A HARDWARE
Clock Generator - Oscillator

Types of Oscillators:

1.Crystal Oscillator (XT Oscillator)


2.RC Oscillator
PIC 16F84A HARDWARE
Clock Generator – XT Oscillator
• Crystal oscillator
is kept in metal
housing with
two pins where
you have
written down
the frequency
at which crystal
oscillates.
PIC 16F84A HARDWARE
Clock Generator – RC Oscillator
• Resonant frequency of RC
oscillator depends on
supply voltage rate,
resistance R, capacity C
and working temperature.
Resonant frequency is also
influenced by normal
variations in process
parameters, by tolerance
of external R and C
components, etc.
PIC 16F84A HARDWARE
Reset
• Reset is used
for putting the
microcontroller
into a 'known'
condition.
REGISTER
5 Special Function Registers
Status Register
The STATUS register
contains the
arithmetic status of
the ALU, the RESET
status and the bank
select bit for
data memory.
STATUS REGISTER
PORTA and TRISA
PORTA and TRISA
PORTA is a 5-bit wide, bi-directional port. The
corresponding data direction register is TRISA.
TRISA bit = 1, the corresponding PORTA pin will
become an input
TRISA bit = 0, the corresponding PORTA pin will
become an output
PORTB and TRISB
PORTB and TRISB
PORTB is an 8-bit wide, bi-directional port. The
corresponding data direction register is TRISB.
TRISB bit = 1, the corresponding PORTB pin will
become an input
TRISB bit = 0, the corresponding PORTB pin will
become an output
W REGISTER
W REGISTER
W REGISTER – is the general purpose register
accessible by program. You can write values directly
only into W register.
End…

You might also like