types , programing , interface - egypt · pdf filerequired components pic 16f84a programmer...

33
Institute of Electrical and Electronics Engineers (IEEE) Robotics & Automation Society Egypt Chapter Microcontroller Microcontroller Types , Programing , Interface

Upload: lamtuong

Post on 01-Feb-2018

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Institute of Electrical and Electronics Engineers (IEEE)Robotics & Automation SocietyEgypt Chapter

Microcontroller Microcontroller

Types , Programing , Interface

Page 2: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

objectiveobjective To make the hardware circuit needed for the

microcontroller To make simple program that blink a LED

Page 3: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Microcontroller sampleMicrocontroller sample

Page 4: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Required components Required components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Batteries Cable AC Resistances Resistances Leds

Page 5: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Required toolsRequired tools Multimeter 5v power source . Wire clipper (optional )pp ( p ) Tweezers (optional)

Page 6: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Types of MicrocontrollersTypes of Microcontrollers PIC (peripheral interface controller) ATMEL AVR Philips TI (Texas instruments ) TI (Texas instruments )

Page 7: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Why we will use PIC ?Why we will use PIC ? It is available in the market It’s Burner (programmer ) is easily available ! Relatively cheap y p Have many aiding and ready made projects on internet !

Page 8: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Choose MicrocontrollerChoose Microcontroller

Page 9: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Comparison between different PIC’sComparison between different PIC s

Page 10: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Pin Configuration of the PIC 16f84aPin Configuration of the PIC 16f84a

Page 11: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Memory typesMemory types

Page 12: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Memory configurationMemory configuration

Reset Vector ( 0000h )When a reset is executed, either by turning power

on, by the WDT (Watchdog Timer) or any other , y ( g ) yfactor,the program will start from this address.Peripheral Interrupt Vector ( 0004h )p p ( )When there is a time-out interruption from the timer (TMR0) or an outside interrupt, the program will start from this address.Configuration word ( 2007h )The basic operation of the PIC is specified at this memory location. The enable bits of the Power-up timer, and the Watch-dog timer as well as the oscillator selection bits are set here.Thi i b hi d h l d This area is behind the usual program area and cannot be accessed by the program. These parametersmust be specified using the burner when burningthe program into flash memory

Page 13: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds
Page 14: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

TimerTimer

The PIC16F84A has only one timer (TMR0, an 8 bit timer). It times out when the count reaches 256 and the TOIF bit of the INCON register of the SFR becomes "1". With a timed out condition it is possible to make an

Th ll h interrupt occur. The interrupt will stop the processing which was in progress at that time. To make the interrupt occur the GIF and the TOIE bits of the INTCON register occur the GIF and the TOIE bits of the INTCON register of the SFR must be set (1)

Page 15: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Main connections for the PICMain connections for the PIC It is organized with the manner of which the connections

will be done Pin 5 : 0 volt Pin 14 : 5 volts Pin15 ,16 : Clock crystal and we should connect 2 * (16 , y (

or 20) pF capacitor Pin 4 : MCLR connected with resistance to 5 Volts

Page 16: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Code for LED blinkingCode for LED blinking

/* this sign means comment / this sign means comment Lab Led blinking*/ bi LED Rb0 bisbit LED at Rb0_bit;

void main() {TRISB = 0b00000000; // PORTB All Outputs TRIS is for assinging the port to

be I/OTRISA = 0b00001000; // RA3 is an inputwhile(1) { // Infinite Loop( ) { pLED = 1;Delay_ms(1000); //built in library to make a delay in milli secondsLED = 0;LED = 0;Delay_ms(1000);}

Page 17: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds
Page 18: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Software development environmentSoftware development environment MPlab IDE MikroC CCS

Page 19: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

MPlabMPlab

Page 20: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

MPlabMPlab

Th b i di h i Chi C ll ill b (16f84 16f877 )The number is according to the micro Chip Controller you will buy (16f84a , 16f877a, …. )

Page 21: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

MPlabMPlab

Page 22: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

MPlabMPlab

Page 23: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Problem of the Line FollowerProblem of the Line Follower

Page 24: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

IdeaIdea

Page 25: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

IdeaIdea

Page 26: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

IdeaIdea

Page 27: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

IdeaIdea

Page 28: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Transform the IdeaTransform the Idea

Page 29: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

CodeCode

Page 30: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

CodeCode

Page 31: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

CodeCode

Page 32: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

RefrencesRefrences L8-Microcontrollers & Input-output Systems Dr alaa

khamis , Advanced mechatronics subject Roboclub 2011 Slides done by Eng.Amir Roshdy Ali http://tutorial.cytron.com.my/2012/07/03/getting-started-

with-mplabide/ http://www.youtube.com/watch?v=PhJKhV5l-i4 http://www.youtube.com/watch?v=S1QCZW92fU4p y Q

Page 33: Types , Programing , Interface - Egypt  · PDF fileRequired components Pic 16f84a Programmer (burner ) Breaboard Wires Batteries Cable AC Resistances Leds

Waiting your robots to be done and compete …..

For any Questions you can post it on facebook page you can post it on facebook page

(https://www.facebook.com/RoboClub.guc ) or you can send and E-mail on [email protected]