Lecture 3
Lecture 3
+
MCU Architecture
RISC (Harvard)
Reduced instruction set computer
Simple operations
Simple addressing modes
Longer compiled program but faster to execute
Uses pipelining
Easy to program.
Low cost.
+
Specifications of PIC
+
PIC Microcontroller product family
+
PIC Microcontroller product family
The F in a name generally indicates the PIC micro uses flash memory and can be erased electronically.
The C generally means it can only be erased by exposing the die to ultraviolet light (which is only
possible if a windowed package style is used). An exception to this rule is the PIC16C84 which uses
EEPROM and is therefore electrically erasable.
+ Features for PIC16F877
+ PIC16F877 Internal Block Diagram
FSR Register
(File
Selection Register, address = 04H, 84H) is an 8-bit register
used as data memory address pointer. This is used in indirect
addressing mode.
INDF Register
(INDirect through FSR, address = 00H, 80H) INDF is not a physical register.
Accessing INDF is actually access the location pointed to by FSR in indirect
addressing mode.
+ PCL & PCLATH
PCL Register
(Program Counter Low Byte, address =02H, 82H)
PCL is actually the lower 8-bits of the 13-bit Program
Counter. This is a both readable and writable register.
PCLATH Register
(Program Counter LATcH, address = 0AH, 8AH)
PCLATH is a 8-bit register which can be used to decide the
upper 5-bits of the PC. PCLATH is not the upper 5bits of the
PC.
PCLATH can be read from or written to without affecting
the PC.
The upper 3 bits of PCLATH remain zero and they serve no
purpose. When PCL is written to, the lower 5bits of PCLATH
are automatically loaded to the upper 5bits of the PC.
+ Memory Map Registers
• 16 individual LEDs
• 16 individual switches
• Quad 7-segment display
• 20 x 4 character alphanumeric LCD
• On-board analogue channels (Light /
Potentiometer)
• Audio output socket
+
Adding digital outputs - Light the LED
Create a program that lights an LED attached to the microcontroller.
This program introduces the topic of how to control a digital output.