Monday, 17 September 2012

MICROCONTROLLER

INTERNAL ROM
Internal ROM occupies the code address space from 0000H to 0FFFH  (Size = 4K byte)
Program addresses higher than 0FFFH will automatically fetch code bytes from external program memory
Code bytes can also be fetched exclusively from an external memory by connecting the external access pin (EA) to ground

Stack and Stack Pointer (SP)
SP is a 8-bit register used to hold an internal RAM address that is called the “top of the stack”
Stack refers to an area of internal RAM that is used in conjunction with certain opcodes to store and retrieve data quickly
SP holds the internal RAM address where the last byte of data was stored by a stack operation
When data is to be placed on the stack, the SP increments before storing data on the stack so that the stack grows up as data is stored
As data is retrieved from the stack, the byte is read from the stack, and then the SP decrements to point to the next available byte of stored data
SP = 07H  after reset

Internal Memory
A functioning computer must have memory for program code bytes, commonly in ROM, and RAM memory for variable data that can be altered as the program runs
8051 has internal RAM (128 bytes) and ROM (4Kbytes)
8051 uses the same address but in different memories for code and data
Internal circuitry access the correct memory based on the nature of the operation in progress
Can add memory externally if needed

Data Pointer (DPTR)

DPTR is a 16-bit register
DPTR is made up of two 8-bit registers: DPH and DPL
DPTR holds the memory addresses for internal and external code access and external data access
  (eg. MOVC  A,@A+DPTR       MOVX  A,@DPTR        MOVX  @DPTR,A )  
DPTR is under the control of program instructions and can be specified by its 16-bit name, or by each individual byte name, DPH and DPL
DPTR does not have a single internal address; DPH and DPL are each assigned an address (83H and 82H)

PC is a 16-bit register
PC is the only register that does not have an internal address
Holds the address of the memory location to fetch the program instruction
Program ROM may be on the chip at addresses 0000H to 0FFFH (4Kbytes), external to the chip for addresses that exceed 0FFFH
Program ROM may be totally external for all addresses from 0000H to FFFFH
PC is automatically incremented (+1) after every instruction byte is fetched

FLAGS
Flags are 1-bit registers provided to store the results of certain program instructions
Other instructions can test the condition of the flags and make decisions based on the flag states
Flags are grouped inside the program status word (PSW) and the power control (PCON) registers for convenient addressing
Math flags: respond automatically to the outcomes of math operations (CY, AC, OV, P)
User flags: general-purpose flags that may be used by the programmer to record some event in the program (F0, GF0, GF1)

No comments:

Post a Comment