microcontroller architecture pic18f family elec 330 digital systems engineering dr. ron hayne images...
TRANSCRIPT
![Page 1: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/1.jpg)
Microcontroller ArchitecturePIC18F Family
ELEC 330
Digital Systems Engineering
Dr. Ron Hayne
Images Courtesy of Ramesh Gaonkar and Delmar Learning
![Page 2: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/2.jpg)
PIC18F Microcontrollers
Microcontroller Unit (MCU) Microprocessor unit (MPU) Harvard Architecture
Program memory for instructionsData memory for data
I/O ports Support devices such as timers
330_02 2
![Page 3: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/3.jpg)
Microcontroller Unit
330_02 3
![Page 4: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/4.jpg)
PIC18F – MPU and Memory
330_02 4
![Page 5: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/5.jpg)
Microprocessor Unit
Includes Arithmetic Logic Unit (ALU), Registers, and Control Unit Arithmetic Logic Unit (ALU)
Instruction decoder 16-bit instructions
Status register that stores flags 5-bits
WREG – working register 8-bit accumulator
330_02 5
![Page 6: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/6.jpg)
Microprocessor Unit
RegistersProgram Counter (PC)
21-bit register that holds the Program Memory address
Bank Select Register (BSR) 4-bit register used in direct addressing the Data Memory
File Select Registers (FSRs) 12-bit registers used as memory pointers in indirect addressing
Data Memory
Control unit Provides timing and control signals
Read and Write operations
330_02 6
![Page 7: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/7.jpg)
PIC18F - Address Buses
Address bus 21-bit address bus for Program Memory
Addressing capacity: 2 MB 12-bit address bus for Data Memory
Addressing capacity: 4 KB
330_02 7
![Page 8: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/8.jpg)
Data Bus and Control Signals
Data bus 16-bit instruction/data bus for Program Memory 8-bit data bus for Data Memory
Control signals Read and Write
330_02 8
![Page 9: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/9.jpg)
PIC18F452/4520 Memory
Program Memory: 32 K Address range: 000000 to 007FFFH
Data Memory: 4 K Address range: 000 to FFFH
Data EEPROM Not part of the data memory space Addressed through special function registers
330_02 9
![Page 10: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/10.jpg)
PIC18F452/4520 Memory
Program Memory
330_02 10
Data Memory
![Page 11: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/11.jpg)
Data Memory Banks
330_02 11
![Page 12: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/12.jpg)
PIC18F452 I/O Ports
Five I/O ports PORT A through PORT E Most I/O pins are multiplexed Generally have eight I/O pins Addresses already assigned to these ports Each port is identified by its assigned SFR
330_02 12
![Page 13: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/13.jpg)
I/O Ports A and B
330_02 13
![Page 14: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/14.jpg)
Data Transfer
330_02 14
![Page 15: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/15.jpg)
MCU Support Devices
Timers Capture, Compare and PWM (CCP Modules)
Serial Communications Master Synchronous Serial Port (MSSP) Addressable USART
A/D converter Parallel Slave Port (PSP) Data EEPROM
330_02 15
![Page 16: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/16.jpg)
MCU Support Devices
330_02 16
![Page 17: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/17.jpg)
PIC18F Special Features
Sleep mode Watchdog timer (WDT) Code protection In-circuit serial programming In-circuit debugger
330_02 17
![Page 18: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/18.jpg)
PIC18F4X2 Architecture Block Diagram
18
![Page 19: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/19.jpg)
PIC18F452 Programming Model
330_02 19
![Page 20: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/20.jpg)
330_02 20
![Page 21: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/21.jpg)
PIC18F Instructions
77 assembly language instructions Earlier PIC families have 33 or 35 instructions
PIC18F instruction set Most instructions are 16-bit word length Four instructions are 32-bit length
330_02 21
![Page 22: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/22.jpg)
Instruction Descriptions
Copy (Move) 8-bit number (Literal) into W register Mnemonics: MOVLW 8-bit Binary format:
0000 1110 XXXX XXXX (any 8-bit number) Copy (Move) contents of W register into PORTC (File)
Mnemonics: MOVWF PORTC, a (‘a’ indicates that PORTC is in the Access Bank)
Binary format:
0110 1110 1000 0010 (82H is PORTC address)
330_02 22
![Page 23: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/23.jpg)
Illustrative Program
Problem statement: Write instructions to light up alternate LEDs at
PORTC
Hardware: PORTC
Bidirectional (input or output) portSetup as output port for display
Logic 1 will turn on an LED
330_02 23
![Page 24: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/24.jpg)
Illustration
Interfacing LEDs to PORTC
330_02 24
![Page 25: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/25.jpg)
Illustration
Program (software) Logic 0 to TRISC sets up PORTC as an output port Byte 55H turns on alternate LEDs
MOVLW 00 ;Load W register with 0 MOVWF TRISC ;Set up PORTC as output MOVLW 0x55 ;Byte 55H to turn on LEDS MOVWF PORTC ;Turn on LEDs SLEEP ;Power down
330_02 25
![Page 26: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/26.jpg)
Illustration
Address Hex Mnemonics Comments
000000 0E00 MOVLW 00 ;Load W with 0s
000002 6E94 MOVWF TRISC ;Set PORTC as output
000004 0E55 MOVLW 0x55 ;Load 55 to turn on LEDs
000006 6E82 MOVWF PORTC ;Turn on LEDs
000008 0003 SLEEP ;Power Down
330_02 26
![Page 27: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/27.jpg)
Illustration
Execution of the instruction:
MOVWF PORTC
330_02 27
![Page 28: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/28.jpg)
PIC18 Simulator IDE
330_02 28
![Page 29: Microcontroller Architecture PIC18F Family ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning](https://reader036.vdocument.in/reader036/viewer/2022081417/56649da65503460f94a91516/html5/thumbnails/29.jpg)
Embedded System
MCU-based System
330_02 29