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
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