Bit address of 'b' bit of register 'R' is Address of register 'R' + b where 0 ≤ b ≤ 7 Processor Status Word (PSW) Address=D0H Fi g 4.8: Processor Status Word PSW register stores the important status conditions of the microcontroller. It also stores the bank select bits (RS1 & RS0) for register bank selection. Interfacing External Memory If external program/data memory are to be interfaced, they are interfaced in the following way. JNTU World JNTU World Downloaded From JNTU World ()
Fig 4.9: Circuit Diagram for Interfacing of External Memory External program memory is fetched if either of the following two conditions are satisfied. 1. (Enable Address) is low. The microcontroller by default starts searching for program from external program memory. 2. PC is higher than FFFH for 8051 or 1FFFH for 8052. tells the outside world whether the external memory fetched is program memory or data memory. is user configurable. is processor controlled. 8051 Addressing Modes 8051 has four addressing modes. 1. Immediate Addressing : Data is immediately available in the instruction. For example - ADD A, #77; Adds 77 (decimal) to A and stores in A ADD A, #4DH; Adds 4D (hexadecimal) to A and stores in A MOV DPTR, #1000H; Moves 1000 (hexadecimal) to data pointer 2. Bank Addressing or Register Addressing : This way of addressing accesses the bytes in the current register bank. Data is available in the register specified in the instruction. The register bank is decided by 2 bits of Processor Status Word (PSW). For example- ADD A, R0; Adds content of R0 to A and stores in A JNTU World JNTU World Downloaded From JNTU World ()
3.. Direct Addressing : The address of the data is available in the instruction. For example - MOV A, 088H; Moves content of SFR TCON (address 088H)to A 4. Register Indirect Addressing : The address of data is available in the R0 or R1 registers as specified in the instruction. For example - MOV A, @R0 moves content of address pointed by R0 to A External Data Addressing : Pointer used for external data addressing can be either R0/R1 (256 byte access) or DPTR (64kbyte access). For example - MOVX A, @R0; Moves content of 8-bit address pointed by R0 to A MOVX A, @DPTR; Moves content of 16-bit address pointed by DPTR to A External Code Addressing : Sometimes we may want to store non-volatile data into the ROM e.g. look-up tables. Such data may require reading the code memory. This may be done as follows - MOVC A, @A+DPTR; Moves content of address pointed by A+DPTR to A MOVC A, @A+PC; Moves content of address pointed by A+PC to A I/O Port Configuration Each port of 8051 has bidirectional capability. Port 0 is called 'true bidirectional port' as it floats (tristated) when configured as input. Port-1, 2, 3 are called 'quasi bidirectional port'.
You've reached the end of your free preview.
Want to read all 114 pages?
- Spring '16
- address bus, Interrupt, JNTU World