SlideShare a Scribd company logo
1 of 45
[object Object]
A Comparison of MCS51 Family members Comparisons of various MicroControllers in MCS51 Series
An Introduction to AT89C51 MicroController ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],AT89C51  Basic Features
An Introduction to AT89C51 ... Its Internal Architecture C51 Internal Architecture
An Introduction  to AT89C51 ... Its Pin outs AT89C51 Pinouts Diagram
An Introduction to AT89C51 ... Pinouts Description A Brief Description of  Pinouts of AT89C51 ,[object Object],[object Object],[object Object],[object Object],...continued
An Introduction to AT89C51 ... Pinouts Description A Brief Description of  Pinouts of AT89C51 … continued Below are the RC networks connected with  RST  pin:
An Introduction to AT89C51 ... Pinouts Description ,[object Object],[object Object],[object Object],[object Object],A Brief Description of  Pinouts of AT89C51 … continued ...continued
An Introduction to AT89C51 ... Pinouts Description A Brief Description of  Pinouts of AT89C51 … continued Symbols followed by Pound Sign(#) are “Low Enable”
An Introduction to AT89C51 ... Pinouts Description ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A Brief Description of  Pinouts of AT89C51 … continued
An Introduction to AT89C51 ... Pinouts Description ,[object Object],[object Object],[object Object],[object Object],[object Object],A Brief Description of  Pinouts of AT89C51 … continued ...continued
An Introduction to AT89C51 ... Pinouts Description used as an I/O port, has the capacity to act as multiplexed data and address bus. The discrimination of data and address is provided through  ALE  ( Address Latch Enable ) which is Pin number  30 . A Brief Description of  Pinouts of AT89C51 … continued
An Introduction to AT89C51 ... Its RAM AT89C51 RAM
An Introduction to AT89C51 ... Its SFRs Special Function Registers   ( SFR ) of C51
An Introduction to AT89C51 ... SFRs description A Brief Description of  SFR s   of C51 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
An Introduction to AT89C51 ... SFRs description ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A Brief Description of  SFR s  of C51 …  continued
An Introduction to AT89C51 ... SFRs description ,[object Object],[object Object],A Brief Description of SFRs  of C51 …  continued ,[object Object]
SFRs description ... PSW PSW   ( P rogram   S tatus   W ord) Symbol Address Meaning PSW Bit No P D0 H Even  P arity Flag PSW.0 - D1 H Reserved Flag PSW.1 OV D2 H OV erflow  Flag PSW.2 RS0 D3 H R egister Bank  S elect #0 PSW.3 RS1 D4 H R egister Bank  S elect #1 PSW.4 F0 D5 H F lag  0  for user apply PSW.5
SFRs description ... PSW PSW   ( P rogram   S tatus   W ord) …  continued Symbol Address Meaning PSW Bit No AC D6 H A uxiliary  C arry Flag PSW.6 CY D7 H C arr Y  Flag PSW.7
SFRs description ... ACC and B Registers ACC  ( ACC umulator)  &   B  Registers ACC  ( ACC umulator) and  B  Registers are general purpose Registers; their combined use lies mostly in Arithmetic Instructions while ACC being  used in most of the other instructions (like Logic and Program Flow Control Instructions) of C51 Instruction Set. Both registers are  Bit-Addressable .  ACC  is at address  E0 H while  B  Register is at address  F0 H.
SFRs description ... Port Registers Ports’ Registers… P0, P1, P2 and P3 Ports’ Registers  P0  for Port #0;  P1  for Port #1;  P2  for Port #2 and  P3  for Port #3; are used in accordance with the functionality used in these ports. Writing data to any Port Registers causes an immediate transfer of the data to the respective port while reading data from any Port Register is analogues  to reading the data from the respective physical port. All of the four registers are  Bit-Addressable .  P0  is at  80 H,  P1  at  90 H,  P2  at  A0 H and  P3  at  B0 H.
SFRs description ... DPTR DPTR  ( D ata  P oin T e R )  Register DPTR  is the only Register in AT89C51 which is accessible as 16 bit register. It is also byte addressable as  DPL  ( D ata  P ointer  L ow Byte) and  DPH  ( D ata  P ointer  H igh Byte).  DPTR  is mostly used in addressing blocks of data I.e. as a pointer for a large block of data in Instructions like  MOVX . DPTR is Not-Bit-addressable
SFRs description ... SP Pushing data onto the stack increments the   SP .  Likewise, popping data from the stack, decrements the   SP . If the application software does not re-initialize the   SP , then register bank 1 (and perhaps 2 and 3) is not available, since this area of internal RAM is in stack.   SP  ( S tack  P ointer)  Register
SFRs description ... PCON  PCON  ( P ower  CON trol) Register Symbol Meaning PCON Bit No IDL IDLe  mode, set to active Idle mode PCON.0 PD P ower  D own, set to active power down mode PCON.1 GF0 G eneral Purpose  F lag bit  0 PCON.2 GF1 G eneral  P urpose  F lag bit  1 PCON.3 - Not Defined PCON.4 - Not Defined PCON.5
SFRs description ... PCON PCON  ( P ower  CON trol) Register …  continued Symbol Meaning PCON Bit No - Not Defined PCON.6 SMOD Double Baud Rate Bit; when set Baud Rate is  PCON.7 - doubled in Serial Port Modes 1,2 or 3. -
Timer/Counter Operation of AT89C51 Timer/Counter Operation & its  Registers The Data Registers for the two timers are  TL0  and  TH0  for Timer #1 while  TL1  and  TH1  for the other one.  TMOD  and  TCON  control their operation and modes. There are four modes of operation of the two timers set by  TMOD. A description of  TMOD  and  TCON  follows :
Timer/Counter Operation of AT89C51... TMOD Timer/Counter Operation & its  Registers …  continued TMOD :   Symbol Meaning TMOD Bit No M0 Timer #0  M ode Select Bit # 0 TMOD.0 M1 Timer #0  M ode Select Bit # 1 TMOD.1 C/T# Timer #0  C ounter/ T imer (Low Enable) Select Bit TMOD.2
Timer/Counter Operation of AT89C51 ... TMOD Timer/Counter Operation & its  Registers …  continued TMOD Register :   Symbol Meaning TMOD Bit No GATE Timer #0  GATE  Bit   , set, timer only rubs INT1 is high TMOD.3 M0 Timer #1  M ode Select Bit # 0 TMOD.4 M1 Timer #1  M ode Select Bit # 1 TMOD.5 C/T# Timer #1  C ounter/ T imer (Low Enable) Select Bit TMOD.6 GATE Timer #1  GATE  Bit, set, timer only rubs INT1 is high TMOD.7
Timer/Counter Operation of AT89C51 ... Modes of Operation Timer/Counter Operation & its  Registers …  continued TMOD Register :   M1 Mode Description M0 0 0 13 -bit  T imer  M ode 0 1 1 16 -bit  T imer  M ode 0 1 3 S plit  T imer  M ode; TL0 8-bit timer by its 1 - - mode bits, TH0 same except by - 0 2 8 -bit  A uto- R eload  M ode 1 - - timer 1 mode bits ,Timer 1 stopped -
Timer/Counter Operation of AT89C51 ... TCON Timer/Counter Operation & its  Registers …  continued TCON Register :
Timer/Counter Operation of AT89C51 ... Example An Example of Timer Operation ; A Program to generate 10 kHz Square wave on P1.0 ORG 0H MAIN: MOV TMOD,#02H   ; 8-bit Auto-Reload-Mode MOV TH0,#-50   ; -50 reload value in TH0 SETB TR0   ; start timer LOOP: JNB TF0,LOOP   ; wait for overflow CLR TF0   ; clear timer overflow flag CPL P1.0   ; toggle port bit  SJMP LOOP   ; repeat END
Serial Interface of C51 Serial Interface of C51 & its Registers ,[object Object],[object Object],[object Object]
Serial Interface of C51 ... SCON Serial Interface of C51 & its Registers … continued SCON Register :
Serial Interface of C51 ... Modes of Operation Serial Interface of C51 & its Registers … continued Modes of SCON Register :   0 0 13 -bit  T imer  M ode 0 1 1 16 -bit  T imer  M ode 0 1 3 S plit  T imer  M ode; TL0 8-bit timer by its 1 - - mode bits, TH0 same except by - 0 2 8 -bit  A uto- R eload  M ode 1 - - timer 1 mode bits ,Timer 1 stopped - M1 Mode Description M0
Interrupt Mechanism of C51 Interrupt System of C51 & its Registers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],...continued
Interrupt Mechanism of C51 Interrupt System of C51 & its Registers … continued The ISR executes and takes in action in response to the interrupt. The ISR finishes with a  RETI   (return from interrupt) instruction. The retrieves the old value of the PC from the stack and restores the old interrupts status. Execution of the main program contains where it left. >> I nterrupt  S ervice  R outine ( ISR )is the program that deals with an interrupt. >>  When an interrupt is accepted, the value loaded into PC is called the  interrupt vector . It is the address of the start of ISR for the interrupting source.
Interrupt Mechanism of C51 Interrupt System of C51 & its Registers … continued ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Interrupt Mechanism of C51 ... Interrupt Vector Table Interrupt System of C51 & its Registers … continued Interrupt Source Symbol ISR Address Default Priority System Reset RST 00 H 0 (Highest) External Int. #0 IE0 03 H 1 Timer #0 TF0 0B H 2 External Int. #1 IE1 13 H 3 Timer #1 TF1 1B H 4 Serial Port Int. RI/TI 23 H 5 (Lowest)
Interrupt Mechanism of C51 ... IE Register Interrupt System of C51 & its Registers … continued IE Register :
Interrupt Mechanism of C51 ... IP Register Interrupt System of C51 & its Registers … continued IP Register :
Interrupt Mechanism of C51 ... Program Design Interrupt System of C51 & its Registers … continued Program Design using Interrupts : 02F H 000 H 030 H FFF H Main Program Reset and Interrupt  Entry Points
Interrupt Mechanism of C51 ... External Interrupts Interrupt System of C51 & its Registers … continued External Interrupts : ,[object Object],[object Object],[object Object],[object Object]
Interrupt Mechanism of C51 ... Types of Interrupt Mechanisms Interrupt System of C51 & its Registers … continued Low-Level Activated  IT1 = O (TCON)  Negative-Edge Activated Interrupt  IT1 = 1 (TCON)   External Interrupt 1 is triggered ) by a detected low at the INTI if successive samples of INTI pin show a high in one cycle and low in the next, the interrupt request flag IEI in TCON is set.   12 oscillator periods low High for 1 cycle Low for 1 cycle.   Types of Interrupt Mechanisms
Traffic Lights System Demonstration ... Block Diagram Case Study :: Discussion Traffic Lights System Demonstration Micro- Controller Buf- fer DataLines
[object Object],Data Tranfer Instructions ... Data Movement Instructions

