100% found this document useful (1 vote)
816 views

PIC16f877A Microcontrollers and Embedded Systems

Introduction to Microcontrollers And Embedded Systems PIC16f877A

Uploaded by

Tarek Barhoum
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
100% found this document useful (1 vote)
816 views

PIC16f877A Microcontrollers and Embedded Systems

Introduction to Microcontrollers And Embedded Systems PIC16f877A

Uploaded by

Tarek Barhoum
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

Microcontrollers &Embedded Systems

(MES)

Lecture #3
PIC Microcontrollers

Dr. Tarek Barhoum

2019-2020
Agenda

What’s a Microcontroller?

Types of Microcontrollers

Features and Internal structure of PIC 16F877A

Peripheral features & power


What is a 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 input/output
peripherals.
• It can only perform simple/specific tasks.
• A microcontroller is often described as a ‘computer-on-a- chip’.
Microcomputer system and Microcontroller
based system
Microcontrollers..
• Microcontrollers are purchased ‘blank’ and then programmed
with a specific control program.
• Once programmed the microcontroller is build into a product to make
the product more intelligent and easier to use.
• A designer will use a Microcontroller to:
• Gather input from various sensors
• Process this input into a set of actions
• Use the output mechanisms on the microcontroller to do
something useful.
Microcontroller components:
Microcontroller components:

1-Microprocessor
2-RAM / 3-Flash memory (program memory )/4-EEPROM
5-Interfaces : power supply ,Ethernet, Lcd, Serial ports ,ADC , Timers,
I/O ports
CISC/RISC

• There are two major approaches to processor architecture:


• Complex Instruction Set Computer (CISC, pronounced "Sisk")
processors and
• Reduced Instruction Set Computer (RISC) processors.
• Classic CISC processors are the Intel x86, Motorola 68xxx, and
National Semiconductor 32xxx processors, and, to a lesser
degree, the Intel Pentium.
• Common RISC architectures are the Freescale/IBM PowerPC,
the MIPS architecture, Sun's SPARC, the ARM, the Atmel AVR,
and the Microchip PIC.
CISC/RISC..
• CISC processors have a single processing unit, external memory, and
a relatively small register set and many hundreds of different
instructions.
• RISC processors have a number of distinguishing characteristics.
• They have large register sets (in some architectures numbering over
1,000), thereby reducing the number of times the processor must
access main memory.
• Often-used variables can be left inside the processor, reducing the
number of accesses to (slow) external memory.
Microcontroller Programming
Low Level : assembly

High Level : C language


Microcontrollers companies:
PIC Microcontrollers
• Programmable IC or Peripheral Interface Controller (PIC) was
originally designed by
General Instruments co.
• In the late 1970s, GI introduced PIC® 1650 and 1655 – RISC
with 30 instructions.
• PIC was sold to Microchip
• Features: low-cost, self-contained, 8-bit, Harvard structure,
pipelined, RISC, single accumulator, with fixed reset and
interrupt vectors.
PIC Microcontroller product family

• 8-bit microcontrollers • 32-bit microcontrollers


• PIC10 • PIC32
• PIC12 • 16-bit digital signal
• PIC14
controllers
• PIC16
• dsPIC30
• PIC17
• dsPIC33F
• PIC18
• 16-bit microcontrollers
• PIC24F
• PIC24H
PIC16F877

• Why PIC16F877A is very popular?


• This is because PIC16F877A is very cheap. Apart from that it is also
very easy to be assembled. Additional components that you need to
make this IC work is just a 5V power supply adapter, a 20MHz crystal
oscillator and 2 units of 22pF capacitors.

• What is the advantages of PIC16F877A?


• This IC can be reprogrammed and erased up to 10,000 times.
Therefore it is very good for new product development phase.

• What is the disadvantages of PIC16F877A?


• This IC has no internal oscillator so you will need an external crystal
of other clock source.
PIC16F877 features :

Key Features PIC16F877


MAX Operating Frequency 20MHz

Flash Program Memory


(14-bit words) 8K
Feature

Data Memory (bytes) 368


EEPROM Data Memory (bytes) 256
RA 0-5 (6)
RB 0-7 (8)
I/O Ports RC 0-7 (8)
s

RD 0-7 (8)
RE 0-2 (3)
Timers 3
Instruction Set 35 Instructions
Pins (DIP) 40 Pins
Introduction to 16f877A :
PIC Microcontroller product family..
• The F in a name generally indicates the PICmicro uses flash
memory and can be erased electronically.
• The C generally means it can only be erased by exposing the die
to ultraviolet light (which is only possible if a windowed package
style is used). An exception to this rule is the PIC16C84 which
uses EEPROM and is therefore electrically erasable.
Same family differences :
Different families:
Microcontroller Packaging and
Appearance

From left to right: PIC 12F508, PIC 16F84A, PIC 16C72,


Motorola 68HC05B16, PIC 16F877,
Motorola 68000
Pic 16877 microcontroller other features :
Bubble diagram of PIC16F877
1

RTES, Lec#3 , Spring 2015 © Ahmad El-Banna


