0% found this document useful (0 votes)
16 views

Lec1 DC ppt shortcut

The document provides an overview of microcontrollers (MC) and microprocessors (MP), highlighting their differences, advantages, and functionalities. It details the architecture of the PIC16F877 microcontroller, including its ports, memory types, CPU components, and communication protocols. Additionally, it explains the roles of timers, interrupts, and the significance of power supply management in microcontroller operation.

Uploaded by

Noora Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lec1 DC ppt shortcut

The document provides an overview of microcontrollers (MC) and microprocessors (MP), highlighting their differences, advantages, and functionalities. It details the architecture of the PIC16F877 microcontroller, including its ports, memory types, CPU components, and communication protocols. Additionally, it explains the roles of timers, interrupts, and the significance of power supply management in microcontroller operation.

Uploaded by

Noora Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

PIC Microcontroller

By: Assist. Lec. Noora Nazar


Introduction to Microcontrollers (µCs)
• Integrated circuits: they are small devices, with lots of circuitry inside them,
having few connections for external communication and differ from each
other in terms of function.

For example:
• The (555) IC
• The (7447) IC
Microcontroller (MC)
• Microcontrollers: Is a small computer
on a single integrated circuit used for
a single tasking purpose, contain

-processor core (CPU),

-memory,

-programmable input/output peripherals


Microprocessor (MP)
• Microprocessors: is a computer
processor that incorporates the
functions of a computer's central
processing unit (CPU) on a single
or a few integrated circuit (IC),
used for a multitasking purpose.
Advantages of MC & MP

Q\ What are the advantages of using Microcontrollers and Microprocessors?

1) Both them are configurable (programmable)

2) Using Microprocessor or microcontroller provide flexibility in design

3) They are inexpensive


Compare MC & MP
Microcontroller (MC) Microprocessor (MP)
Contain (CPU, RAM, ROM, Timers, I/O, etc.), Need external devices to communicate with
user cannot change the number and type of real world (add more memory, change
integrated devices. capacity of hard drives, add or remove CD-
ROMs, sound cards, etc.).

It needs external hardware to control Used in instructions, traffic light control etc.
anything, like sensors and motors etc.
The heart of this device is the CPU Same as MC

Used for a single tasking purpose. Used for a multitasking purpose


• Program: A set of step-by-step instructions arranged logically to
guide a microcontroller to respond to different inputs. By changing the
program, the microcontroller changes the behavior.

• MC Pins Properties:

1) The devices with same number of pins are all pin-compatible

2) The pins are functionally the same, as long as their names are same
The pins of the (PIC16F877)

• Every pin has multiple functionality:

-(AN1–AN7): work with analog input,


all others work with digital.

-(OSC 1, OSC 2): for oscillates.


The Ports of the (PIC16F877)
Port: is a group of pins, and the (PIC16F877)
have five ports:

1. Port (A): contains 6 pins labeled (RA0 – RA5)

2. Port (B): contains 8 pins labeled (RB0 – RB7)

3. Port (C): contains 8 pins labeled (RC0 – RC7)

4. Port (D): contains 8 pins labeled (RD0 – RD7)

5. Port (E): contains 3 pins labeled (RE0 – RC2)


Power Supply and MCLR pin
• PIC microcontrollers regulate at 5V power
supply

• Master Clear (MCLR) PIN: has two basic


functions:

1) To reset the MC and keep it in reset state,


until the ground connection is released.

2)To put the microcontroller into


programming mode
Registers
• Register (memory cell): is an electronic circuit, which can memorize the
state of one byte.

• Special Function Registers (SFR registers): registers whose function is


predetermined by the manufacturer, and their bits are connected to internal
circuits such as [timers, A/D converter, oscillators and others]
Input/ Output Ports of the (PIC16F877)

• Input / Output ports: to provide


the MC of any use, it has to be
connected to additional electronics
(i.e. Peripherals)
Input/ Output Pins Features
Input/ Output Pins Features:

1) Maximal current they can give/get, to activate a LED or other similar


low-current consumer (10-20 mA)

2) Each I/O port is under control of another SFR, if register bit is:

Logic (1): the pin is an input pin.

Logic (0): the pin is an output pin.


Memory
• Memory unit: it is part of the
microcontroller used for data
storage.

• ROM memory (Read Only


Memory): it used to permanently
save program being executed.
Types of ROM
• Masked ROM: it loads the program into the chip by the manufacturer
(it can't be changed).

• OTP ROM (One Time Programmable ROM): download a program into


the chip only once

• UV EPROM (UV Erasable Programmable ROM): its function like


OTP ROM, UV lamp erase the saved program and enables the
download of a new program.

• EEPROM Memory (Electrically Erasable Programmable ROM): it


changes its contents during operation (similar to RAM), but remains
permanently saved even when the power supply goes off (similar to
ROM).
RAM
• RAM memory (Random Access Memory): Once the power supply is off the
contents of RAM is cleared.

• Flash memory: it is a successor of UV EPROM, its memory contents can be


written and cleared practically unlimited number of times.
CPU
• Central Processor Unit (CPU): monitors and
controls all processes inside the microcontroller,
and consists of several smaller units, such as:

1) Instruction Decoder

2) Arithmetical Logical Unit (ALU)

3) Accumulator

• Interrupt: it is a signal, which inform the


central processor about such event
Buses
consists of 8, 16 or more wires.

Address Bus Data Bus


consists of (16 bits or wires) used to is as wide as the data (8 bits) used to
transmit address from CPU to memory. connect all circuits inside MC.

• Serial Communication: it is necessary to establish communication between


two devices on longer distances

• Baud rate: number of bits transferred per second [bps].


Serial Communication
Q\ What are the protocols used serial communication systems?

I2C UART
SPI
(Two wire System) (Universal
(Serial Peripheral
Asynchronous
Interface Bus)
Receiver/Transmitter)
Brown out

Brown out is a dangerous state can cause out of control performance


for the MC, and occurs when :

1) MC is turned off

2) when power supply voltage drops to the limit due to powerful


electric noises.
Timers in MC
• Timers: measure time passed between two events ensuring that certain actions or events occur
at specific time.

• Counters: are like timers in a microcontroller. But instead of measuring time, they count pulses
from an external source. So, they're not good for measuring time intervals.

• Watchdog Timer: safety feature in a microcontroller. It has its timer and works separately
from the main system. If the main program stops working, the Watchdog Timer resets the
system, keeping it running smoothly and preventing problems.
Q/ How interrupt signal is generated by timers?

1) If the timer register consists of (8-bits), the largest number the timer can count is 255

2) If this number is exceeded, the timer will be automatically reset and counting will start from zero
(overflow condition)

3) If overflow condition is enabled within the program, this causes interrupt signal.

You might also like