Professional Documents
Culture Documents
1.intro MA PDF
1.intro MA PDF
1.intro MA PDF
1/7/2007
Introduction to Microcontrollers
1/7/2007
What Is a Computer?
A computer is made up
of hardware and
software.
The hardware of a
computer consists of
three types of
components
Processor
Input/Output Devices
Memory
1/7/2007
Processor
Responsible for performing all of
Input/Output Devices
Input devices:
A computer is designed to
Input/Output Devices
Output devices:
User uses the computer to do
Memory
Programs to be executed and data to be
1/7/2007
Processor - Registers
A register is a storage location inside the
CPU.
It is used to hold data and/or a memory
address during the execution of an
instruction.
Because the register is very close to the
CPU, it can provide fast access to operands
for program execution.
The number of registers varies greatly from
processor to processor.
1/7/2007
10
1/7/2007
11
RAM
ROM
Printer
Disk
Monitor
Keyboard
CPU
Data Bus
Read/Write
Control Bus
1/7/2007
12
Microprocessor
Processor packaged in a single integrated circuit.
A microcomputer is a computer that uses a
1/7/2007
13
Microprocessor - Performance
Although the clock rate of the microprocessor has
14
Microprocessor -
Increasing Performance
1/7/2007
15
16
Micro
Processor
RAM
ROM
I/O Port
Timer
Serial
COM
Port
Data Bus
Control Bus
1/7/2007
17
Microcontrollers (uC)
There are several limitations in
18
What is uC?
A microcontroller,
or MCU, is a
computer
implemented on a
single very large
scale integrated
(VLSI) circuit.
1/7/2007
19
uC Components
CPU Registers, ALU, Control Unit
Memory
Timers, including event counting, input capture, output
1/7/2007
20
1/7/2007
21
uC - Applications
Used as controllers for
displays, printers,
keyboards, modems, charge
card phones, palm-top
computers
Home appliances, such as
refrigerators, washing
machines, and microwave
ovens.
Used to control the
operation of engines and
machines in factories
Automobile control : Today,
a luxurious car may use
more than 100 MCUs
1/7/2007
22
Software
Programs are known as software.
A program is a set of instructions that the computer can
execute.
The program is stored in the computers memory in the
form of binary numbers called machine instructions.
0010 0100 0010 0000 (or 2420 in base 16)
adds the contents of the data register at the hex
address 20 to the another register
0110 1010 0000 0101 (or 6A05 in base 16)
clears contents of the data register located at the
address 5 to 0.
When a machine instruction is fetched from the
memory, it will be decoded in the control unit of the
CPU.
Appropriate control signals will then be generated to
trigger the desired operation.
1/7/2007
23
Assembly Language
Software development in machine language
is extremely hard
Program entering, Program debugging,
Program maintenance are difficult
Assembly language was invented to simplify
the programming job.
An assembly program consists of assembly
instructions.
An assembly instruction is the mnemonic
representation of a machine instruction
Eg : movlw k Move a value to register
Eg : bcf f,b Clear bit b of register f
1/7/2007
24
Assembly Language
The assembly program that the programmer enters is called
1/7/2007
25
1/7/2007
26
1/7/2007
27
PIC uC
Microchip has introduced six different lines of
28
1/7/2007
29
I/O ports
Synchronous Serial Port( SSP)
Parallel Slave Port (PSP)
Timer functions, including counters, input capture, output
compare, real-time, interrupt, and watchdog timer
Pulse width modulation (PWM)
SPI and I2C serial interface
Universal Synchronous/Asynchronous Receiver Transmitter
(USART)
A/D converter with 10-bit resolution
Analog comparator
Low-power operation mode
SRAM and EEPROM
EPROM or flash memory
1/7/2007
30
1/7/2007
31
addressable locations.
A memory location is referred to as an information
unit.
Eight bits of information are called a byte.
Four bits of information are called a nibble.
A memory location can be used to store data,
instruction, the status of peripheral devices, and so
on.
Program Memory EPROM / Flash for storing
instructions
Data Memory SRAM for Registers, temporary data
storage
EEPROM Data Storage
1/7/2007
32
13
16
Instructions
(Assembly
code)
14
1/7/2007
33
1/7/2007
34
1/7/2007
35
1/7/2007
36
1/7/2007
37
1/7/2007
38
Data Memory
Data memory is implemented as SRAM.
Each location in the data memory is also referred to
1/7/2007
39
Data Memory
GPRs are used to hold dynamic data when
40
1/7/2007
41
42
Status Register
Working Register
All General Purpose Registers
1/7/2007
43
1/7/2007
44
45
1/7/2007
46
1/7/2007
47
1/7/2007
48
1/7/2007
49
1/7/2007
50
1/7/2007
51
Status Register
1/7/2007
52
Status Register
1/7/2007
53
1/7/2007
54
1/7/2007
55
1/7/2007
56
BSF 0X03, 5
To choose Bank2
BSF 0X03, 6
To choose Bank3
BSF 0X03,5
BSF 0X03,6
57
Q&A
1/7/2007
58
Thankyou
1/7/2007
59