Week3 Microcontroller and Assembly Language
Week3 Microcontroller and Assembly Language
Week # 3
2
Numbering Conversion
Decimal
Hexadecimal Binary
3
History
5
Microprocessor Versus Microcontroller
6
Choosing Microcontroller
• Power consumptions
7
PIC Microcontroller
9
Feature Comparison
Timer
ADC
Pin
10
Memory Organization, ROM (Read Only Memory)
11
Memory Organization, RAM (Random Access Memory)
• RAM
– SFR (Special Function Register)
– GPR (General Purpose Register)
• SFRs are dedicated to specific functions such as ALU Status, Port,
Timer, ADC …etc. It has a fixed hardware address.
Ex: STATUS 03h
PORTA ?
TRISA ?
• GPRs are used for data storage and scratch pad, 8 bits of data can
be stored in each location or address.
12
• RAM StructureOrganization,
Memory of RAM (Random Access Memory)
PIC16F747 divided
into 4 Banks
• Each bank consists of
SFR and GPR
• Bank changing request
must be performed prior
to access its contents
13
Registers
• Note: Any data larger than 8 bits must be broken into 8-bit chunks
or byte side before it is able to process
14
Working Register (WREG)
• The Status register contains the arithmetic status of the ALU, the
Reset status and the bank select bits for data memory
• Because of data memory (RAM) is partitioned into multiple banks,
Bits RP1 (Status<6>) and RP0 (Status<5>) are used to access
desired bank select
16
TRIS and PORT Register
17
TRIS and PORT Register
• Some pins for these I/O Ports are multiplexed with an alternate
function for the peripheral features on the device.
18
Programming in Assembly Language
Note: Brackets indicate that a field is optional and not all lines
have them
20
Structure of Assembly Language
21
Opcodes (Instructions)
22
Opcodes (Instructions)
• ADDLW K : ??
23
Opcodes (Instructions)
24
Creating Delays
25
Programming Microcontroller
26
Review Questions
27