More Related Content

What's hot

Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Sivaranjan Goswami
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerbhadresh savani
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Moeez Shem
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerjokersclown57
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
Energy Metering ICs with Active Real Power
Energy Metering ICs with Active Real PowerEnergy Metering ICs with Active Real Power
Energy Metering ICs with Active Real PowerPremier Farnell
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerJhemi22
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O portsanishgoel
 
Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01cairo university
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programmingsergeiseq
 

What's hot (20)

Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
 
8051 archi
8051 archi8051 archi
8051 archi
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8051 ports
8051 ports8051 ports
8051 ports
 
8051 ram org
8051 ram org8051 ram org
8051 ram org
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Microcontroller 8051 basics (part I)
Microcontroller 8051 basics (part I)Microcontroller 8051 basics (part I)
Microcontroller 8051 basics (part I)
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8051 i/o port circuit
8051 i/o port circuit8051 i/o port circuit
8051 i/o port circuit
 
Energy Metering ICs with Active Real Power
Energy Metering ICs with Active Real PowerEnergy Metering ICs with Active Real Power
Energy Metering ICs with Active Real Power
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O ports
 
8051 microprocessor
8051 microprocessor8051 microprocessor
8051 microprocessor
 
Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programming
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 

Similar to EMBEDDED SYSTEMS 2&3

janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unitjanakiramang6
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Sadiq Rahim
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiramang6
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051guest70d48b1
 
Keypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDACKeypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDACnanocdac
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller Gaurav Verma
 
Microprocessor 8051
Microprocessor 8051Microprocessor 8051
Microprocessor 8051Anil Maurya
 
moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcdabhishek upadhyay
 
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...sangeeta jogade
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMitesh Kumar
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"surabhii007
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerAmandeep Alag
 
Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxShanDimantha1
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorialFutura infotech
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.pptnotagain0712
 

Similar to EMBEDDED SYSTEMS 2&3 (20)

janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unit
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unit
 
AT89C52 Data sheet
AT89C52 Data sheetAT89C52 Data sheet
AT89C52 Data sheet
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
 
Keypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDACKeypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDAC
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
8051 full ppt
8051 full ppt8051 full ppt
8051 full ppt
 
Microprocessor 8051
Microprocessor 8051Microprocessor 8051
Microprocessor 8051
 
moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcd
 
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
 
Microcontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumarMicrocontroller 8051 By Mitesh kumar
Microcontroller 8051 By Mitesh kumar
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontroller
 
Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptx
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorial
 
231456 006
231456 006231456 006
231456 006
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
 
Emb day2 8051
Emb day2 8051Emb day2 8051
Emb day2 8051
 

