100% found this document useful (5 votes)
10K views30 pages

VTU Exam Question Paper With Solution of 18EE52 Microcontrollers Feb-2021-Ranjitha R

This document provides information about various assembly directives and interrupts supported by the 8051 microcontroller. It explains directives like DB, ORG, EQU, and END that are used to define data and constants. It also discusses the serial interrupt used for serial communication in 8051 and how it handles both sending and receiving data using a single interrupt. Timers and polling vs interrupt-driven I/O are also briefly covered.

Uploaded by

Supritha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
10K views30 pages

VTU Exam Question Paper With Solution of 18EE52 Microcontrollers Feb-2021-Ranjitha R

This document provides information about various assembly directives and interrupts supported by the 8051 microcontroller. It explains directives like DB, ORG, EQU, and END that are used to define data and constants. It also discusses the serial interrupt used for serial communication in 8051 and how it handles both sending and receiving data using a single interrupt. Timers and polling vs interrupt-driven I/O are also briefly covered.

Uploaded by

Supritha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Solution of model QP

1. Explain With the neat diagram, the programming model of 8051 Microcontrollers.
2.

2. Compare the Microprocessor and Microcontroller.


3. Interface 4k bytes RAM and 8k bytes ROM to 8051 microcontroller in such a way that starting
address of RAM is 1000H and ROM is C000H.

General procedure is given as:


2. B.Explain with example the various addressing modes of 8051.
2. c.

3. A.Define assembler directives. With example explain all the assembler directives supported by
8051 microcontroller.
Data Byte Directive:
• The DB directive is the most widely used data directive in the assembler.
• It is used to define the 8-bit data.
• When DB is used to define data, the numbers can be in decimal, binary, hex, or
ASCII formats. For decimal, the “D” after the decimal number is optional, but
using “B” (binary) and “H” (hexadecimal) for the others is required.

ORG Directive
• The ORG directive is used to indicate the beginning of the address.
• The number that comes after ORG can be either in hex or in decimal.0000 or 0000D
MOV A,30
• If the number is not followed by H, it is decimal and the assembler will convert it to
hex.
• Some assemblers use “. ORG” (notice the dot) instead of “ORG” for the origin
directive. Check your assembler.

EQU
• This is used to define a constant without occupying a memory location.
• The EQU directive does not set aside storage for a data item but associates a
constant value with a data label so that when the label appears in the program, it
constant value will be substituted for the label.
• The following uses EQU for the counter constant and then the constant is used to
load the R3 register.
• Eg: COUNT EQU 25
. . . . . . . . ..
MOV R3, # COUNT

END Directive
• Another important pseudocode is the END directive.
• This indicates to the assembler the end of the source (asm) file.
• The END directive is the last line of an 8051 program, meaning that in the source
code anything after the END directive is ignored by the assembler.
• Some assemblers use “. END” (notice the dot) instead of “END”.

3.b.

3.c.
4.a.

4. b.

4.c.

ORG 0000H
MOV R0,#08H
BACK: MOV A,#55H
MOV P1,A
ACALL DELAY
MOV A,#0AAH
MOV P1,A
ACALL DELAY
DELAY:DJNZ R0,BACK
SJMP $
END
5. a.b.

5.c.
6.a.

6.b.
# include <reg51.h>
Sbit P1b0 =P1^0;
Sbit regAMSB= Acc^7;
Void main(void)
{
Unsigned char conbyte =0x44;
Unsigned char x;
Acc = conbyte;
For( x=0; x<8; x++)
{
AMSB = P1b0;
Acc = Acc>>1;
}
P2=Acc;
}
6.c.

7.a. In Interrupts, Whenever any device needs its service, the device notifies the
microcontroller by sending it an interrupt signal

Upon receiving an interrupt signal, the microcontroller interrupts whatever it is doing and
serves the device

Polling
• The microcontroller continuously monitors the status of all devices in Round-robin
manner.
• When the conditions are for a given device are met, it performs the service.
• After that, it moves on to monitor the next device until every one is serviced

b. #include<reg51.h>

Void serTx(unsigned char);


void main(void)
{
TMOD=0x20;
TH1=0xFD; TH1=‘-3’
SCON=0x50; 0101 0000
TR1=1;
while(1)
{
serTx(‘Y’);
serTx(‘E’);
serTx(‘S’);
}
}
Void serTx(unsigned char x)
{
SBUF=x;
while(TI==0);
TI=0;
}
}
7.c. In the 8051 only one interrupt is set aside for serial communication.

• This interrupt is used to both send and receive data.


• If the interrupt bit in the IE register (IE.4) is enabled, when RI or TI is raised the 8051
gets interrupted and jumps to memory address location 0023H to execute the ISR.
• In that ISR we must examine the TI and RI flags to see which one caused the interrupt
and respond accordingly.
• The serial interrupt is used mainly for receiving data and is never used for sending data
serially.
• This is like receiving a telephone call, where we need a ring to be notified.
• If we need to make a phone call there are other ways to remind ourselves and so no need
for ringing.
• In receiving the phone call, however, we must respond immediately no matter what we
are doing or we will miss the call. Similarly, we use the serial interrupt to receive
incoming data so that it is not lost.
8.a.

b.
.
c.
9.a

b.
ORG 00H
Main:Mov A,#OCH //clockwise direction first sequence
Acall Delay
Mov A,#06H //clockwise direction second sequence
Acall Delay
Mov A,#03H //clockwise direction third sequence
Acall Delay
Mov A,#09H //clockwise direction fourth sequence
Acall Delay
SJMP Main
Delay:Mov TMOD,#10H //Timer1 in Mode1
Mov TL1,#00H //Load TL1 with Initial value
Mov TH1,#00H //Load TH1 with Initial value
SETB TR1 //Start timer1
Here:JNB TF1,Here //Monitor Timer1 Overflow flag
CLR TF1 //Clear Timer1 Overflow flag
CLR TR1 //Stop Timer
RET
END
c.

9.a.
9.b.
9.c.
10.c
10.a
10.
b.

You might also like