• Each register of SFR has one byte address. Some of the registers are both byte and bit addressable (The registers whose address ends with 0H or 8H are bit addressable).
• The 8031/8051 has a separate 256 bytes internal RAM accessed by using 8-bit address.
• In this 256 bytes address space, first 128 byte addresses are allotted to internal RAM (00H to 7FH) and the next 128 bytes are allotted to SFR (80H to FFH).
• Using MOV instructions SFR can access.
A and B Registers:
• The A and B registers are called CPU registers.
• They are used to hold the data for most of the CPU (ALU) operations.
• The size of A and B registers are 8-bit.
• In ALU operation, the result is stored in A-register and so it is also known as accumulator.
Data Pointer (DPTR):
• The data pointer is a 16-bit register used to hold the 16-bit address of data memory.
• This can also be used as two numbers of 8-bit data pointer namely DPH and DPL.
• The 8-bit data pointers are used for accessing internal RAM and SFR.
• The 16-bit data pointer is used for accessing external data memory.
• The contents of data pointer are programmable using instructions.
Program Status Word (PSW):
• The PSW is also known as flag register.
• The flags are useful for the programmer to test the condition of the result and make decisions.
• The format of PSW of 8031/8051 microcontroller is shown in fig.
• The PSW consists of four math flags and two register bank select bits. The math flags are Carry, Auxiliary Carry, and Overflow and Parity flags.
• The flags are altered after arithmetic and logical operations depending on the result.
• The carry flag is set when the result has a carry.
• When there is a carry from lower nibble to upper nibble the auxiliary carry is set.
• When the result has even parity, the parity flag is set.
• In certain mathematical operations if the size of the result exceeds the size of destination register then overflow flag is set.
• The register bank select bits RS1 and RS0 are used to select any one of the four register banks of the internal RAM. At any one time the microcontroller can work with (or access) only one register bank selected by these bits.
• The bank select bits are programmable and after reset the controller defaults to bank-0. The selection of register bank using the RS1 and RS0 bits are listed in table.
Stack Pointer (SP):
• The stack pointer always holds the 8-bit address of the top of stack.
• The programmer can reserve any portion of RAM as stack.
• After a reset the stack pointer is initialized to 07H.
• The stack can be accessed using PUSH and POP instructions.
• During PUSH operation the stack pointer is automatically incremented by one and during POP operation the stack pointer is automatically decremented by one.
Power Control Register (PCON):
• The PCON register is used for power control and baud rate selection.
• It also consists of general-purpose user flags. The format of PCON is shown in figure.
• The controller can be driven to idle mode by setting IDL bit of PCON register.
• In idle mode the clock signal is stopped to CPU(ALU), but the clock signal is supplied to interrupt, timer and serial port blocks.
• The idle mode can be terminated either by an interrupt or by hardware reset.
• The power 12V can be reduced to 2V by setting PD bit.
• During power down mode the internal oscillator is stopped.
• The power down mode can be terminated only by a hardware reset.
• The SMOD bit is used to decide the baud rate in serial port operating modes 1, 2 or 3.
• In mode 2,
if SMOD =0, then the baud rate is 1/64 of oscillator frequency
if SMOD = 1, then the baud rate is 1/32 of oscillator frequency.
• In mode 1 and 3, the baud rate depends on SMOD and timer-1 overflow rate.
The baud rate in mode 1 or 3 = (2SMOD/32) x (Timer-1 Overflow Rate).
• The programmer, to indicate the status of certain events during program execution can use the general-purpose flag bits GF1 and GF.
Serial Data Buffer Register (SBUF):
• The SBUF register is used to hold the parallel data during transmission and reception.
• During serial reception, the serial data is received via RxD pin and converted to parallel data and stored in receive buffer.
• During serial transmission, the parallel data is stored in transmit buffer and then converted to serial data to transmit via TxD pin.
• The transmit and receive buffers are assigned the same internal address 99H but transmit buffer can be accessed only for write operation and receive buffer can be accessed only for read operation.
• When data is written to SBUF if goes to transmit buffer and when data is read from SBUF it comes from receive buffer.
No comments:
Post a Comment