Pin Diagram of

PIC16F877
Quad Flat  Plastic Leaded Chip
Package Carrier Package (PLCC)
(QFP)
Pin Diagram of
PIC16F877..
• Plastic dual in-line
package (DIP)
Pin 1 MCLR:

Master Clear (Reset) input or programming


voltage input. This
pin is an active low RESET to the device.
Pins 11,12 :

Pin 11 is Vdd so
it is connected
to 5 volt

Pin 11 is Vss so
it is connected
to 0 volt
(grounded)
Pins 31,32 :

Pin 32 is Vdd so
it is connected
to 5 volt

Pin 31 is Vss so
it is connected
to 0 volt
(grounded)
Pins 13,14 :
Oscillator crystal ports
Ports:

Analog-to-Digital Module

In 16F877A there are 8 8 input analog channels


PIC16F877 Internal Block Diagram
• The basic architecture of PIC16F877 consists of Program
memory, file registers and RAM, ALU and CPU registers.
Memory of the PIC16F877
• divided into 3 types of memories:

1. Program Memory – A memory that contains the program (which we


had written), after we've burned it. As a reminder, Program Counter
executes commands stored in the program memory, one after the other.
2. Data Memory – This is RAM memory type, which contains a special
registers like SFR (Special Function Register) and GPR (General Purpose
Register). The variables that we store in the Data Memory during the
program are deleted after we turn off the micro. These two memories
have separated data buses, which makes the access to each one of them
very easy.
3. Data EEPROM (Electrically Erasable Programmable Read- Only
Memory) – A memory that allows storing the variables as a result of
burning the written program.
PIC16F877A Registers

• Some CPU Registers:


•W
• PC
• FSR
• IDF
• PCL
• PCLATH
• STATUS
PIC16F877 Peripheral features

1. I/O Ports:
• PIC16F877 has 5 I/O ports:
• PORT A has 6 bit wide, Bidirectional
• PORT B, C, D have 8 bit wide, Bidirectional
• PORT E has 3 bit wide, Bidirectional
• In addition, they have the following alternate
functions:
PIC16F877 Peripheral features

• Each port has 2 control registers:


• TRISx sets whether each pin is an input(1) or
output(0)
• PORTx sets their output bit levels or contain their
input bit levels.
• Pin functionality “overloaded” with other
features.
• Most pins have 25mA source/sink thus it can
drive LEDs directly.
PIC16F877 Peripheral
features…

2. Analog to Digital Converter (ADC)


• Only available in 14bit and 16bit cores

• The result is a 10 bit digital number


• Can generate an interrupt when ADC conversion is done

• The A/D module has 4 registers:


• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register0 (ADCON0)
• A/D Control Register1 (ADCON1)
• Multiplexed 8 channel inputs
PIC16F877 Peripheral features

3. Timer/counter modules
• Generate interrupts on timer overflow
• Can use external pins as clock in/ clock out (ie. for counting
events)
• There are 3 Timer/counter modules:
• Timer0: 8-bit timer/counter with 8-bit pre-scaler
• Timer1: 16-bit timer/counter with 8-bit pre-scaler, can be
incremented during SLEEP via external crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, pre-scaler and
post-scaler.
PIC16F877 Peripheral features

4. Universal Synchronous Asynchronous Receiver


Transmitter
(USART/SCI) with 9-bit address detection.
• Asynchronous communication: UART (RS 232 serial)
• Can do 300bps – 115kbps
• 8 or 9 bits, parity, start and stop bits, etc.
• Outputs 5V  needs a RS232 level converter (e.g
MAX232)

• Synchronous communication: i.e with clock signal


• SPI = Serial Peripheral Interface
• 3 wire: Data in, Data out, Clock
• Master/Slave (can have
multiple masters)
• Very high speed (1.6Mbps)
• Full speed simultaneous send
and receive (Full duplex)
• I2C = Inter IC
• 2 wire: Data and Clock
• Master/Slave (Single master
only)
• Lots of cheap I2C chips
available; typically < 100kbps
PIC16F877 Peripheral features…..

5. Capture, Compare, PWM modules


• Capture is 16-bit, max. resolution is 12.5 ns
• Compare is 16-bit, max. resolution is 200 ns
• PWM max. resolution is 10-bit

6.Parallel Slave Port (PSP) 8-bits wide, with


external RD, WR and CS controls
Clock and Instruction Cycles
Power supply

The need for power, and its sources


• Like any electronic circuit, a microcontroller and the overall
embedded system need to be supplied with electrical power.
• Traditionally, much logic circuitry is supplied at 5 V, arising from the
voltage specified for the TTL family.
• Operating conditions for electronic components are specified in the
manufacturer’s data sheet.
• In terms of power supply there are two important issues:
• the supply voltage required and
• the current that the device will then take from the supply.
• This supply current will be dependent on operating frequency. Also
given are ‘absolute maximum ratings’, which give voltage and power
dissipation levels beyond which the device must not be taken.
16F877A operating conditions
11

RTES, Lec#4 , Spring 2015 © Ahmad El-Banna

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