More from PRADEEP

Unit 3 tables and data structures
Unit 3 tables and data structuresUnit 3 tables and data structures
Unit 3 tables and data structuresPRADEEP
 
Unit 2 software partitioning
Unit 2 software partitioningUnit 2 software partitioning
Unit 2 software partitioningPRADEEP
 
Unit 1 introduction
Unit 1 introductionUnit 1 introduction
Unit 1 introductionPRADEEP
 
Unit 5 multi-board system
Unit 5 multi-board systemUnit 5 multi-board system
Unit 5 multi-board systemPRADEEP
 
19199406 embedded-c-tutorial-8051
19199406 embedded-c-tutorial-805119199406 embedded-c-tutorial-8051
19199406 embedded-c-tutorial-8051PRADEEP
 
13986149 c-pgming-for-embedded-systems
13986149 c-pgming-for-embedded-systems13986149 c-pgming-for-embedded-systems
13986149 c-pgming-for-embedded-systemsPRADEEP
 
22323006 embedded-c-tutorial-8051
22323006 embedded-c-tutorial-805122323006 embedded-c-tutorial-8051
22323006 embedded-c-tutorial-8051PRADEEP
 
14157565 embedded-programming
14157565 embedded-programming14157565 embedded-programming
14157565 embedded-programmingPRADEEP
 
Rtos 3 & 4
Rtos 3 & 4Rtos 3 & 4
Rtos 3 & 4PRADEEP
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to picPRADEEP
 
Interrupts
InterruptsInterrupts
InterruptsPRADEEP
 
Chapter 3
Chapter 3Chapter 3
Chapter 3PRADEEP
 
Leadership lessons-from-obama-
Leadership lessons-from-obama-Leadership lessons-from-obama-
Leadership lessons-from-obama-PRADEEP
 
Programming timers
Programming timersProgramming timers
Programming timersPRADEEP
 
Interfacing stepper motor
Interfacing stepper motorInterfacing stepper motor
Interfacing stepper motorPRADEEP
 
