You are on page 1of 38

HCMC University of Technology and Education

Faculty of Electrical & Electronic Engineering


No.1 Vo Van Ngan Street, Thu Duc Dist., HCMC, VN

MICROCONTROLLERS

NGUYEN THANH NGHIA


10/13/2020 11
NGUYEN THANH NGHIA
Administration
1. Instructor: Thanh-Nghia Nguyen.
Mail: nghiant@hcmute.edu.vn
https://sites.google.com/a/hcmute.edu.vn/thanh-nghia-nguyen/

Facebook: BMDTCNYS-DHSPKT
Faculty: http://feee.hcmute.edu.vn

2. Textbook: PIC microcontrollers -


Nebojsa Matic.
NGUYEN THANH NGHIA 2
Administration
3. Grading:
 Midterm : 50%
o Online: 10%
o Paper Test: 20%
o Project: 15%
o Attending: 5%
 Final Exam: 50%
4. Syllabus.
NGUYEN THANH NGHIA 3
HCMC University of Technology and Education
Faculty of Electrical & Electronic Engineering
No.1 Vo Van Ngan Street, Thu Duc Dist., HCMC, VN

CHAPTER 1:
PIC16F887 OVERVIEW

NGUYEN THANH NGHIA


10/13/2020 44
NGUYEN THANH NGHIA
Outline
1. Introduction.
2. Microcontroller of MICROCHIP.
3. PIC16F887 main features.
4. PINOUT description.

NGUYEN THANH NGHIA 5


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 There are different kind of Microprocessors,
which are from 4 bits to 64 bits. The 4 bits
microprocessor is not available today but the 8
bits is used.

NGUYEN THANH NGHIA 6


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 The 8-bit microprocessor is suitable for
industrial control requirements. The 32-bit,
64-bit microprocessors are commonly used for
computers.

NGUYEN THANH NGHIA 7


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 Bus is a group of conducting wires which
carries information, all the peripherals are
connected to microprocessor through Bus.

NGUYEN THANH NGHIA 8


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 Microprocessor versus Microcontroller.
Microprocessor Microcontroller

ALU RA RO
ALU
M M
Registers
Registers Control
Unit Serial
connection
Timers
Control Unit Watchdog
Interrups Timer

Ports

NGUYEN THANH NGHIA 9


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 A Microcontroller is a VLSI (Very Large Scale Integration) Integrated
Circuit (IC) that contains electronic computing unit and logic unit
(combinedly known as CPU), Memory (Program Memory and Data
Memory), I/O Ports (Input / Output Ports) and few other components
integrated on a single chip.

NGUYEN THANH NGHIA 10


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 Microcontroller is connected with the
peripherals.

NGUYEN THANH NGHIA 11


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 Why PIC16F887 is very popular?
 This is because PIC16F887 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.

NGUYEN THANH NGHIA 12


Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 What is the advantages of PIC16F887?
 This IC can be reprogrammed and erased up
to 100,000 times. Therefore it is very good for
new product development phase.
 They are reliable and malfunctioning of PIC
percentage is very less. And performance of the
PIC is very fast because of using RISC
architecture.
Power conception is also very less when
compared to other micro controllers.
NGUYEN THANH NGHIA 13
Chapter 1: PIC16F887 OVERVIEW
1. Introduction
 What is the disadvantages of PIC16F887?
 The length of the program will be big because
of using RISC (35 instructions).
 Program memory is not accessible and only
one single accumulator is present.

NGUYEN THANH NGHIA 14


Chapter 1: PIC16F887 OVERVIEW
2. Microcontroller of MICROCHIP
 PIC is a family of microcontrollers produced
by the company Microchip Technology.
 PIC is an abbreviation of “Programmable
Intelligent Computer”.

NGUYEN THANH NGHIA 15


Chapter 1: PIC16F887 OVERVIEW
2. Microcontroller of MICROCHIP
 This is a microcontroller of PIC16F887.

NGUYEN THANH NGHIA 16


Chapter 1: PIC16F887 OVERVIEW
2. Microcontroller of MICROCHIP
 This is a microcontroller of PIC16F887.

NGUYEN THANH NGHIA 17


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Some CPU Registers:
W
 PC
 FSR
 IDF
 PCL
 PCLATH
 STATUS.

NGUYEN THANH NGHIA 18


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 RISC architecture
 Only 35 instructions to learn
 All single-cycle instructions except
branches.
 Operating frequency 0-20 MHz.
 Precision internal oscillator
 Factory calibrated
 Software selectable frequency range of
8MHz to 31KHz.
NGUYEN THANH NGHIA 19
Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 35 input/output pins
 High current source/sink for direct LED
drive
 Software and individually
