are the special functoin register?
special function register are stack pointer, index pointer (DPL and DPH), I/O
port addresses, status(PSW) and accumulator.
are the uses of accumulator register?
accumulator registers (A and B at addresses OEOh and OFOh, respectively) are
used to store temporary values and the results of arithmetic operations.
status word (PSW) is the set of flags that contains the status information and
is considered as one of the special function register.
is stack pointer (sp)?
pointer (SP) is a 8 bit wide register and is incremented before the data is
stored into the stack using PUSH or CALL instructions.
contains 8-bit stack top address. It is defined anywhere in the on-chip
128-byte RAM. After reset, the SP register is initialized to 07.
each write to stack operation, the 8-bit contents of the operand are stored
onto the stack, after incrementing the SP register by one.
It is not
a top-down data structure. It is allotted an address in the special function
is data pointer (DTPR)?
It is a
16-bit register that contains a higher byte (DPH) and lower byte (DPL) of a
16-bit external data RAM address.
accessed as a 16-bit register or two 8-bit registers. It has been allotted two
addresses in the special function register bank, for its two bytes DPH and DPL.
oscillator circuit is used?
circuit is used to generate the basic timing clock signal for the operation of
the circuit using crystal oscillator.
is the purpose of using instruction register?
register is used for the purpose of decoding the opcode of an instruction to be
executed and gives information to the timing and control unit generating
necessary signals for the execution of the instruction.
the purpose of ale/prog signal.
is an address latch enable output pulse and indicates that valid address bits
available on the respective pins.
pulses are emitted at a rate of one-sixth of the oscillator frequency. The
signal is valid only for external memory accesses.
It may be
used for external timing or clockwise purpose. One ALE pulse is skipped during
each access to external data memory.
Explain the two power saving mode of operation. The two power saving modes of
mode, the oscillator continues to run and the interrupt, serial port and timer
blocks are active, but the clock to the CPU is disabled. The CPU status is
preserved. This mode can be terminated with a hardware interrupt or hardware
reset signal. After this, the CPU resumes program execution from where it left
mode, the on-chip oscillator is stopped. All the functions of the controller
are held maintaining the contents of RAM. The only way to terminate this mode
is hardware reset. The reset redefines all the SFRs but the RAM contents are
Differentiate between program memory and data
memory. i. In stores the programs to be executed.
stores only program code which is to be executed and thus it need not be
written, so it is implemented using EPROM It stores the data, line intermediate
results, variables and constants required for the execution of the program.
memory may be read from or written to and thus it is implemented using RAM.
What are addressing modes?
various ways of accessing data are called addressing modes.
the addressing modes of 8051?
six addressing modes in 8051.They are
Direct addressing Indirect addressing Register instruction
Registerspecific (register implicit)
Immediate mode Indexed addressing
is direct addressing mode?
operands are specified using the 8-bit address field, in the instruction
format. Only internal data Ram and SFRS can be directly addressed. This is
known as direct addressing mode.
is indirect addressing mode?
mode, the 8-bit address of an operand is stored in a register and the register,
instead of the 8-bit address, is specified in the instruction. The registers R0
and R1 of the selected bank of registers or stack
can be used as address registers for storing the 8-bit addresses.
address register for 16-bit addresses can only be „data pointer‟ (DPTR). Eg:
ADD A, @ R0.
is meant by register instructions addressing mode?
operations are stored in the registers R0 – R7 of the selected register bank.
One of these eight registers (R0 – R7) is specified in the instruction using
the 3-bit register specification field of the opcode format. A register bank
can be selected using the two bank select bits of the PSN. This is called as
register instruction addressing mode
is immediate addressing mode?
immediate data ie., a constant is specified in the instruction, after the
immediate data 100 (decimal) is added to the contents of the accumulator. For
specifying a hex number, it should be followed by H. These are known as
immediate addressing mode.
is indexed addressing?
addressing mode is used only to access the program memory. It is accomplished
in 8051 for look-up table manipulations. Program counter or data pointer are
the allowed 16-bit address storage registers, in this mode of addressing. These
16-bit registers point to the base of the look-up table and the ACC register
contains a code to be converted using the look-up table. The look-up table data
address is found out by adding the contents of register ACC with that of the
program counter or data pointer.
of jump instruction, the contents of accumulator are added with one of the
specified 16-bit registers to form the jump destination address.
Eg: MOV C, A @ A + DPTP JMP @ A + DPTR
the five addressing modes of 8051 microcontroller.
addressing modes are, I. Immediate addressing
Register addressing III. Direct addressing
Register indirect addressing a. Indexed addressing.
R4, R7 is invalid. Why?
movement of data between the accumulator and Rn (for n = 0 to 7) is valid. But
movement of data between Rn register is not allowed. That is why MOV R4, R7 is
8051 microcontroller registers A, B, PSW and DPTR are part of the group of
registers commonly referred to as special function registers (SFR).
ARE THE TWO MAIN FEATURES OF SFR ADDRESSES?
following two points should be noted SFR addresses. The special function
registers have addresses between 80H and FFH. These addresses are above 80H,
since the addresses 00 to 7FH are addresses of RAM memory inside the 8051.
all the address space of 80 to FH is used by the SFR. The unused locations
80Hto FFH are reserved and must not used by the 8051 programmer.
What is the difference between direct and register
indirect addressing mode?
most efficient and is possible only in register indirect addressing whereas
looping is not direct addressing mode.
out some compare instructions. The compare instructions are:
a program to save the accumulator in r7 of bank 2. CLR PSW – 3
– 4 MOV R7, A.
are single bit instructions? Give example.
that are used for single bit operation are called single bit instructions.
Examples: SETB bit
26. Write a program to save the status of bits
p1.2 and p1.3 on ram bit LOCATIONS 6 AND 7
P1.2; save status of P1.2 on CY
C; save carry in RAM bit location 06 MOV C, p1.3; save status of p1.3 on CY
C; save carry in RAM bit location 07.
27. Write a program to see if bits 0 and 5 of
register b r1. If they are not, make them so and save it in r0. JNB OFOH, NEXT
– 1; JUMP if B.0 is low
BOFOH; Make bit B.0 high
1:JNB OF5H, NEXT – 2; JUMP if B.5 is low SETB OF5H; Make B.5 high
NEXT – 2:
MOV R0, B; Save register B.