VTU Exam Question Paper With Solution of 18EE52 Microcontrollers Feb-2021-Ranjitha R
VTU Exam Question Paper With Solution of 18EE52 Microcontrollers Feb-2021-Ranjitha R
1. Explain With the neat diagram, the programming model of 8051 Microcontrollers.
2.
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>
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.