You are on page 1of 28

Microprocessor

Microcontroller PIC
16F84 and 16F877A
Giới thiệu môn học (1/2)
• 45 tiết
• C.1: Giới thiệu về VĐK PIC
• C.2: Phần cứng PIC 16F84 và 16F877A
• C.3: Tập lệnh của VĐK PIC và lập trình hợp
ngữ
• C.4: Bộ định thời, truyền dữ liệu đồng
bộ/không đồng bộ
Giới thiệu môn học (2/2)
• C.5: Ngắt
• C. 6: Bộ chuyển đổi tương tự sang số
• C.7: Kit phát triển

• 1. D. W. Smith, PIC in Practice: A Project-based Approach, 2nd


edition, Elsevier, 2006.
• 2. Tài liệu PIC của bộ môn Điện tử công nghiệp, Khoa Công
nghệ Điện tử, trường Đại học Công nghiệp Tp. HCM, 2009.
• 3. Datasheet của PIC16F84 và 16F 877A của hãng Microchip.
• 4. Website http://www.microchip.com/
Introduction
– Introduction
– Program memory
– Microcontroller clock
– The microcontroller system
– Types of microcontroller
– Microcontroller specification
– Using the microcontroller
• Microcontroller hardware
• Programming the microcontroller
Introduction (1/2)
• The microcontroller is an exciting new device in
the field of electronics control.
• It is a complete computer control system on a
single chip, including:
– EPROM program memory
– user RAM for storing program data
– timer circuits
– an instruction set
– special function registers (SFR)
Introduction (2/2)
– power on reset
– Interrupts
– low power consumption
– a security bit for
– software protection
• Some mC like the 16F818/9 devices include
on board A to D converters.
• Programmer: MPASM
Program memory
• EPROM (Electrically Programmable ROM)
– Stores program
– non-volatile
– remembered when the power is switched off
• RAM
– user files and registers
– Moving and manipulating data (instruction)
RAM Example: room heater
• An Analogue to Digital Control Register
(ADCON0)
• A STATUS Register
• A PORT Register
8 bit micro
• PIC Microcontrollers are 8 bit micros
– the memory locations
– the user files
– Registers
Microcontroller clock (1/2)
• orchestrate the movement
• provided by 2 capacitors and a crystal
• provided by an internal oscillator circuit
• 16F84 microcontroller there are 4 oscillator options
– An RC (Resistor/Capacitor) oscillator -> low cost solution.
– An LP oscillator, i.e. 32kHz crystal, -> minimises power
consumption.
– XT which uses a standard crystal configuration.
– HS is the high-speed oscillator option.
Microcontroller clock (2/2)
• 32kHz, 1MHz, 4MHz, 10MHz and 20MHz
• Newer microcontrollers: 16F818 and 12F629
– Oscillator built on the chip
The microcontroller system (1/4)

• The input
– digital devices
• Switches push buttons - keypads
• pressure mats - radio receivers
• float switches - …
The microcontroller system (2/4)
– analogue sensors
• light dependant resistors
• thermistors,
• gas sensors,
• pressure sensors
• …
The microcontroller system (3/4)
• The control unit is the microcontroller
– monitor the inputs -> turns output ON/OFF
– stores the program
– executes the instructions
The microcontroller system (4/4)
• The output devices:
– LEDs,
– buzzers,
– motors,
– Alpha numeric displays,
– radio transmitters,
– 7 segment displays,
– heaters,
– Fans
– ...
choose a microcontroller
• minimum number of inputs and outputs (I/O)
– digital inputs
– analogue inputs (must have an A/D)
– outputs
• size of program memory storage
• The clock frequency
• number of interrupts and timer circuits
• data EEPROM
Types of microcontroller (1/2)
• Basically two types
– Flash devices
• reprogrammed in the programmer
– One Time Programmable Devices (OTP)
• once programmed cannot be reprogrammed
• The windowed devices
– suffix JW
Types of microcontroller (1/2)
• Ex. 16C54 configurations are:
– 16C54JW Windowed device
– 16C54RC OTP, R-C oscillator
– 16C54LP OTP, LP oscillator, 32kHz
– 16C54XT OTP, XT oscillator, 4MHz
– 16C54HS OTP, HS oscillator, 20Mhz
Microcontroller specification (1/2)
• The device number
• Types
– Windowed : JW suffix
– OTP : Oscillator Frequency
– flash device : an F such as 16F84
• The oscillation frequency
– 04 => 4MHz
– 10 => 10MHz
– 20 => 20MHz.
• Temperature range
– 0oC  +70oC
Microcontroller specification (2/2)
Using the microcontroller
• connect the microcontroller to the hardware?
• write and program the code into the
microcontroller?

How to do?
Microcontroller hardware
Microcontroller power supply
Connecting switches (1/2)
• via a pull-up resistor
Connecting switches (2/2)
• Via an internal pull-up
Connecting outputs
• output pin : 20–25mA
• Directly for LEDs or small relays
• a transistor, for dc
• a triac, for ac
Programming the microcontroller
• 35 words (instructions)
tips
• Search and download datasheet
• Read datasheet
• Flow chart

You might also like