Interfacing rs232
Interfacing rs232Interfacing rs232
Interfacing rs232PRADEEP
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypadPRADEEP
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adcPRADEEP
 

More from PRADEEP (20)

Unit 3 tables and data structures
Unit 3 tables and data structuresUnit 3 tables and data structures
Unit 3 tables and data structures
 
Unit 2 software partitioning
Unit 2 software partitioningUnit 2 software partitioning
Unit 2 software partitioning
 
Unit 1 introduction
Unit 1 introductionUnit 1 introduction
Unit 1 introduction
 
Unit 5 multi-board system
Unit 5 multi-board systemUnit 5 multi-board system
Unit 5 multi-board system
 
16f877
16f87716f877
16f877
 
Mp lab
Mp labMp lab
Mp lab
 
19199406 embedded-c-tutorial-8051
19199406 embedded-c-tutorial-805119199406 embedded-c-tutorial-8051
19199406 embedded-c-tutorial-8051
 
13986149 c-pgming-for-embedded-systems
13986149 c-pgming-for-embedded-systems13986149 c-pgming-for-embedded-systems
13986149 c-pgming-for-embedded-systems
 
22323006 embedded-c-tutorial-8051
22323006 embedded-c-tutorial-805122323006 embedded-c-tutorial-8051
22323006 embedded-c-tutorial-8051
 
14157565 embedded-programming
14157565 embedded-programming14157565 embedded-programming
14157565 embedded-programming
 
Rtos 3 & 4
Rtos 3 & 4Rtos 3 & 4
Rtos 3 & 4
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to pic
 
Interrupts
InterruptsInterrupts
Interrupts
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Leadership lessons-from-obama-
Leadership lessons-from-obama-Leadership lessons-from-obama-
Leadership lessons-from-obama-
 
Programming timers
Programming timersProgramming timers
Programming timers
 
Interfacing stepper motor
Interfacing stepper motorInterfacing stepper motor
Interfacing stepper motor
 
Interfacing rs232
Interfacing rs232Interfacing rs232
Interfacing rs232
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypad
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 

