0% found this document useful (0 votes)
10 views12 pages

PIC18 Microcontroller Architecture Overview

microcontrollers
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

PIC18 Microcontroller Architecture Overview

microcontrollers
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MICROCONTROLLERS

Module-2
Dr. Mini K. Namboothiripad
Electrical
Agnel Charities FCRIT Vashi
PIC18 Structure
• PIC18 microcontroller family
utilizes
• Harvard architecture
• RISC V processor
▪ Most Instructions 2 byte (16 bit)
▪ Many registers
▪ Only basic instruction set
▪ 4 set of buses
• Data bus to carry data
• Carry opcode
• Adddress bus to access data
• Address bus to access the opcode

• Programming Model revolves


around
• A set of registers
• Memory spaces accessible to the
CPU.
Programming Model Components
• Working Register (WREG):
• An 8-bit register used for most arithmetic and logic operations
• Status Register:
• Contains flags indicating the result of operations (e.g., Carry, Zero, Digit Carry)
• File Select Registers (FSR0, FSR1, FSR2):
• For indirect addressing of data memory
• Special Function Registers (SFRs):
• Dedicated registers controlling on-chip peripherals and functionalities (e.g., I/O ports, timers,
ADC, communication modules).
• General Purpose Registers (GPRs):
• For temporary data storage and general-purpose operations within the data memory.
• Bank Select Register
• To access various banks: to access memory more than 256K.
Programming Model Components
• Program Counter (PC):
• A 21 bit register that holds the address of the next instruction to be executed.

• Stack:
• Last in First Out structure
• To store return addresses during subroutine calls and interrupts.
• Not a part of the program or data memory space.
PIC18F Architecture

CPU is at the center


• 8-bit ALU
• 8-bit working register (WREG),
• 8x8 hardware multiplier.
• Higher byte of a multiplication stored in 8-bit register ➔ PRODH
• Lower byte of a multiplication stored in 8-bit register ➔PRODL
PIC18F Architecture
Program Memory on left side
• Program Counter:
• Holds the address of the next instruction to be executed
• A table pointer provides access to tables and to the data stored in
program memory.
• Stack
• To store return addresses during subroutine calls and interrupts
• 21 bit Address bus ➔ 2MB
• Program Counter also 21 bit
Data Memory
• Data Memory at
the top centre:
Contains
• SFR
• General Purpose
Registers arranged
in Banks

• Data bus address


12 bits wide➔
4KB
CIA-NA-1
Basic features of PIC18F-series microcontrollers
• 77 instructions
• PIC16 source code compatible
• Program memory addressing up to 2Mbytes
• Data memory addressing up to 4Kbytes
• 8x8 hardware multiplier
• 16-bit-wide instructions, 8-bit-wide data path
• Up to two 8-bit timers/counters
• Up to three 16-bit timers/counters
PIC18 Programming
• Data Formats for Hexa decimal
• 39H, 0x39, 39
• 0A3H

• Assembler Directives
• EQU(equate)
• Define a constant value or a fixed address.
• Widely used to assign SFR address
• COUNT EQU 25H ➔ count=25H
• MOVLW COUNT ➔ WREG=25H
• Adv: To change a constant value at multiple locations
• SET
• Define a constant value or a fixed address.
• The value assigned by the SET may be reassigned later
Directive Continued
ORG
• Beginning of the address
• When the power is ON, program counter has 00h
• So first instruction need to be at 00h
• org ooh

• END
• End of the source file
• Last line of the program

• #include
• Use the libraries associated with the specific PIC chip
Questions
• What is the advantage of EQU directive?
• Compare the advantage of EQU & SET directives?
• Give the value in WREG for the following.
• MYCOUNT EQU 15
• MOVLW MYCOUNT

• Give the value in filereg 0x20 for the following:

You might also like