Introducing Microcontrollers System Design Eng. Ahmed S. Afifi 1
What is a Microcontroller? Mini-Computer CPU (Brain) 1. Arithmetic Logic Unit (ALU) 2. Control Unit 3. Register Program/ Data Memory Peripherals (Input/Output) Buses (data, address and control) 2
Computer Essentials 3
Von Neumann and Harvard Computers 4
Microcontrollers 5
Microprocessors vs. Microcontrollers - Microprocessors Data BUS General Purpose Micro processor Address BUS RAM ROM Timer Serial COM Port IO Port Control BUS - Microcontrollers CPU RAM ROM Serial Port Timer I/O 6
Embedded System General Block Diagram sensor sensor sensor Sensor conditioning Microcontroller (uc) Output interfaces actuator indicator 7
Types of microcontrollers 8
Microcontroller Packaging and Appearance From left to right: PIC 12F508, PIC 16F84A, PIC 16C72, Motorola 68HC05B16, PIC 16F877, Motorola 68000 9
What are PIC s? Programmable Intelligent Computer Developed by Microchip Technology in 1975 Microcontrollers NOT Microprocessors Microprocessor system with number of components (EEPROM, RAM, I/O Support) http://o.mneina.googlepages.com/what_is_microcontroller.htm 10
Why Important? Applications Automotive systems Airplanes Toys Medical Devices Furniture 11
Why Important? Appliances Human interface: Touch Screen Display, Button Control, Audio handling Home systems: Heating & Cooling, Security Cell phones Microchip Human Interface Lab (http://www.microchip.com/stellent/) GSM Phone hacked (http://hackedgadgets.com) 12
Examples: Refrigerator 13
Examples: Car Door 14
Examples: Robot Autonomous Guided Vehicle 15
PIC Families PIC Family Stack Size Instruction Word Size No of Instructions Interrupt Vectors 12CX/12FX 2 12- or 14-bit 33 None 16C5X/16F5X 2 12-bit 33 None 16CX/16FX 8 14-bit 35 1 17CX 16 16-bit 58 4 18CX/18FX 32 16-bit 75 2 C implies CMOS technology; Complementary Metal Oxide Semiconductor F insert indicates incorporation of Flash memory technology Example: 16C84 was the first of its kind. It was later reissued as the 16F84, incorporating Flash memory technology. It was then reissued as 16F84A. 16
PIC Families Divided into families 8-bit: 8F, 16F, 18F 16-bit: 24F, ds33f 32-bit: 32F Minor differences Power Consumption Speed Package size Memory Capacity 17
PIC Families 8-bit: Max Speed 20 MIPS (mill. instr / sec) Generally 4 cycle processor Memory Range <1kB to 128kB instruction up to 32 kb data 16-bit: Max speed 40 MIPS 2 Cycle Processor Memory Range <1kB to 256kB instruction up to 32kB data 32-bit: Max speed 80 MIPS 5 stage pipeline, out of order Memory Range 32kB to 512kB instruction up to 32kB data 18
v http://www.microchip.com/stellent/images/mchpsiteimages/en537986.jpg 19
PIC16Fxxx Microcontroller PIC 16F84A Architecture, Instructions, Applications Microcontroller PIC 16F877 Architecture, Applications with, Keypad, LCD, Stepper motors, Analog to digital conversions, Timers, PWM, Serial communications, graphical LCD 20
Programming Languages ASM Low level Full Control C, BASIC, Forth, LOGO. Easy to use Slow 21
Software Requirements 1. Proteus. 2. MPLAB, MPASM 3. MicroC. 4. QL-2006 programmerpic simulator. 22
Hardware Requirements 1. Pc. 2. QL-2006 Programmer.. 3. Other components as: pic16f84a..pic16f877a..breadboard.. resistors.capacitors LCD sensor Oscillator..power supply 23
Oscillator 24
25
Necessary Connections PIC can be bread-boarded, with the following important connections: Power Ground Reset signal Crystal (oscillator) 26
PIC16F84A The PIC16F84A belongs to the mid-range family. 18-pin Enhanced FLASH/EEPROM 8-Bit Microcontroller. Harvard architecture. Only 35 single word instructions to learn. Operating speed 20 MHz clock input /200 ns instruction cycle. 25 ma sink/source max. Per pin. 10,000 erase/write cycles Enhanced FLASH Program memory typical. 10,000,000 typical erase/write cycles EEPROM Data memory typical. 27
PIC16F84A 15 Special Function Hardware registers. Direct, indirect and relative addressing modes Four interrupt sources: 1- External RB0/INT pin 2- TMR0 timer overflow 3- PORTB<7:4> interrupt-on-change 4- Data EEPROM write complete The program memory contains 1K words. 14-bit wide instruction words. 8-bit wide data bytes. The data memory (RAM) contains 68 bytes Data EEPROM is 64 bytes. 28
PIC16F84A 29
Program Memory 30
Data Memory 31
First Application (Buffer) 32
First Application (Buffer) 33
ان شاء الله لما نخلص الكورس ھتعرف تقرا قیم بالمیكرو (دیجیتال او انالوج ( تخرج قیم على المیكروDI\O تعرف تربط المیكروكنترولر بالكمبیوتر وتبادل البیانات ما بینھم تعرف تربط المیكروكنترول بال LCD نعرف نتعامل مع الاشارات الانالوج تعرف تتحكم بالmotor Dc 34
35
THANK YOU 36