Beruflich Dokumente
Kultur Dokumente
System
Chapter 1:
Introduction To
Microcontroller
ZAID AIHSAN
012 - 4064213
JABATAN TEKNOLOGI KEJURUTERAAN
ELEKTRIK
UNIVERSITI MALAYSIA PERLIS
WHAT IS
MICROCONTROLLER?
The microcontroller is simply a computer on a chip.
Range of interfaces
Development system support
Cost and availability
MCU FEATURES
Numbers of inputs and
outputs
5 ports with total 32 I/O
pins
Port A 5 pins
Port B 8 pins
Port C 8 pins
Port D 8 pins
Port E 3 pins
Can operate as 1 pin or
combine as 1 port
Each pins has multiple
functions
PROGRAM EXECUTIONS
This chip has to be programmed via
the serial programming pins, PGM,
PGC and PGD.
It avoids the need to reset the MCU manually at start up, or connect an external
reset circuit, as is necessary with some microprocessors.
This is followed by an oscillator start up delay of 1024 cycles of the clock before
program execution starts. At a clock frequency of 4 MHz, this works out to 256
s.
CIP CONFIGURATION WORD
BROWN-OUT RESET
The watchdog timer is designed to automatically reset the MCU if the program
malfunctions, by stopping or getting stuck in loop.
If the program hangs, and the watchdog timer reset instruction not executed,
the MCU will restart, and (possibly) continue correctly, depending on the nature
of the fault.
CIP CONFIGURATION WORD
RC OSCILLATOR
The MCU clock drives the program along, providing the timing
signals for program execution.
Normally, it is connected across the clock pins with a pair of small capacitors (15 pF) to stabilise
the frequency.
The crystal acts as a self-contained resonant circuit, where the quartz or ceramic crystal vibrates
at a precise frequency when subject to electrical stimulation.
The oscillator runs at a set frequency with a typical accuracy of better than 50 parts per million
(ppm), which is equivalent to / 0.005%.
A convenient value (used in our examples later) is 4 MHz; this gives an instruction cycle time of 1
s, making timing calculations a little easier (each instruction takes four clock cycles).
This is also the maximum frequency allowed for the XT configuration setting.
The PIC 16FXXX series MCUs generally run at a maximum clock rate of 20 MHz, using a high-speed
(HS) crystal which requires the selection of the HS configuration option.
CIP CONFIGURATION WORD
CONFIGURATION SETTINGS
The default setting for the configuration bits is 3FFF, which means that the
code protection is off, in-circuit debugging disabled, program write enabled,
low-voltage programming enabled, brown-out reset enabled, power-up timer
disabled, watchdog timer enabled and RC oscillator selected.