Professional Documents
Culture Documents
Lecture2 1 07102020 021152pm
Lecture2 1 07102020 021152pm
INTRO
PIC18f452 features and Pin Description
Bit and Byte addressing in MPLAB C18 and MIKROC
PRAGMA directive and oscillator settings
2
32KB Program ROM (Code ROM/Memory)
256 bytes of EEPROM (To store critical data that doses not need to be changed very often)
34 I/O pins.
3
4
Main Difference between AVR, ARM, 8051 and PIC Microcontrollers
8051 PIC AVR ARM
32-bit mostly also available in
Bus width 8-bit for standard core 8/16/32-bit 8/32-bit
64-bit
UART, USART, SPI, I2C, (special UART, USART, LIN, I2C, SPI, CAN,
PIC, UART, USART, LIN, CAN,
Communication Protocols UART, USART,SPI,I2C purpose AVR support CAN, USB, USB, Ethernet, I2S, DSP,
Ethernet, SPI, I2S
Ethernet) SAI (serial audio interface), IrDA
Speed 12 Clock/instruction cycle 4 Clock/instruction cycle 1 clock/ instruction cycle 1 clock/ instruction cycle
Memory ROM, SRAM, FLASH SRAM, FLASH Flash, SRAM, EEPROM Flash, SDRAM, EEPROM
ISA CLSC Some feature of RISC RISC RISC
Memory Architecture Von Neumann architecture Harvard architecture Modified Modified Harvard architecture
I/0 Ports = 4 (P0, P1, P2, P3) I/0 Ports = 5 (PORTA - PORTE)
Interrupt Sources = 6 Interrupt Sources =18
6
ADC = 8 (10-bit resolution)
CCP modules = 2
I/O ports
7-bit PORTA (RA0 – RA6)
8-bit PORTB (RB0 – RB7)
8-bit PORTC (RC0 – RC7)
8-bit PORTD (RD0 – RD7)
3-bit PORTE (RE0 – RE2)
Analog channels (AN0 – AN7)
Vdd , Vss
External Interrupts
INT0
INT1
INT2
7
8
9
10
11
12
COMPILER USED TO PROGRAM
MPLAB C-18
Mikro-C
Very minor
difference in
syntax!!!
13
REGISTER ADDRESSING SYNTAX
• How to move a data in any particular register of PIC???
14
BIT ADDRESSING SYNTAX
• How to play with particular bit of PIC???
PORTA.RA2=1;
PORTA.F2=1;
PORTA.B2=1; They all
are same
PORTA2_bit=1;
RA2_bit=1;
16