programmable pull-up resistor
 Interrupt-on-Change pin
 8K ROM memory in FLASH technology
 Chip can be reprogrammed up to 100.000
times.

NGUYEN THANH NGHIA 20


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 256 bytes EEPROM memory
 Data can be written more than 1.000.000
times
 A/D converter
 14-channels
 10-bit resolution
 3 independent timers/counters.

NGUYEN THANH NGHIA 21


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Analog to Digital Converter (ADC):
 Only available in 14bit and 16bit cores.
 Fs (sample rate) < 54KHz.
 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 (Must wait Tacq to change up
sampling capacitor).
 Can take a reference voltage different from that of the
controller.
NGUYEN THANH NGHIA 22
Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Timer/counter modules:
 Generate interrupts on timer overflow
 Can use external pins as clock in/ clock out (ie. For
counting events or using a different Fosc).
 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.
NGUYEN THANH NGHIA 23
Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Enhanced Universal Synchronous
Asynchronous Receiver Transmitter (USART)
module:
 Supports RS-485, RS-232 and LIN2.0
Auto-Baud Detect
 Fixed voltage reference (0.6V)
 Programmable on-chip voltage reference
 Master Synchronous Serial Port (MSSP)
 Supports SPI and I2C mode

NGUYEN THANH NGHIA 24


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 USART module
 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)

NGUYEN THANH NGHIA 25


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 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-Integrated Circuit
- 2 wire: Data and Clock
- Master/Slave (Single master only)
- Lots of cheap I2C chips available; typically <
100kbp.
NGUYEN THANH NGHIA 26
Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Watch-dog timer
 Analogue comparator module with
 Two analogue comparators
 Fixed voltage reference (0.6V)
 Programmable on-chip voltage reference
 PWM output steering control.

NGUYEN THANH NGHIA 27


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Enhanced UART module
 Supports RS-485, RS-232 and LIN2.0
Auto-Baud Detect
 Fixed voltage reference (0.6V)
 Programmable on-chip voltage reference
 Master Synchronous Serial Port (MSSP)
 Supports SPI and I2C mode

NGUYEN THANH NGHIA 28


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Enhanced UART module
 Supports RS-485, RS-232 and LIN2.0
Auto-Baud Detect
 Fixed voltage reference (0.6V)
 Programmable on-chip voltage reference
 Master Synchronous Serial Port (MSSP)
 Supports SPI and I2C mode

NGUYEN THANH NGHIA 29


Chapter 1: PIC16F887 OVERVIEW
3. PIC16F887 main features
 Enhanced UART module
 Supports RS-485, RS-232 and LIN2.0
Auto-Baud Detect
 Fixed voltage reference (0.6V)
 Programmable on-chip voltage reference
 Master Synchronous Serial Port (MSSP)
 Supports SPI and I2C mode

NGUYEN THANH NGHIA 30


Chapter 1: PIC16F887 OVERVIEW
4. PINOUT description
 Most pins of the PIC16F887 microcontroller
are multi-functional as seen in figure above. For
example, designator RA3/AN3/Vref+/C1IN+ for
the fifth pin of the microcontroller indicates that
it has the following functions:
 RA3 Port A third digital input/output
 AN3 Third analog input
 Vref+ Positive voltage reference
 C1IN+ Comparator C1 positive input

NGUYEN THANH NGHIA 31


Chapter 1: PIC16F887 OVERVIEW
4. PINOUT description
 Most pins of the PIC16F887 microcontroller
are multi-functional as seen in figure above. For
example, designator RA3/AN3/Vref+/C1IN+ for
the fifth pin of the microcontroller indicates that
it has the following functions:
 RA3 Port A third digital input/output
 AN3 Third analog input
 Vref+ Positive voltage reference
 C1IN+ Comparator C1 positive input

NGUYEN THANH NGHIA 32


Chapter 1: PIC16F887 OVERVIEW
4. PINOUT description
 Most pins of the PIC16F887 microcontroller
are multi-functional as seen in figure above. For
example, designator RA3/AN3/Vref+/C1IN+ for
the fifth pin of the microcontroller indicates that
it has the following functions:
 RA3 Port A third digital input/output
 AN3 Third analog input
 Vref+ Positive voltage reference
 C1IN+ Comparator C1 positive input

NGUYEN THANH NGHIA 33


PINOUT DESCRIPTION

NGUYEN THANH NGHIA 34


PINOUT DESCRIPTION

NGUYEN THANH NGHIA 35


PINOUT DESCRIPTION

NGUYEN THANH NGHIA 36


PINOUT DESCRIPTION

NGUYEN THANH NGHIA 37


Chapter 1: PIC16F887 OVERVIEW

The end!

NGUYEN THANH NGHIA 38

You might also like