Professional Documents
Culture Documents
Architectures
Nithin S.
EEE Dept.
Microprocessor vs. Microcontroller
• Microprocessor (P) - Processing unit on a chip.
• Microcontroller (C) - Microprocessor alongside
its peripherals on a chip.
• Peripherals
– Memory
• RAM
• ROM
– Timers
– Communication modules
– ADC( Analog to digital converter)
– I/O ports
p vs. c
RAM
Peripherals
ROM
I/O
c
p
Architectures
• Von – Neumann architecture
Single memory shared by data and program
RISC CISC
Compiler design is complex Compiler is simple
Instructions take almost same Varying clock cycles
number of clock cycles
Pipeline is easy Pipeline is difficult
Less addressing modes More addressing modes
Addressing mode: how data is made available to the processor for operation
PIC16F877a features
• Manufactured by Microchip
• 8 bit microcontroller
• 28/40/44 pin packages
• 35 instructions
• Single cycle instructions, except branching (2
cycles).
• 14 bit opcode
• 8K X 14 Program memory
• 368 x 8 Data memory (usable)
• 256 X 8 EEPROM data memory.
Addressing modes of PIC16f877a
Direct Addressing: Address of the data is
provided in the instruction/opcode itself.
– Eg. MOVWF , address
– Move the content of Work Register to the file
register whose address is given in the instruction.
– Eg. MOVWF 0xF7
– Here 0X represents that it is a hexadecimal
number, and F7 is the address of a particular
register.
Contd…
Immediate Addressing: The data to be
operated is given in the instruction/opcode.
– Eg. MOVLW 0xF7
– Move literal value( direct value given as) 0xF7 to
the Work register.
– Here F7 is the value to be moved to W-Reg
Contd…
Indirect Addressing: the data is provided in an
indirect fashion.
• Similar to pointers in C language.
• Eg. Address in FSR register &
– Data is automatically fetched and made available
in INDF register.
3 ADDWF
Instruction
Decoder MUX
ALU
8 8
Timing and
Control Work
Register Peripherals
Discussions
Program memory 8K x 14 …. ?
14 bit opcode and 8K address locations
2^13 = 8192= 8K
To represent 8K you need 13 bits of address.
C- Carry Flag
Z- Zero flag
7th bit
7 bit address
Contd…
8K X 14
2K
2K
2K
2K
Contd…
Reset Vector - 0000h
– The reset location of program memory
– After power up / reset
– Execution starts from Reset vector