EMBEDDED SYSTEMS 2&3

  • 1.
  • 2. A Comparison of MCS51 Family members Comparisons of various MicroControllers in MCS51 Series
  • 3.
  • 4. An Introduction to AT89C51 ... Its Internal Architecture C51 Internal Architecture
  • 5. An Introduction to AT89C51 ... Its Pin outs AT89C51 Pinouts Diagram
  • 6.
  • 7. An Introduction to AT89C51 ... Pinouts Description A Brief Description of Pinouts of AT89C51 … continued Below are the RC networks connected with RST pin:
  • 8.
  • 9. An Introduction to AT89C51 ... Pinouts Description A Brief Description of Pinouts of AT89C51 … continued Symbols followed by Pound Sign(#) are “Low Enable”
  • 10.
  • 11.
  • 12. An Introduction to AT89C51 ... Pinouts Description used as an I/O port, has the capacity to act as multiplexed data and address bus. The discrimination of data and address is provided through ALE ( Address Latch Enable ) which is Pin number 30 . A Brief Description of Pinouts of AT89C51 … continued
  • 13. An Introduction to AT89C51 ... Its RAM AT89C51 RAM
  • 14. An Introduction to AT89C51 ... Its SFRs Special Function Registers ( SFR ) of C51
  • 15.
  • 16.
  • 17.
  • 18. SFRs description ... PSW PSW ( P rogram S tatus W ord) Symbol Address Meaning PSW Bit No P D0 H Even P arity Flag PSW.0 - D1 H Reserved Flag PSW.1 OV D2 H OV erflow Flag PSW.2 RS0 D3 H R egister Bank S elect #0 PSW.3 RS1 D4 H R egister Bank S elect #1 PSW.4 F0 D5 H F lag 0 for user apply PSW.5
  • 19. SFRs description ... PSW PSW ( P rogram S tatus W ord) … continued Symbol Address Meaning PSW Bit No AC D6 H A uxiliary C arry Flag PSW.6 CY D7 H C arr Y Flag PSW.7
  • 20. SFRs description ... ACC and B Registers ACC ( ACC umulator) & B Registers ACC ( ACC umulator) and B Registers are general purpose Registers; their combined use lies mostly in Arithmetic Instructions while ACC being used in most of the other instructions (like Logic and Program Flow Control Instructions) of C51 Instruction Set. Both registers are Bit-Addressable . ACC is at address E0 H while B Register is at address F0 H.
  • 21. SFRs description ... Port Registers Ports’ Registers… P0, P1, P2 and P3 Ports’ Registers P0 for Port #0; P1 for Port #1; P2 for Port #2 and P3 for Port #3; are used in accordance with the functionality used in these ports. Writing data to any Port Registers causes an immediate transfer of the data to the respective port while reading data from any Port Register is analogues to reading the data from the respective physical port. All of the four registers are Bit-Addressable . P0 is at 80 H, P1 at 90 H, P2 at A0 H and P3 at B0 H.
  • 22. SFRs description ... DPTR DPTR ( D ata P oin T e R ) Register DPTR is the only Register in AT89C51 which is accessible as 16 bit register. It is also byte addressable as DPL ( D ata P ointer L ow Byte) and DPH ( D ata P ointer H igh Byte). DPTR is mostly used in addressing blocks of data I.e. as a pointer for a large block of data in Instructions like MOVX . DPTR is Not-Bit-addressable
  • 23. SFRs description ... SP Pushing data onto the stack increments the SP . Likewise, popping data from the stack, decrements the SP . If the application software does not re-initialize the SP , then register bank 1 (and perhaps 2 and 3) is not available, since this area of internal RAM is in stack. SP ( S tack P ointer) Register
  • 24. SFRs description ... PCON PCON ( P ower CON trol) Register Symbol Meaning PCON Bit No IDL IDLe mode, set to active Idle mode PCON.0 PD P ower D own, set to active power down mode PCON.1 GF0 G eneral Purpose F lag bit 0 PCON.2 GF1 G eneral P urpose F lag bit 1 PCON.3 - Not Defined PCON.4 - Not Defined PCON.5
  • 25. SFRs description ... PCON PCON ( P ower CON trol) Register … continued Symbol Meaning PCON Bit No - Not Defined PCON.6 SMOD Double Baud Rate Bit; when set Baud Rate is PCON.7 - doubled in Serial Port Modes 1,2 or 3. -
  • 26. Timer/Counter Operation of AT89C51 Timer/Counter Operation & its Registers The Data Registers for the two timers are TL0 and TH0 for Timer #1 while TL1 and TH1 for the other one. TMOD and TCON control their operation and modes. There are four modes of operation of the two timers set by TMOD. A description of TMOD and TCON follows :
  • 27. Timer/Counter Operation of AT89C51... TMOD Timer/Counter Operation & its Registers … continued TMOD : Symbol Meaning TMOD Bit No M0 Timer #0 M ode Select Bit # 0 TMOD.0 M1 Timer #0 M ode Select Bit # 1 TMOD.1 C/T# Timer #0 C ounter/ T imer (Low Enable) Select Bit TMOD.2
  • 28. Timer/Counter Operation of AT89C51 ... TMOD Timer/Counter Operation & its Registers … continued TMOD Register : Symbol Meaning TMOD Bit No GATE Timer #0 GATE Bit , set, timer only rubs INT1 is high TMOD.3 M0 Timer #1 M ode Select Bit # 0 TMOD.4 M1 Timer #1 M ode Select Bit # 1 TMOD.5 C/T# Timer #1 C ounter/ T imer (Low Enable) Select Bit TMOD.6 GATE Timer #1 GATE Bit, set, timer only rubs INT1 is high TMOD.7
  • 29. Timer/Counter Operation of AT89C51 ... Modes of Operation Timer/Counter Operation & its Registers … continued TMOD Register : M1 Mode Description M0 0 0 13 -bit T imer M ode 0 1 1 16 -bit T imer M ode 0 1 3 S plit T imer M ode; TL0 8-bit timer by its 1 - - mode bits, TH0 same except by - 0 2 8 -bit A uto- R eload M ode 1 - - timer 1 mode bits ,Timer 1 stopped -
  • 30. Timer/Counter Operation of AT89C51 ... TCON Timer/Counter Operation & its Registers … continued TCON Register :
  • 31. Timer/Counter Operation of AT89C51 ... Example An Example of Timer Operation ; A Program to generate 10 kHz Square wave on P1.0 ORG 0H MAIN: MOV TMOD,#02H ; 8-bit Auto-Reload-Mode MOV TH0,#-50 ; -50 reload value in TH0 SETB TR0 ; start timer LOOP: JNB TF0,LOOP ; wait for overflow CLR TF0 ; clear timer overflow flag CPL P1.0 ; toggle port bit SJMP LOOP ; repeat END
  • 32.
  • 33. Serial Interface of C51 ... SCON Serial Interface of C51 & its Registers … continued SCON Register :
  • 34. Serial Interface of C51 ... Modes of Operation Serial Interface of C51 & its Registers … continued Modes of SCON Register : 0 0 13 -bit T imer M ode 0 1 1 16 -bit T imer M ode 0 1 3 S plit T imer M ode; TL0 8-bit timer by its 1 - - mode bits, TH0 same except by - 0 2 8 -bit A uto- R eload M ode 1 - - timer 1 mode bits ,Timer 1 stopped - M1 Mode Description M0
  • 35.
  • 36. Interrupt Mechanism of C51 Interrupt System of C51 & its Registers … continued The ISR executes and takes in action in response to the interrupt. The ISR finishes with a RETI (return from interrupt) instruction. The retrieves the old value of the PC from the stack and restores the old interrupts status. Execution of the main program contains where it left. >> I nterrupt S ervice R outine ( ISR )is the program that deals with an interrupt. >> When an interrupt is accepted, the value loaded into PC is called the interrupt vector . It is the address of the start of ISR for the interrupting source.
  • 37.
  • 38. Interrupt Mechanism of C51 ... Interrupt Vector Table Interrupt System of C51 & its Registers … continued Interrupt Source Symbol ISR Address Default Priority System Reset RST 00 H 0 (Highest) External Int. #0 IE0 03 H 1 Timer #0 TF0 0B H 2 External Int. #1 IE1 13 H 3 Timer #1 TF1 1B H 4 Serial Port Int. RI/TI 23 H 5 (Lowest)
  • 39. Interrupt Mechanism of C51 ... IE Register Interrupt System of C51 & its Registers … continued IE Register :
  • 40. Interrupt Mechanism of C51 ... IP Register Interrupt System of C51 & its Registers … continued IP Register :
  • 41. Interrupt Mechanism of C51 ... Program Design Interrupt System of C51 & its Registers … continued Program Design using Interrupts : 02F H 000 H 030 H FFF H Main Program Reset and Interrupt Entry Points
  • 42.
  • 43. Interrupt Mechanism of C51 ... Types of Interrupt Mechanisms Interrupt System of C51 & its Registers … continued Low-Level Activated IT1 = O (TCON) Negative-Edge Activated Interrupt IT1 = 1 (TCON) External Interrupt 1 is triggered ) by a detected low at the INTI if successive samples of INTI pin show a high in one cycle and low in the next, the interrupt request flag IEI in TCON is set. 12 oscillator periods low High for 1 cycle Low for 1 cycle. Types of Interrupt Mechanisms
  • 44. Traffic Lights System Demonstration ... Block Diagram Case Study :: Discussion Traffic Lights System Demonstration Micro- Controller Buf- fer DataLines
  • 45.