Ad
Sunday, November 20, 2022
Basics of Microcontroller and 8051 Architecture : E1 Chap 1 : IMP Q&A
Q1. Difference between microprocessor and microcontroller.
Answer:
Microprocessor | Microcontroller |
---|---|
MicroprocessorMicroprocessor consists of only a Central Processing Unit | MicrocontrollerMicro Controller contains a CPU, Memory, I/O all integrated into one chip. |
MicroprocessorIt is used in computer system. | MicrocontrollerIt is used in embedded systems. |
MicroprocessorMemory and I/O components are externally connected. | MicrocontrollerMemory and I/O ports are intbuilt. |
MicroprocessorCost of entire system in more. | MicrocontrollerCost of entire system is less. |
MicroprocessorIt cannot be used in battery operated devices due to high total power consumption. | MicrocontrollerIt can be used in battery operated devices due to low total power consumption. |
MicroprocessorIt is relatively slower. | MicrocontrollerIt is relatively faster. |
Answer: The salient features are :
1. It is an 8-bit microcontroller.
2. 8-bit data bus and 16-bit address bus.
3. 4k bytes- on chip ROM.
4. 128 bytes - on chip RAM.
5. Four I/O ports (8-bit).
6. Two 16-bit timers.
7. 32 General purpose registers each of 8-bit.
Q3. Draw the block diagram of 8051 & explain the it's components.
Answer:
The components are:
1) ALU : Arithmetic & Logical Unit : It performs all the arithmetic and logical functions.
2) PC : Program Counter : It holds the address of next instruction to be executed.
3) Timers and Counters : It helps to bring synchronization among internal operations by generating clock pulses.
4) Interrupt Control: It suspends the normal program execution for a certain period of time in order to serve request of another program or hardware device.
Q4. What are the registers present in 8051?
Answer: It contains the following registers:
1) Accumulator A and B : Math Registers.
2) Data Pointer & Program Counter : Two 16 bit registers.
3) PSW & Stack Pointer : 8-bit register.
Q5. Draw and explain bit format of PSW register.
Answer:
Functions of flag bits:Dual role of port 0: It can also be used as both address bus and data bus.
Chapter 1: Basics of Microcontroller & Intel 8051 Architecture
1 mark
Q. What is the function of ALE pin of 8051 ?
-
Functions of the ALE pin of the 8051 microcontroller:
1) Address Latching: The ALE pin is responsible for latching the address from the address bus into external latch circuits.
2) External Memory Interface: ALE, along with the PSEN pin, facilitates accessing external program memory by providing the necessary timing signals.
2 mark
Q. Draw structure of a port pin and explain how reading and writing operation is performed using port pins ?
-Q. Explain the internal RAM organization of 8051 microcontroller..
Q.Write 8051, C-program to generate square wave on P2.5 having 2 kHz frequency and 50% duty cycle. Assume XTAL freq. = 12 MHz (The value to be loaded into timer register FF06H) [Use Timer 1 in Mode 1.]
Q.Explain any five features of 8051 µC.
Q. Explain the function of following pins of 8051 microcontroller.
i) RESET
ii) ALE
iii) EA
iv) PSEN
v) XTAL 1 and XTAL 2
5 mark
Q. Draw block diagram of 8051 microcontroller architecture and explain any three blocks of it.
-Q. Write any five differences between microcontroller and microprocessor.
Q. Explain dual role of Port 0 and port 2 of 8051 microcontroller.
Chapter 2 : Instructions of 8051
1 mark
Q. What is function of INC and DPTR instruction?
-
1) INC instruction:
It is used to increment the value of a register or memory location by one.
Example:
INC A : It increments accumulator A by one.
INC R1: It increments register R1 by one.
INC @Ri : It increments the memory location pointed by register by one.
2) DPTR Instruction:
It is used to load a 16 bit address into DPTR register, which is used to access external memory locations.
Example:
MOV DPTR, #address
It loads address specified into DPTR register
Q. Give any two addressing modes:
1) Immediate Addressing:
- In immediate addressing mode, the operand value is directly specified in the instruction itself.
Example: MOV A, #42
2) Register Addressing::
- In register addressing mode, the operand is specified by a register or a group of registers.
Example: ADD A, B
Q. Give two unconditional jump instructions with proper syntax.
-
1. JMP : The JMP instruction is used to perform an unconditional jump or branch to a specified memory address.
syntax: JMP target_address
Example: JMP 0x1234
2. CALL : The CALL instruction is used to perform a subroutine call or jump to a specific memory address, storing the return address on the stack.
syntax:CALL subroutine_address
Example: CALL 0x5678
Q. What is function of Assembler directive "Org"?
- The "ORG" (origin) assembler directive is used to specify the memory location where the program or code segment should be assembled or loaded.It defines the starting address or memory location of a program.
Syntax: ORG address
Example: ORG 0x1000
Q. Define the term: assembler directive.
-Assembler directives provide instructions to the assembler, which is a software tool responsible for translating assembly language code into machine code or object code. They provide guidance to the assembler on how to handle the code during the assembly process.
Q.Name the addressing mode for the instruction MOV DPTR, # 3000 H.
-
The addressing mode used in the instruction "MOV DPTR, #3000H" is Immediate Addressing mode.
Q. Identify the addressing mode of 8051 instruction MOV A, @ R1.
- The addressing mode used in the instruction "MOV A, @R1" is Register Indirect Addressing mode.
Q. What is the difference between instructions MOV R1, 41H and MOV R1, # 41H ?
- "MOV R1, 41H" directly moves the constant value 41H into register R1.
"MOV R1, #41H" indirectly moves the immediate value 41H into register R1 using immediate addressing
Q.What is the status of bit P1.1 after execution of instruction SET B P1.1 ?
- After executing the instruction "SETB P1.1" in the 8051 microcontroller, the status of bit P1.1 will be set to 1, indicating a logical high level on that pin.
2 mark
----Q. Explain the functions of the following instructions :
(i) MOV A, @ RO
(ii) ADD A, # 80H
(iii) RL A
(iv) SWAP A
(v) CPL bit.
(i) NOP
(ii) ANL A, R5
(iii) MOVA,@ R0
(iv) SETB P1.6
(v) JNZ addr.
i) CLR A
ii) ORL A, # 75 H
iii) LCALL 2000 H
iv) SETB PSW. 4
v) MUL AB
(i) MOV A, 40 H
(ii) AIMP addr 11
(iii) CPLA
(iv) INC R1
(v) MUL AB
-(i) MOV A, @RO: Move the value stored in the address pointed to by the Register R0 into the Accumulator A.
(ii) ADD A, #80H: Add the immediate value 80H to the Accumulator A.
(iii) RL A: Rotate the contents of the Accumulator A to the left, with the leftmost bit shifted into the Carry flag and the rightmost bit replaced by the previous value of the Carry flag.
(iv) SWAP A: Swap the nibbles (4-bit groups) of the Accumulator A.
(v) CPL bit: Complement (toggle) the specified bit.
(i) NOP: No operation (an empty instruction that does nothing).
(ii) ANL A, R5: Perform a bitwise logical AND operation between the Accumulator A and the value in Register R5, storing the result in the Accumulator A.
(iii) MOVA, @R0: Move the value stored in the address pointed to by the Register R0 into the Accumulator A.
(iv) SETB P1.6: Set bit P1.6 of Port 1 to a logical high or 1 state.
(v) JNZ addr: Jump to the specified address if the Zero (Z) flag is not set.
(i) CLR A: Clear the Accumulator A, setting all bits to zero.
(ii) ORL A, #75H: Perform a bitwise logical OR operation between the Accumulator A and the immediate value 75H, storing the result in the Accumulator A.
(iii) LCALL 2000H: Call a subroutine at the specified address, saving the return address on the stack.
(iv) SETB PSW.4: Set bit 4 of the Program Status Word (PSW) to a logical high or 1 state.
(v) MUL AB: Multiply the values in the Accumulator A and B, storing the 8-bit result in the Accumulator A and the 8 most significant bits of the result in the Accumulator B.
(i) MOV A, 40H: Move the immediate value 40H into the Accumulator A.
(ii) AIMP addr 11: Accumulator indirect addressing mode instruction that performs an arithmetic immediate operation on the value stored in the address 11, updating the Accumulator A.
(iii) CPLA: Complement (toggle) all bits in the Accumulator A.
(iv) INC R1: Increment the value in Register R1 by 1.
(v) MUL AB: Multiply the values in the Accumulator A and B, storing the 8-bit result in the Accumulator A and the 8 most significant bits of the result in the Accumulator B.
5 mark
Q. Explain different addressing modes of 8051 microcontroller with suitable example.
-
(1) Immediate Addressing Mode:
The operand is specified as an immediate value.
Example: ADD A, #20H (Adds the immediate value 20H to the Accumulator A)
(2) Direct Addressing Mode:
The operand is specified as a direct address, accessing the data directly from the specified address.
Example: MOV A, 50H (Moves the data from memory address 50H to the Accumulator A)
(3) Indirect Addressing Mode:
The operand is specified as an address stored in a register, accessing the data indirectly.
Example: MOV A, @R0 (Moves the data from the address pointed to by Register R0 to the Accumulator A)
(4) Register Addressing Mode:
The operand is specified as a register, accessing the data directly from the register.
Example: ADD A, R1 (Adds the value in Register R1 to the Accumulator A)
(5) Register Indirect Addressing Mode:
The operand is specified as the value in a register, which is used as an address to access the data.
Example: MOV A, @R1 (Moves the data from the address pointed to by Register R1 to the Accumulator A)
Q. What will be the output of each of the following ofter execution ?
(i) P1 = O × FO & O × 35
(ii) P1 = O × FF O × 65
(iii) P2 = O × IF
(iv) P2 = O × 36 | O × 65
(v) P1 = O × 12 >> 2
Chapter 3: Programming 8051 in CC
2 mark
Q.Write an 8051 assembly language program for blinking of 8 LEDS connected to port 2.
-
ORG 0000H ; Start of program
MOV P2, #00H ; Initialize Port 2 as output (all LEDs off)
LOOP:
MOV P2, #FFH ; Turn ON all LEDs
ACALL DELAY ; Call the delay subroutine
MOV P2, #00H ; Turn OFF all LEDs
ACALL DELAY ; Call the delay subroutine
SJMP LOOP ; Jump back to the LOOP label
DELAY:
MOV R1, #50 ; Load the delay count value
DELAY_LOOP:
DJNZ R1, DELAY_LOOP ; Decrement R1 and jump back if not zero
RET ; Return from the subroutine
END ; End of program
5 mark
Q. Write a program to read the status of switch connected to P2.0 if it is ‘O’ switch off the LED connected to P1.7.
Q. Explain how LED can be interfaced to port P1.2 of 8051 µC with neat diagram. Write a program to blink the LED.
Q.Explain how LED can be interfaced to 8051 with a neat diagram and write a program to toggle LED connected to P1.3 continuously.
Q.Which port of 8051 requires external pill up resistors? Draw a block diagram interfacing common anode SSD to port 2.
Chapter 4 : Timer, Counter and Interrupts
1 mark
Q. Which special function register of 8051 is used to keep track of priority of interrupts?
A. The Special Function Register (SFR) IP (Interrupt Priority) is used to keep track of the priority of interrupts in the 8051 microcontroller.
Q. What is the significance of Gate bit of TMOD register?
A. The Gate bit in the TMOD (Timer Mode) register is used to control the operation of Timer/Counter 1 in conjunction with an external signal. When the Gate bit is set, Timer/Counter 1 will only count when the external signal on the INT1 pin is high.
Q. State the role of C/T bit in TMOD register.
A. The C/T (Counter/Timer) bit in the TMOD register is used to select the mode of operation for Timer/Counter 1. When the C/T bit is cleared, Timer/Counter 1 operates as a timer, and when it is set, it operates as a counter.
Q. Which is the highest priority interrupt in 8051?
A. The highest priority interrupt in the 8051 microcontroller is the Reset interrupt.
Q. Write the full form of IVT and ISR with respect to interrupts of 8051 microcontroller.
A. IVT stands for Interrupt Vector Table, which is a table of addresses that contains the starting addresses of interrupt service routines (ISRs). ISR stands for Interrupt Service Routine, which is a function or subroutine that handles a specific interrupt.
Q. What is the use of bit TR1 in TCON register?
A. The TR1 (Timer 1 Run) bit in the TCON (Timer Control) register is used to start or stop Timer/Counter 1.
Q. What is the significance of the timer flag (TF) in the 8051?
A. The Timer Flag (TF) in the TCON register is set when Timer/Counter 0 overflows. It can be used to indicate the completion of a timing interval or to trigger an interrupt.
Q. Give the use of the SMOD bit in the PCON register.
A. The SMOD (Serial Mode) bit in the PCON (Power Control) register is used to configure the serial communication baud rate in the 8051 microcontroller. When SMOD is set, the baud rate is doubled, allowing higher baud rates for serial communication.
2 mark
Q. Write an 8051 C- program for generating a pulse on pin P 3.2 using timer 1 in mode 1.
Q. Explain the interrupts of 8051 µC.
5 mark
Q. Write an assembly langauge program to toggle all pits of Port 2 continuously.
Q. Explain the sequence of actions carried out by 8051 microcontroller when an interrupt occurs.
-Q. Draw bit format of Interrupt Enable (IE) register and explain function of each bit.
Q. Write the types of interrupts of 8051. Mention the vector addresses of these interrupts.
Q. Draw a bit format of Tmod register and explain function of each bit.
Chapter 5: Interfacing and Serial Communication
Q. List any two registers used for serial communication. A. The two registers commonly used for serial communication in 8051 microcontrollers are SBUF (Serial Data Buffer) and SCON (Serial Control).
---Q. Which pin of LCD is used to control the contrast? A. The contrast of an LCD (Liquid Crystal Display) is typically controlled using a variable resistor connected to the V0 pin.
Q. Define the step angle of a stepper motor. A. The step angle of a stepper motor is the angle through which the motor shaft rotates for each electrical pulse received. It is typically expressed in degrees, such as 1.8° or 0.9°, indicating the angular displacement per step.
Q. What is the maximum input voltage that can be applied to ADC0804 if Vref/2 = 2V? A. The ADC0804 has a reference voltage (Vref) range of 0V to Vcc. If Vref/2 = 2V, it means Vref (or Vcc) is 4V. Therefore, the maximum input voltage that can be applied to ADC0804 in this scenario would be 4V.
Q. What is the step size of an 8-bit ADC if Vref = 4.5 volts? A. For an 8-bit ADC, the step size is calculated by dividing the reference voltage range by 2^8 (2 raised to the power of the number of bits). In this case, the step size would be 4.5V / 256, which is approximately 0.0176 volts.
Q. What is the step size of an 8-bit ADC if Vref = 2.56 volts? A. Similarly, for an 8-bit ADC, the step size would be calculated as 2.56V / 256, which is approximately 0.01 volts.
2 mark
Q. Draw block diagram for interfacing DAC with 8051 and write ‘C’ program to generate triangular wave.
Q. Write 8051 c-program to rotate a stepper motor connected to port 1 in clockwise direction continuously.
5 mark
Q.Give differences between asynchronous and synchronous serial communication.
-Q.Draw a neat diagram of interfacing stepper motor to 8051 microcontroller and write C program to run the motor.
Q. Draw a neat diagram of interfacing 8-bit ADC (analog to digital converter) to 8051 microcontroller and write ‘C’ program to run this interface.
Q. Draw a neat diagram to show how LCD is interfaced to 8051. Write a ‘C’ program to display the message “ELECTRONICS”.
Q. Draw a block diagram of interfacing DAC to port 1 of 8051 microcontroller. Write a C- program to generate triangular waveform.
Q. Draw the control word format of TCON register of 8051. Explain the significance of each bit of the register.
Q. Write 8051, C program to generate square wave on P1.5 having 1000 Hz frequency and 50% duty cycle. Assume crystal frequency of 12 MHz and given a value to be loaded into timer register is (FEOC)HEX. Use timer 1 in mode 1.
Q.Write a C program to generate a 5 kHz square wave of 50% duty cycle on port P2.2 line using timer 1, mode 1. Assume crystal frequency = 11.0592 MHz.
Q. Draw a schematic to show how a DAC can be interfaced to 8051. Write a ‘C’ program to generate a sawtooth waveform.
About Abhishek Dhamdhere
Qna Library Is a Free Online Library of questions and answers where we want to provide all the solutions to problems that students are facing in their studies. Right now we are serving students from maharashtra state board by providing notes or exercise solutions for various academic subjects
No comments:
Post a Comment