microcontrollers & applications

141
Suresh Kumar K B Lecturer in Electronics

Upload: martin-perez

Post on 30-Dec-2015

71 views

Category:

Documents


6 download

DESCRIPTION

MICROCONTROLLERS & APPLICATIONS. S uresh K umar K B. Lecturer in Electronics. UNIT - II. 8051. MICROCONTROLLER ARCHITECTURE. FEATURES. 8-bit CPU optimized for control applications Extensive Boolean processing (Single-bit logic) capabilities 64K Program Memory address space - PowerPoint PPT Presentation

TRANSCRIPT

  • Suresh Kumar K BLecturer in Electronics

  • *SKB'sUNIT - II

    SKB's

  • *SKB'sFEATURES 8-bit CPU optimized for control applicationsExtensive Boolean processing (Single-bit logic) capabilities64K Program Memory address space64K Data Memory address space4K bytes of on-chip Program Memory128 bytes of on-chip Data RAM32 bidirectional and individually addressable 1/0 linesTwo 16-bit timer/countersFull duplex UART6-source/5-vector interrupt structure with two priority levelsOn-chip clock oscillator

    SKB's

  • *SKB'sPIN DETAILS

    SKB's

  • InterruptControlCPU4KROM128RAMOSCBusControl4 I/O PortsSerialPortBLOCK DIAGRAM

  • *SKB'sARCHITECUREAll

    SKB's

  • *SKB'sARCHITECURE1

    SKB's

  • *SKB'sARCHITECURE2

    SKB's

  • *SKB'sARCHITECURE3

    SKB's

  • *SKB'sMEMORY STRUCTUREExternalEXTINT128SFRExternalProgram MemoryData MemoryEA = 0EA = 1

    SKB's

  • *SKB'sINTERNAL RAM STRUCTUREDirect &IndirectAddressing

    InirectAddressingOnly

    DirectAddressingOnly

    SFR128 Byte Internal RAM

    SKB's

  • *SKB's128 BYTE RAM128 BYTEINTERNAL RAMRegister BanksReg Bank 0Reg Bank 1Reg Bank 2Reg Bank 3BIT AddressableAreaGeneral PurposeArea

    SKB's

  • *SKB'sREGISTER BANK STRUCTUREBank 0Bank 3Bank 2Bank 1Program Status Word - PSW

    R0R1R2R3R4R5R6R7

    R0R1R2R3R4R5R6R7

    R0R1R2R3R4R5R6R7

    R0R1R2R3R4R5R6R7

    CYACF0RS1RS0OV-P

    SKB's

  • *SKB'sSFR

    F8FFF0BF7E8EFE0AccE7D8DFD0PSWD7C8CFC0C7B8IPBFB0P3B7A8IEAFA0P2A798SCONSBUF9F90P19788TCONTMODTL0TL1TH0TH18F80P0SPDPLDPHPCON87

    SKB's

  • *SKB'sUNIT - III

    SKB's

  • *SKB'sTIMERSSERIAL PORTINTERRUPTS

    SKB's

  • *SKB'sTIMERSSERIAL PORTINTERRUPTS

    SKB's

  • *SKB'sTimer 0Timer 1TIMERS

    SKB's

  • *SKB'sOSC12TL(8 Bit)TH(8 Bit)TF(1 Bit)INTERRUPTTIMER / COUNTER

    SKB's

  • *SKB'sOSC12TL0TH0INTERRUPTTIMER 0TF0

    SKB's

  • *SKB'sTL0(5 Bit)INTERRUPTTIMER 0 Mode 0OSC12XTH0(8 Bit)TF013 Bit Timer / CounterMaximum Count = 1FFFh (1111111111111)

    SKB's

  • *SKB'sTL0(8 Bit)INTERRUPTTIMER 0 Mode 1OSC12XTH0(8 Bit)TF016 Bit Timer / CounterMaximum Count = FFFFh (1111111111111111)

    SKB's

  • *SKB'sTL0(8 Bit)INTERRUPTOSC12XTH0(8 Bit)TF0Maximum Count = FFh (11111111)ReloadTIMER 0 Mode 28 Bit Timer / Counter with AUTORELOAD

    SKB's

  • *SKB'sTL0(8 Bit)OSC12XTIMER 0 Mode 3Two - 8 Bit Timer / CounterOSC12TH0(8 Bit)INTERRUPTTF1INTERRUPTTF0

    SKB's

  • *SKB'sOSC12TL1TH1TF1INTERRUPTTIMER 1

    SKB's

  • *SKB'sTL1TH1TF1INTERRUPTTIMER 1

    SKB's

  • *SKB'sTL1(5 Bit)INTERRUPTTIMER 1 Mode 0TH1(8 Bit)TF113 Bit Timer / CounterMaximum Count = 1FFFh (1111111111111)OSC12Y

    SKB's

  • *SKB'sTL1(8 Bit)INTERRUPTTIMER 1 Mode 1TH1(8 Bit)TF116 Bit Timer / CounterMaximum Count = FFFFh (1111111111111111)OSC12Y

    SKB's

  • *SKB'sTL1(8 Bit)INTERRUPTTH1(8 Bit)TF1Maximum Count = FFh (11111111)ReloadTIMER 1 Mode 28 Bit Timer / Counter with AUTORELOADOSC12Y

    SKB's

  • *SKB'sTMODTCONTimer 0Timer 1InterruptTimersSFRs Related to TIMER

    SKB's

  • *SKB'sTIMERSSERIAL PORTINTERRUPTS

    SKB's

  • *SKB'sSBUFFZero DetectorTX ControlTX ClockStartShiftSendTISBUFFInput Shift RegisterRX ControlStartRX ClockReceiveShiftRI1 1 1 1 1 1 1 0ShiftClockCLQDSRXDO/PTXDRIRENCLKWrite toBUFFERSerial PortInterruptRXDI/PLoad to BUFFERRead From BUFFER

    SKB's

  • *SKB'sSERIAL PORT Mode 0The Serial Port in Mode-0 has the following features:

    Serial data enters and exits through RXD TXD outputs the shifl clock 8 bits are transmitted / received The baud rate is fixed at (1/12) of the oscillator frequency

    SKB's

  • *SKB'sSERIAL PORT Mode 0

    SKB's

  • *SKB'sSERIAL PORT Mode 0

    SKB's

  • *SKB'sSERIAL PORT Mode 1The Serial Port in Mode-1 has the following features:

    Serial data enters RXD Serial data exits through TXD On receive, the stop bit goes into RB8 in SCON 10 bits are transmitted / receivedStart bit (0)Data bits (8)Stop Bit (1) Baud rate is determined by the Timer 1 over flow rate.

    SKB's

  • *SKB'sSERIAL PORT Mode 1

    SKB's

  • *SKB'sSERIAL PORT Mode 1

    SKB's

  • *SKB'sSERIAL PORT Mode 2The Serial Port in Mode-2 has the following features:

    Serial data enters RXD Serial data exits through TXD 9th data bit (TB8) can be assign value 0 or 1 On receive, the 9th data bit goes into RB8 in SCON 11 bits are transmitted / receivedStart bit (0)Data bits (9)Stop Bit (1) Baud rate is programmable (1/32) or (1/64) of the oscillator frequency

    SKB's

  • *SKB'sSERIAL PORT Mode 2

    SKB's

  • *SKB'sSERIAL PORT Mode 2

    SKB's

  • *SKB'sSERIAL PORT Mode 3The Serial Port in Mode-3 has the following features:

    Serial data enters RXD Serial data exits through TXD 9th data bit (TB8) can be assign value 0 or 1 On receive, the 9th data bit goes into RB8 in SCON 11 bits are transmitted / receivedStart bit (0)Data bits (9)Stop Bit (1) Baud rate is determined by the Timer 1 over flow rate.

    SKB's

  • *SKB'sSERIAL PORT Mode 3

    SKB's

  • *SKB'sSERIAL PORT Mode 3

    SKB's

  • *SKB'sSCONPCONSFRs Related to SERIAL PORT

    SKB's

  • *SKB'sTIMERSSERIAL PORTINTERRUPTS

    SKB's

  • *SKB'sINTERRUPTSThe Interrupt structure has the following features:

    6 sources / 5 vectored interrupts Each interrupts can be individually programmable Each interrupts can have two priority levels Priority levels can be programmed All interrupts can be masked by a single bit - EA External interrupt type can be programmedEdge triggeredLevel Triggered

    SKB's

  • *SKB'sTIMER / COUNTERINTERRUPT SOURCESIE0IE1

    SKB's

  • *SKB'sTIMER / COUNTERIE0IE1Individual EnableGlobal DisableLow Priority InterruptHigh Priority InterruptInterrupt Polling SequenceIE Reg IP Reg

    SKB's

  • *SKB'sIEIPSFRs Related to INTERRUPTSLOWHIGHPriority Within LevelTCON

    SKB's

  • *SKB's

    SKB's

  • *SKB'sMEMORY INTERFACINGExternal RAM Interfacing :-MCS 51ALEEXTRAM

    DataAddressALEP0P2P1P3

    SKB's

  • *SKB'sMEMORY INTERFACINGExternal RAM Interfacing :-AD0AD1AD2AD3D0D1D2D3A0A1A2A3

    SKB's

  • *SKB'sMEMORY INTERFACINGExternal ROM Interfacing :-MCS 51ALEEXTROM

    InstrAddressALEP0P2P1P3EEPROM

    SKB's

  • *SKB's

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sArithmetic Operation GroupADD A,DirectADD A,RnADD A,@RiADD A,#Data

    SKB's

  • *SKB'sArithmetic Operation GroupADDC A,DirectADDC A,RnADDC A,@RiADDC A,#Data

    SKB's

  • *SKB'sArithmetic Operation GroupSUBB A,DirectSUBB A,RnSUBB A,@RiSUBB A,#Data

    SKB's

  • *SKB'sArithmetic Operation GroupINCAINCDirectINCRnINC@Ri

    SKB's

  • *SKB'sArithmetic Operation GroupDECADECDirectDECRnDEC@Ri

    SKB's

  • *SKB'sArithmetic Operation GroupINCDPTRMULABDIVABDAA

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sLogical Operation GroupANL A,DirectANL A,RnANL A,@RiANL A,#DataANL Direct,AANL Direct,#Data

    SKB's

  • *SKB'sLogical Operation GroupORL A,DirectORL A,RnORL A,@RiORL A,#DataORL Direct,AORL Direct,#Data

    SKB's

  • *SKB'sLogical Operation GroupXRL A,DirectXRL A,RnXRL A,@RiXRL A,#DataXRL Direct,AXRL Direct,#Data

    SKB's

  • *SKB'sLogical Operation GroupCLRACPLARLARLCARRARRCASWAP A

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sData Transfer GroupMOV A,DirectMOV A,RnMOV A,@RiMOV A,#DataMOV Rn,DirectMOV Rn,@RiMOV Rn,#Data

    SKB's

  • *SKB'sData Transfer GroupMOV Direct,DirectMOV Direct,RnMOV Direct,@RiMOV Direct,#DataMOV Direct,AMOV @Ri,AMOV @Ri,#Data

    SKB's

  • *SKB'sData Transfer GroupMOV @Ri,DirectMOV DPTR,#DATA16MOVC A,@A+DPTRMOVC A,@A+PCMOVX A,@RiMOVX @Ri,AMOVX @DPTR,A

    SKB's

  • *SKB'sData Transfer GroupPUSH DirectPOP DirectXCH A,RnXCH A,DirectXCH A,@RiXCHD A,@Ri

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sBoolean Variable Manipulation GroupCLRCCLRbitSETBCSETB bitCPLCCPLbit

    SKB's

  • *SKB'sBoolean Variable Manipulation GroupANLC,bitANLC,/bit ORLC,bitORLC,/bitMOVC,bitMOVbit,C

    SKB's

  • *SKB'sBoolean Variable Manipulation GroupJCrelJNCrelJBbit,relJNBbit,relJBC bit,rel

    SKB's

  • *SKB'sInstruction Set 5 Groups

    Arithmetic Operation GroupLogical Operation Group Data Transfer GroupBoolean Variable Manipulation GroupProgram Branching Group

    SKB's

  • *SKB'sProgram Branching GroupACALLaddr11LCALLaddr16RETRETIAJMPaddr11LJMPaddr16SJMPrel

    SKB's

  • *SKB'sProgram Branching GroupJMP @A+DPTRJZ relJNZ relCJNE A,Direct,relCJNE A,#Data,relCJNE Rn,#Data,relCJNE @Ri,#Data,rel

    SKB's

  • *SKB'sProgram Branching GroupDJNZ Rn,relDJNZ Direct,relNOP

    SKB's

  • *SKB'sUNIT - IV

    SKB's

  • *SKB'sUNIT - IV

    SKB's

  • *SKB's8255 Programmable Peripheral Interface24 Programmable I/O pinsThree Configurable Ports - A,B & CBSR ModeTTL Compatible

    SKB's

  • *SKB's8255 Programmable Peripheral Interface

    SKB's

  • *SKB's8255 Programmable Peripheral Interface

    SKB's

  • *SKB's8255 Programmable Peripheral Interface

    A1A0Select00PA01PB10PC11Control reg.

    SKB's

  • *SKB's8255 Programmable Peripheral InterfaceControl Word - GeneralBSR Mode Select0 = BSR Mode Enabled1 = BSR Mode Enabled

    SKB's

  • *SKB's8255 Programmable Peripheral InterfaceX X XNot UsedBit Select000 = Bit 0001 = Bit 1010 = Bit 2011 = Bit 3100 = Bit 4101 = Bit 5110 = Bit 6111 = Bit 70 BSR Mode SelectedControl Word BSR ModeBit Set/Reset1 = Set0 = Reset

    SKB's

  • *SKB's8255 Programmable Peripheral InterfaceMode 0 :-

    SKB's

  • *SKB's8255 Programmable Peripheral InterfaceMode 1 :-

    SKB's

  • *SKB's8255 Programmable Peripheral InterfaceMode 2 :-

    SKB's

  • *SKB's8253 Programmable Interval Timer3 Independent 16bit CountersDC - 2.6MHzBCD or Binary CountingProgrammable Counting ModesSingle Supply Operations

    SKB's

  • *SKB's8253 Programmable Interval TimerPin Diagram :-

    SKB's

  • *SKB's8253 Programmable Interval TimerBlock Diagram :-

    SKB's

  • *SKB's8253 Programmable Interval TimerSystem Interface :-

    SKB's

  • *SKB's8253 Programmable Interval TimerMode Select000 = Mode 0001 = Mode 1X10 = Mode 2X11 = Mode 3100 = Mode 4 101 = Mode 5 Select Counter 00 = Select Counter 001 = Select Counter 110 = Select Counter 211 = IllegalControl WordBinary / BCD1 = BCD0 = BinaryRead / Load00 = Counter Latching01 = Read/Load MSB only10 = Read/Load LSB only11 = Read/Load LSB first then MSB

    SKB's

  • *SKB's8253 Programmable Interval TimerMode 0 :-

    SKB's

  • *SKB'sMode 1 :-8253 Programmable Interval Timer

    SKB's

  • *SKB'sMode 2 :-8253 Programmable Interval Timer

    SKB's

  • *SKB'sMode 3 :-8253 Programmable Interval Timer

    SKB's

  • *SKB'sMode 4 :-8253 Programmable Interval Timer

    SKB's

  • *SKB'sMode 5 :-8253 Programmable Interval Timer

    SKB's

  • *SKB's8279 Programmable Keyboard / Display InterfaceSimultaneous Keyboard & Display DriveScanned Keyboard ModeScanned Sensor Mode8-Character Keyboard FIFODuel 8 / 16 Numerical DisplayR / L Entry 16 bit Display RAMMode Programmable From CPUProgrammable Scan TimingInterrupt Output on Key Entry

    SKB's

  • *SKB'sPin Diagram :-8279 Programmable Keyboard / Display Interface

    SKB's

  • *SKB'sSignal Diagram :-8279 Programmable Keyboard / Display Interface

    SKB's

  • *SKB'sBlock Diagram :-8279 Programmable Keyboard / Display Interface

    SKB's

  • *SKB'sSystem Interface :-8279 Programmable Keyboard / Display Interface

    SKB's

  • *SKB's8251 Programmable Communication InterfacePin Diagram :-

    SKB's

  • *SKB'sBlock Diagram :-8251 Programmable Communication Interface

    SKB's

  • *SKB'sSystem Interface :-8251 Programmable Communication Interface

    SKB's

  • *SKB's8251 Programmable Communication InterfaceMode Instruction Format

    SKB's

  • *SKB's8251 Programmable Communication InterfaceCommand Instruction Format

    SKB's

  • *SKB'sUNIT - V

    SKB's

  • *SKB'sStepper Motor ControlMatrix KeyboardDynamic 7 Segment DisplayAnalog to Digital converterDC Motor ControlLCD DisplaySerial Data Transfer

    SKB's

  • STEPPER MOTOR CONTROLStepper MotorWinding DiagramSpecificationsRotation / Excitation methodsClockwise / Anti Clockwise SequenceSingle & Multi Winding ExcitationDriving unit Digital & Analog

  • STEPPER MOTOR CONTROL

    W1W2W3W4

    1100

    0011

    1001

    0110

    0011

    1001

    1100

    0110

  • STEPPER MOTOR CONTROL

  • MATRIX KEYBOARDGeneral Keyboard StructureAdv & Disadv of General KeyboardLayout of Matrix KeyboardScanning and Sense LinesScan SequenceKey De-bounce Methods

  • MATRIX KEYBOARD1234567890#Scan LinesSense LinesMATRIX KEYBOARD DRIVER

  • MATRIX KEYBOARD1234567890#RL0RL1SL0RL2SL1SL2SL3Scan LinesSense Lines

  • MATRIX KEYBOARD1234567890#

  • MATRIX KEYBOARD

  • MATRIX KEYBOARD

  • DYNAMIC 7 SEGMENT DISPLAYSeven Segment DisplayEight LEDsTwo types Common Anode & Common CathodeDynamic Seven Segment DisplayScan Sequence

  • DYNAMIC 7 SEGMENT DISPLAYVSeven Segment DisplayabcdefgdpabcdefgdpCommon

  • DYNAMIC 7 SEGMENT DISPLAY

  • DYNAMIC 7 SEGMENT DISPLAY

  • DYNAMIC 7 SEGMENT DISPLAY

  • ANALOG TO DIGITAL CONVERTERADCWorkingTypesApplicationsSpecifications No of Bits, i/p, o/p etc

  • ANALOG TO DIGITAL CONVERTER

  • DIGITAL TO ANALOG CONVERTER

  • DC MOTOR CONTROLDC MotorSpeed Control MethodsAdvantage of PWM MethodDriving Circuit

  • DC MOTOR CONTROL

  • LCD DISPLAYPrinciple of LCD16x2 LCDLCD Module Driver & ScreenRAMCharacter MoldingDisplay Type Cursor, L/R Entry etc

  • LCD DISPLAY

  • LCD DISPLAY

  • LCD DISPLAY

  • *SKB's

    Pin numberSymbolLevelI/OFunction1Vss--Power supply (GND)2Vcc--Power supply (+5V)3Vee--Contrast adjust4RS0/1I0 = Instruction input, 1 = Data input5R/W0/1I0 = Write to LCD module, 1 = Read from LCD module6E1, 1->0IEnable signal7DB00/1I/OData bus line 0 (LSB)8DB10/1I/OData bus line 19DB20/1I/OData bus line 210DB30/1I/OData bus line 311DB40/1I/OData bus line 412DB50/1I/OData bus line 513DB60/1I/OData bus line 614DB70/1I/OData bus line 7 (MSB)

    SKB's

  • *SKB's

    InstructionCodeDescriptionExecution timeRSR/WDB7DB6DB5DB4DB3DB2DB1DB0Clear display0000000001Clears display and returns cursor to the home position (address 0).1.64mSCursor home000000001*Returns cursor to home position (address 0). Also returns display being shifted to the original position. DDRAM contents remains unchanged.1.64mSEntry mode set00000001I/DSSets cursor move direction (I/D), specifies to shift the display (S). These operations are performed during data read/write.40uSDisplay On/Off control0000001DCBSets On/Off of all display (D), cursor On/Off (C) and blink of cursor position character (B).40uSCursor/display shift000001S/CR/L**Sets cursor-move or display-shift (S/C), shift direction (R/L). DDRAM contents remains unchanged.40uSFunction set00001DLNF**Sets interface data length (DL), number of display line (N) and character font(F).40uSSet CGRAM address0001CGRAM addressSets the CGRAM address. CGRAM data is sent and received after this setting.40uSSet DDRAM address001DDRAM addressSets the DDRAM address. DDRAM data is sent and received after this setting.40uSRead busy-flag and address counter01BFCGRAM / DDRAM addressReads Busy-flag (BF) indicating internal operation is being performed and reads CGRAM or DDRAM address counter contents (depending on previous instruction).0uSWrite to CGRAM or DDRAM10write dataWrites data to CGRAM or DDRAM.40uSRead from CGRAM or DDRAM11read dataReads data from CGRAM or DDRAM.40uS

    SKB's

  • LCD DISPLAY

    ****