8051 Microcontroller Interview Questions and Answers

This article is mainly focused on the most repeatedly asked and the latest updated 8051 Microcontroller Interview Questions and Answers.

If you are looking for “8051 Microcontroller Interview Questions ”, then you are at the right place. Here I have tried to create some collection of “8051 Microcontroller Interview Questions with answers” that might ask by your interviewer.

So let’s started the questions, I hope these 8051 Microcontroller interview questions and answers will be helpful. If you have any other interview question answers based on 8051 Microcontroller, then please write in the comment box. It is helpful to others.

 

Q1) Intel 8051 follows which architecture?

Ans:

Intel 8051 is Harvard Architecture.

 

Q2) What is the difference between Harvard Architecture and von Neumann Architecture?

Ans:

The name Harvard Architecture comes from the Harvard Mark. The most obvious characteristic of the Harvard Architecture is that it has physically separate signals and storage for code and data memory. It is possible to access program memory and data memory simultaneously. Typically, code (or program) memory is read-only and data memory is read-write. Therefore, it is impossible for program contents to be modified by the program itself.

The von Neumann architecture is named after the mathematician and early computer scientist John von Neumann. Von Neumann machines have shared signals and memory for code and data. Thus, the program can be easily modified by itself since it is stored in read-write memory.

 

Q3) 8051 was developed using which technology?

Ans:

Intel’s original MCS-51 family was developed using NMOS technology, but later versions, identified by a letter C in their name (e.g., 80C51) used CMOS technology and consume less power than their NMOS predecessors. This made them more suitable for battery-powered devices.

 

Q4) Why 8051 is called an 8-bit microcontroller?

Ans:

The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits.

 

Q5) What is the width of the data bus?

Ans:

8-bit data bus

 

Q6) What is the width of the address bus?

Ans:

16-bit address bus (PC -16 bit wide).

 

Q7) List the features of the 8051 microcontrollers?

Ans:

Listed some basic features of 8051 Micro-controller.

  • 40 Pin IC.
  • 128 bytes of RAM.
  • 4K ROM (On-chip and could be different for different versions).
  • 2 Timers (Timer 0 and Timer 1).
  • 32 Input/ Output pins.
  • 1 serial port.
  • 6 Interrupts (Including Reset).

 

Q8) What location code memory space and data memory space begins?

Ans:

At location 0x00 for internal or external memory

 

Q9) How Much on-chip RAM is available?

Ans:

Original Intel’s 8051 Microcontroller had 128B (0x00 to 0x7F) of internal RAM. But almost all modern variants of 8051 Microcontroller have 256B (0x00 to 0xFF) of RAM.

 

Q10) With 12 MHz clock frequency how many instructions (of 1 machine cycle and 2 machine cycle) can execute per second?

Ans:

A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the crystal is pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we can calculate how many instruction cycles the 8051 can execute per second:

11,059,000 / 12 = 921,583

This means that the 8051 can execute 921,583 single-cycle instructions per second. Since a large number of 8051 instructions are single-cycle instructions it is often considered that the 8051 can execute roughly 1 million instructions per second, although, in reality, it is less–and, depending on the instructions being used, an estimate of about 600,000 instructions per second is more realistic.

NOTE: It is again important to emphasize that not all instructions execute in the same amount of time. The fastest instructions require one machine cycle (12 crystal pulses), many others require two machine cycles (24 crystal pulses), and the two very slow math operations require four machine cycles (48 crystal pulses).

 

Q11) List out addressing Modes in MCS-51.

Ans:

  • Direct Addressing.
  • Register Addressing.
  • Register Indirect Addressing.
  • Immediate Addressing.
  • Index Addressing

 

Q12) How much total external data memory that can be interfaced to the 8051?

Ans:

64K data memory (Because PC- 16bits)

 

Q13) What are Special Function Registers (SFR)?

Ans:

The 8051 provides 128 bytes of memory (80H to 0FFH) for Special Function Registers (SFRs). SFRs are bit, byte, or word-sized registers that are used to control timers, counters, serial I/O, port I/O, and peripherals.

SFR 8051

 

 

Q14) What are the difference between bit addressable and byte address in microcontroller 8051?

Ans:

In micro-controller registers were data is stored, if one could manipulate its content bit by bit it’s called a bit addressable ( 0x20 to 2F).  The other one whose data manipulate byte by byte is called byte-addressable(GPR register is a byte-addressable).

 

Q15) What are the types of interrupts in 8051?

Ans:

  • External interrupt 0 (IE0).
  • External interrupt 1 (IE1)
  • Timer interrupt 0 (TF0)
  • Timer interrupts 1 (TF1).
  • Serial port Interrupt.
  • Reset.

 

Q16) What are the four distinct types of memory in 8051?

Ans:

  • Internal RAM.
  • Special function registers.
  • Program memory.
  • External data memory

 

Q17) Tell the addresses which are bit addressable?

Ans:

