Avionics Automobile
Consumer Electronics
Office Equipments
Household Appliances 2
Vending Machines
Sojourner
GPS Receivers
Why uC?
Microprocessor:
Application:Processing-Arithmetic,logic operations. Very little external support hardware/Stand alone. Most RAM, ROM and peripherals on chip. Computer on a chip, or System on chip (SOC)
Microcontroller:
Microcontroller
VARIOUS MICROCONTROLLERS
8 bit microcontrollers
Microchip - PIC 12 & 16 Series. Atmel - 89c51 Intel - 8051 Motorola - 68HCxx series
16 bit microcontrollers
Microchip - PIC 18 series
32 bit microcontrollers
ARM Processors
WHY PIC ?
WHY PIC ?
PICs use the Harvard Architecture PICs and most Harvard chips are RISC 35 Instructions
Features
Power On Reset Timer Oscillator Startup Timer WatchDog Timer Sink/Source Current 25ma Flash Programming
WatchDog Timer
00 01 02 .. .. FF Roll Over 00
Areas of Application.
Base-line
Inexpensive controllers, glue logic, simple tasks. E.g., quadrature decoding, digital interfacing.
Mid-range
Multitasking programs, serial communication. E.g., Cheap data acquisition system and digital I/O system for PC off COM ports, data logging.
High-end
RTOS, low end DSP, communications, big moosey applications. E.g., FEC converter, Rocket Flight Computer, cheap FFT chip.
Speed
PICs require a clock to work.
Can use crystals, clock oscillators, or even an RC circuit. Some PICs have a built in 4MHz RC clock - Not very accurate, but requires no external components! Instruction speed = 1/4 clock speed (Tcyc = 4 * Tclk) All PICs can be run from DC to their maximum specd speed:
12C50x 12C67x 16Cxxx 17C4x /17C7xxx 18Cxxx 4MHz 10MHz 20MHz 33MHz 40MHz
Peripherals
Different PICs have different on-board peripherals
Some common peripherals are: Tri-state (floatable) digital I/O pins. Analog to Digital Converters (ADC) (8, 10 and 12bit, 50ksps). Serial communications: UART (RS-232C), SPI, I2C, CAN. Pulse Width Modulation (PWM) (10bit). Timers and counters (8 and 16bit). Watchdog timers, Brown out detect, LCD drivers.
Packages
PICs come in a huge variety of packages:
8 pin DIPs, SOICs: 18pin DIPs, SOICs: 28pin DIPs, SOICs: 40pin DIPs, SOICs: 44 - 68pin PLCCs*: 12C50x (12bit) , 12C67x (14bit) 16C5X (12bit), 16Cxxx (14bit) 16C5X (12bit), 16Cxxx (14bit) 16Cxxx (14bit), 17C4x (16bit) 16Cxxx (14bit), 17Cxx (16bit)
7X
20MHz 200ns 8 No
8bit X 2 + 16bit X 1
87X
20MHz 200ns 8 Yes
8bit X 2 + 16bit X 1
Stack levels Data EEPROM Timers CCP modules ADC USART/SCI SSP/SPI/I2C
Interrupt on Pin Change
No No No No No
2 8bit 1 1 Yes
2 10bit 1 1 Yes
Total pins I/O Ports I/O Pins Prog. m/y Data m/y EEPROM PSP
ADC channels
18 A,B 13 512 B 36 B 64 No
NA
No
NA
No
5
Yes
8
Yes
5
Yes
8
Yes
BOR
PIC 16F874/877
PIC 16F874/877
PIN DIAGRAM
Instruction Bus
PIC16F877A Memory
The PIC16F877A has an 8192 (8k) 14bit instruction program memory 368 Bytes Registers as Data Memory : Special Function Registers: used to control peripherals and PIC behaviors General Purpose Registers: used to a normal temporary storage space (RAM) 256 Bytes of nonvolatile EEPROM
SFR
www.greytechnologies.net
INSTRUCTION SET
1) Move Literal Value To Work Register
Syntax : MOVLW Eg: MOVLW <LITERAL> 0X02
INSTRUCTION SET
1) Bit Set File Register
Syntax : BSF Eg: BSF <File Reg>,<Bit> PORTA,1
INSTRUCTION SET
1) Bit Test File Register Skip if Set
Syntax : BTFSS Eg: BTFSS <File Reg>,<Bit> PORTA,1
INSTRUCTION SET
1) Decrement File Register Skip if Zero
Syntax : DECFSZ Eg: DECFSZ <File Reg>,<Desti.> COUNT,1
Programming PIC
Basic Circuit