Timer/counter 0 high byte8CHTL0Timer/counter 0 low byte8AHTH1Timer/counter 1 high byte8DHTL1Timer/counter 1 low byte8BHTH2Timer/counter 2 high byte0CDHTL2Timer/counter 2 low byte0CCHRCAP2HT/C 2 capture register high byte0CBHRCAP2LT/C 2 capture register low byte0CAHSCON*Serial control98HSBUFSerial data buffer99HPCONPower control87H*bit addressable (discussed further in Chapter 8)
26ACC and Its Address•ACC has SFR address 0E0H.1 0000 75 E0 55MOV 0E0H,#55H2 0003 74 55MOV A,#55H3 0005 D2E1SETB A.1–Compare their code size and execution time.•“ACC（” , （means this register is bitaddressable. You can access each bit of ACCindependently.A.6A.5A.4A.3A.2A.1A.7A.0ACCSFC addr.0E70E60E50E40E30E20E10E0
27Example 5-1Write code to send 55H to ports P1 and P2, using(a) their names(b) their addresses.Solution:
28Stack•Another major use of direct addressing mode isthe stack.•In the 8051 family, only direct addressing mode isallowed for pushing onto the stack.
Example 5-2 （1/2 （Show the code to push R5, R6, and A onto the stack and then popthem back them into R2,R3, and B.We want （B = A, R2 = R6, and R3 = R5.
30Example 5-2 （1/2 （•Different assembler provide different instructionfor the stack.•In our simulation tools, they are the same （1 0000 C0 05PUSH R52 0002 C0 06PUSH R63 0004 C0 E0PUSH A1 0000 C0 05PUSH 052 0002 C0 06PUSH 063 0004 C0 E0PUSH 0E0H
31Addressing Mode 41. immediate （the operand is a constantMOV A,#01FH2. register （the operand is in a registerMOV A,R03. direct （access the data in the RAM withaddressMOV A,01FH4. register indirect （the register holds the RAMaddress of the dataMOVA,@R05. indexed （for on-chip ROM access
32Register Indirect Addressing Mode•In the register indirect addressing mode, a registeris used as a pointer to the data.–That is, this register holds the RAM address of the data.•Only registers R0 and R1 can be used to hold theaddress of an operand located in RA.–Usually, R0 and R1 are denoted by Ri.•When R0 and R1 hold the addresses of RAMlocations, they must be preceded by the “@” sign.
33Example of Register IndirectMode （1/2 （•Register Indirect Mode （1 0000 75 20 64MOV 20H,#1002 0003 78 20MOV R0,#20H3 0005 E6MOV A,@R0R020HA64HRAM1E001F0020642100220023:1. put 64H toaddr. 20H2. let R0 be thedata address3. copy the content inaddr. R0=20H to A
34Example of Register IndirectMode （2/2 （•Register Indirect Mode （1 0000 75 F0 80MOV B,#080H2 0003 79 31MOV R1,#31H3 0005 A7 F0MOV @R1,BR131HB80HRAM2F00300031803200330034:1. let B=80H2. let R0 be thedata address3. copy B to the RAMlocation with addr.R1=31H