The bit addressable memory in 8051 is composed from 210 bits: bit address space: 20H – 2FH bytes RAM = 00H – 7FH bits address, SFR registers.

 

Q18) What is a .lst file?

Ans:

  • This file is also called a list file.
  • It lists the opcodes, addresses, and errors detected by the assembler.
  • The list file is produced only when indicated by the user.
  • It can be accessed by an editor and displayed on the monitor screen or printed.
  • The programmer uses this file to find the syntax errors and later fix them.

 

Q19) Explain DB.

Ans:

  • DB is called as define byte used as a directive in the assembler.
  • It is used to define the 8-bit data in binary, hexadecimal, or decimal formats.
  • It is the only directive that can be used to define ASCII strings larger than two characters.
  • DB is also used to allocate memory in byte-sized chunks.
  • The assembler always converts the numbers into hexadecimal.

Q20) What is EQU?

Ans:

  • EQU is the equate assembler directive used to define a constant without occupying a memory location.
  • It associates a constant value with data label.
  • Whenever the label appears in the program, the constant value is substituted for the label.
  • Advantage: The constant value occurring at various positions in a program can be changed at once using this directive.

Syntax: label EQU constant value

 

Q21) How are labels named in assembly language?

Ans:

A label can be placed at the beginning of a statement. During assembly, the label is assigned the current value of the active location counter and serves as an instruction operand. There are rules that you should know before using the labels.

  • Label names should be unique and must contain alphabetic letters in both uppercase and lowercase.
  • 1st letter should always be an alphabetic letter.
  • It can also use digits and special characters?.,@,_,$.
  • The label should not be one of the reserved words in assembly language.
  • These labels make the program much easier to read and maintain.

 

Q22) Are all the bits of flag register used in 8051?

Ans:

The Program Status Word (PSW) contains status bits that reflect the current CPU state. The 8051 variants provide one special function register called PSW with this status information.

The program status word (PSW) register is an 8-bit register, also known as flag register. It is of 8-bit wide but only 6-bit of it is used. The two unused bits are user-defined flags. Four of the flags are called conditional flags, which means that they indicate a condition which results after an instruction is executed. These four are CY (Carry), AC (auxiliary carry), P (parity), and OV (overflow). The bits RS0 and RS1 are used to change the bank registers. The following figure shows the program status word register.

The PSW Register contains that status bit that reflects the current status of the CPU.

8051 PSW

Symbol Function
CY Carry flag
AC Auxiliary Carry flag (For BCD Operations)
F0 Flag 0 (Available to the user for General Purpose)
RS1,
RS0
Register bank select:
RS1 RS0 Working Register Bank and Address
0 0 Bank0 (D:0x00 – D:0x07)
0 1 Bank1 (D:0x08 – D:0x0F)
1 0 Bank2 (D:0x10 – D:0x17)
1 1 Bank3 (D:0x18H – D:0x1F)
0V Overflow flag
UD User-definable flag
P Parity flag

Q23) Which bit of the flag register is set when output overflows to the sign bit?

Ans:

The overflow bit of the PSW register.

 

Q24) What are the issues related to stack and bank 1?

Ans:

  • Bank 1 uses the same RAM space as the stack.
  • The stack pointer is incremented or decremented according to the push or pop instruction.
  • If the stack pointer is decremented it uses locations 7, 6, 5… which belong to register bank 0.
  • If a given program uses R1 then the stack is provided new memory location.
  • The push instruction may also take a stack to location 0 i.e.it will run out of space.

 

Q25) Which 2 ports combine to form the 16-bit address for external memory access?

Ans:

In 8051 Port0 and Port2 are combining to access a 16-bit address for external memory.

 

Q26) Can a single bit of a port be accessed in 8051?

Ans:

Yes, we can. for example, if we write the instruction SETB P1.2. It means here we are setting the second pin (pin start from zero so that is why I am saying the second pin) of port 1.

 

Q27) Other than SETB, CLR are there any single bit instructions?

Ans:

Yes, there are also some other single bit instructions. Let’s see some instructions.

  • CPL bit: complement the bit (bit= NOT bit).
  • JB bit, target: Jump to target if bit equal to 1.
  • JNB bit, target: Jump to target if the bit is equal to 0.
  • JCB bit, target: Jump to target if the bit is equal to 1 and then a clear bit.

 

Q28) Internal RAM is located from address 0x00 to ___?

Ans:

Internal RAM in 8051 is located from address 0 to address 0xFF. IRAM from 0x00 to 0x7F can be accessed directly. IRAM from 0x80 to 0xFF must be accessed indirectly.

 

Q29) Explain JNC

Ans:

The JNC instruction transfers program control to the specified address if the carry flag is 0. Otherwise, execution continues with the next instruction. No flags are affected by this instruction the carry flag is 0, CPU fetches instructions from the address of the label.

 

I believe that the above mentioned “8051 Microcontroller Interview Questions and Answers” are helpful. Please comment in the comment box if you have any queries related to the 8051 microcontrollers.

Recommended Post