Atmel 8051 Microcontrollers Hardware Manual
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-84316E–8051–01/07To right-shift by an odd number of digits, a one-digit shift mu
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1004316E–8051–01/072.13.5 Using Timer 2 to Generate Baud RatesTimer 2 is sele
Common Features Description2-101 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Figure 2-23. Timer 2 Generated Commonly Used Baud RatesXX
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1024316E–8051–01/07As data bits come in from the right, 1’s shift out to the
Common Features Description2-103 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Figure 2-24. Serial Port Mode 0
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1044316E–8051–01/072.14 Framing Error DetectionFraming bit error detection is
Common Features Description2-105 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.15 Automatic Address Recognition2.15.1 Multiprocessor Co
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1064316E–8051–01/07Slave B:SADDR1111 0011bSADEN1111 1001bGiven1111 0XX1bSlave
Common Features Description2-107 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Table 2-17. SADEN RegisterSADEN - Slave Address Mask Regi
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1084316E–8051–01/07UART RegistersReset Value = 0000 0000bBit addressableTable
Common Features Description2-109 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Table 2-20. SADEN RegisterSADEN - Slave Address Mask Regi
The 8051 Instruction Set1-9 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07repeated for location 2DH. The CJNE instruction (Compare and Ju
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1104316E–8051–01/07Reset Value = 0000 0000bBit addressableTable 2-24. T2CON
Common Features Description2-111 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Reset Value = 00X1 0000bNot bit addressablePower-off flag
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1124316E–8051–01/07Reset Value = XXX0 0000bNot bit addressable2.16 Interrupts
Common Features Description2-113 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Note that the "priority within level" structure
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-1144316E–8051–01/07The hardware-generated LCALL pushes the contents of the Pr
Common Features Description2-115 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07complete the instruction in progress, plus 4 cycles to com
Printed on recycled paper.Disclaimer: The information in this document is provided in connection with Atmel products. No license, expr
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-104316E–8051–01/07MOV A, ENTRY_NUMBERCALLTABLEThe subroutine “TABLE” would look
The 8051 Instruction Set1-11 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07In this example, FLAG is the name of any addressable bit in th
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-124316E–8051–01/071.9 Jump InstructionsTable 1-11 shows the list of unconditiona
The 8051 Instruction Set1-13 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07The RLA instruction converts the index number (0 through 4) to
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-144316E–8051–01/07*(end loop)DJNZ COUNTER, LOOP(continue)The CJNE instruction (C
The 8051 Instruction Set1-15 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.11 Instruction Set SummaryNote: 1. All mnemonics copyrighted
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-164316E–8051–01/07ANL A,#data AND immediate data to Accumulator 2 12ANL direct,A
The 8051 Instruction Set1-17 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07MOV direct,#data Move immediate data to direct byte 3 24MOV @R
Atmel 8051 Microcontrollers Hardware Manual 14316E–8051–01/07Table of ContentsSection 1The 8051 Instruction Set...
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-184316E–8051–01/07JB bit,rel Jump if direct Bit is set 3 24JNB bit,rel Jump if d
The 8051 Instruction Set1-19 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.12 Instructions That Affect Flag SettingsNote: Operations on
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-204316E–8051–01/071.13 Instruction TableTable 1-14 shows the Hex value of each i
The 8051 Instruction Set1-21 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Table 1-14. 8051 Instruction Tablex7INC @R11-1DEC @R11-1ADD A
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-224316E–8051–01/07xFINC R71-1DEC R71-1ADD A,R71-1,C,OV,ACADDC A,R71-1,C,OV,ACORL
The 8051 Instruction Set1-23 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14 Instruction Definitions1.14.1 ACALL addr11Function: Absol
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-244316E–8051–01/071.14.2 ADD A,<src-byte>Function: AddDescription: ADD add
The 8051 Instruction Set1-25 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.3 ADDC A, <src-byte> Function: Add with CarryDescri
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-264316E–8051–01/071.14.4 AJMPaddr11Function: Absolute JumpDescription: AJMP tran
The 8051 Instruction Set1-27 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.5 ANL<dest-byte>,<src-byte>Function: Logical-
Atmel 8051 Microcontrollers Hardware Manual 1-1Rev. 4316E–8051–01/07Section 1The 8051 Instruction SetThe 8051 instruction set is optimized for 8-bit c
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-284316E–8051–01/071.14.6 ANLC,<src-bit>ANL A,#dataBytes: 2Cycles: 1Encodi
The 8051 Instruction Set1-29 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.7 CJNE <dest-byte>,<src-byte>, relANL C,/bit
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-304316E–8051–01/07CJNE A,#data,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 0 0 im
The 8051 Instruction Set1-31 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.8 CLR A1.14.9 CLR bitFunction: Clear AccumulatorDescripti
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-324316E–8051–01/071.14.10 CPL A1.14.11 CPL bitFunction: Complement AccumulatorDe
The 8051 Instruction Set1-33 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.12 DA AFunction: Decimal-adjust Accumulator for AdditionD
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-344316E–8051–01/071.14.13 DECbyteFunction: DecrementDescription: DEC byte decrem
The 8051 Instruction Set1-35 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.14 DIVABFunction: DivideDescription: DIV AB divides the u
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-364316E–8051–01/071.14.15 DJNZ<byte>,<rel-addr>Function: Decrement a
The 8051 Instruction Set1-37 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.16 INC<byte>Function: IncrementDescription: INC inc
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-24316E–8051–01/07Table 1-1. PSW: Program Status Word Register1.2 Addressing Mod
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-384316E–8051–01/071.14.17 INC DPTR1.14.18 JB blt,relFunction: Increment Data Poi
The 8051 Instruction Set1-39 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.19 JBC bit,rel1.14.20 JC relFunction: Jump if Bit is set
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-404316E–8051–01/071.14.21 JMP @A+DPTR1.14.22 JNB bit,relFunction: Jump indirectD
The 8051 Instruction Set1-41 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.23 JNC rel1.14.24 JNZ relFunction: Jump if Carry not setD
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-424316E–8051–01/071.14.25 JZ rel1.14.26 LCALLaddr16Function: Jump if Accumulator
The 8051 Instruction Set1-43 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.27 LJMPaddr161.14.28 MOV <dest-byte>,<src-byte&g
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-444316E–8051–01/07*MOV A,directBytes: 2Cycles: 1Encoding: 1 1 1 0 0 1 0 1 direc
The 8051 Instruction Set1-45 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07MOV direct,ABytes: 2Cycles: 1Encoding: 1 1 1 1 0 1 0 1 dire
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-464316E–8051–01/071.14.29 MOV <dest-bit>,<src-bit>MOV @Ri,directB
The 8051 Instruction Set1-47 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.30 MOV DPTR,#data161.14.31 MOVC A,@A+ <base-reg>Fu
The 8051 Instruction Set1-3 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.2.3 Register InstructionsThe register banks, containing regis
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-484316E–8051–01/071.14.32 MOVX <dest-byte>,<src-byte> MOVC A,@A+DPTR
The 8051 Instruction Set1-49 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.33 MUL ABOperation: MOVX(A) ← ((Ri))MOVX A,@DPTRBytes: 1C
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-504316E–8051–01/071.14.34 NOPFunction: No OperationDescription: Execution contin
The 8051 Instruction Set1-51 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.35 ORL<dest-byte> <src-byte>Function: Logical
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-524316E–8051–01/071.14.36 ORL C,<src-bit>ORL A,#dataBytes: 2Cycles: 1Enco
The 8051 Instruction Set1-53 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Cycles: 2Encoding: 1 0 1 0 0 0 0 0 bit addressOperation: ORL(C
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-544316E–8051–01/071.14.37 POP direct1.14.38 PUSH directFunction: Pop from stack.
The 8051 Instruction Set1-55 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.39 RET1.14.40 RETIFunction: Return from subroutineDescrip
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-564316E–8051–01/071.14.41 RL A1.14.42 RLC AFunction: Rotate Accumulator LeftDesc
The 8051 Instruction Set1-57 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.43 RR A1.14.44 RRC AFunction: Rotate Accumulator RightDes
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-44316E–8051–01/071.3 Arithmetic InstructionsThe menu of arithmetic instructions
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-584316E–8051–01/071.14.45 SETB<bit>1.14.46 SJMP relFunction: Set BitDescri
The 8051 Instruction Set1-59 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.47 SUBB A,<src-byte>Function: Subtract with borrowD
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-604316E–8051–01/071.14.48 SWAP A1.14.49 XCH A,<byte>SUBB A,#dataBytes: 2C
The 8051 Instruction Set1-61 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/071.14.50 XCHD A,@RiBytes: 2Cycles: 1Encoding: 1 1 0 0 0 1 0 1 d
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-624316E–8051–01/071.14.51 XRL <dest-byte>,<src-byte> Function: Logic
The 8051 Instruction Set1-63 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07XRL A,@#dataBytes: 2Cycles: 1Encoding: 0 1 1 0 0 1 0 0 imme
Atmel 8051 Microcontrollers Hardware Manual 2-66Rev. 4316E–8051–01/07Section 2Common Features Description2.1 IntroductionThis chapter presents a comp
Common Features Description2-67 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Figure 2-1. 8051 Architecture Block DiagramNote: (*)For Ti
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-684316E–8051–01/072.2 Special Function RegistersA map of the on-chip memory a
Common Features Description2-69 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.2.3 Program Status WordThe PSW register contains program
The 8051 Instruction Set1-5 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07The DA A instruction is for BCD arithmetic operations. In BCD a
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-704316E–8051–01/07RCAP2H and RCAP2L hold the reload value for this mode. More
Common Features Description2-71 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.4 CPU Timing2.4.1 X1 Mode (Standard Mode)A machine cycle
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-724316E–8051–01/07Figure 2-3. 80C51 Fetch/Execute Sequences.2.4.2 X2 Mode Th
Common Features Description2-73 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.5 Port Structures and OperationAll four ports in the 80C5
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-744316E–8051–01/07Figure 2-4. 80C51 Port Bit Latches and I/O Buffers.As show
Common Features Description2-75 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07in the data sheets) when externally pulled low. Port 0, on
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-764316E–8051–01/072.5.3 Port Loading and InterfacingThe output buffer of Port
Common Features Description2-77 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07DJNZ (decrement and jump if not zero, e.g., DJNZ P3, LABEL)
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-784316E–8051–01/07When the CPU is executing out of external Program Memory, a
Common Features Description2-79 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.8 ALEThe main function of ALE is to provide a properly ti
The 8051 Instruction SetAtmel 8051 Microcontrollers Hardware Manual 1-64316E–8051–01/07Note that Boolean operations can be performed on any byte in th
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-804316E–8051–01/07Reset Value = XXXX XX00bTable 2-2. AUXR Register Auxillary
Common Features Description2-81 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.9 Timer/CountersThe Atmel 80C51 Microcontrollers implemen
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-824316E–8051–01/072.10 Timer 0Timer 0 functions as either a timer or event co
Common Features Description2-83 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Figure 2-10. Timer/Counter x (x = 0 or 1) in Mode 12.10.3
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-844316E–8051–01/07Figure 2-12. Timer/Counter 0 in Mode 3: Two 8-bit Counters
Common Features Description2-85 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Figure 2-13. Timer/Counter 1 Mode 0: 13-bit Counter 2.11.2
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-864316E–8051–01/07Figure 2-15. Timer Interrupt System2.11.6 Timer Registers
Common Features Description2-87 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Reset Value = 0000 0000bTable 2-5. TH0 Register - TH0 (S:8
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-884316E–8051–01/07Table 2-6. TL0 Register - TL0 (S:8Ah)Timer 0 Low Byte Regi
Common Features Description2-89 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.12 Timer 2Timer 2 is a 16-bit timer/counter which is pres
The 8051 Instruction Set1-7 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07This means the stack can go into the Upper 128, if they are imp
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-904316E–8051–01/07but with the added feature that a 1-to-0 transition at exte
Common Features Description2-91 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07depending on the system oscillator frequency and the value
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-924316E–8051–01/072.12.3 Timer Registers Table 2-9. T2CON Register - T2CON (
Common Features Description2-93 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07Table 2-10. T2MOD Register - T2MOD (S:C9h)Timer 2 Mode Con
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-944316E–8051–01/07Table 2-12. TL2 Register - TL2 (S:CCh) Timer 2 Low Byte Re
Common Features Description2-95 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07The serial port can operate in 4 modes:Mode 0: Serial data
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-964316E–8051–01/07Reset Value = 0000 0000bBit addressable7 6 5 4 3 2 1 0FE/SM
Common Features Description2-97 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/072.13.1 Baud Rates The baud rate in Mode 0 is fixed:The baud
Common Features DescriptionAtmel 8051 Microcontrollers Hardware Manual 2-984316E–8051–01/072.13.3 Internal Baud Rate Generator (BRG)When the internal
Common Features Description2-99 Atmel 8051 Microcontrollers Hardware Manual4316E–8051–01/07The baud rate generator can be used for mode 1 or 3 (refer
Komentáře k této Příručce