Professional Documents
Culture Documents
DEPARTMENT OF ECE&EEE
24052-MICROCONTROLLER
ONE MARK QUESTION BANK
UNIT I
ARCHITECTURE & INSTRUCTION SET OF 8051
1. Define microcontroller. (Board exam)
Microcontroller is a complete microcomputer on a chip.
It is a digital IC fabricated by using VLSI technology.
It contains serial and parallel I/O ports, RAM and ROM types of memory,
timer/counters, interrupt controls etc.
2. What are the advantages of microcontroller?
As the peripherals are integrated into a single chip, the overall system cost is very
low.
The product is of a small size as compared to the microprocessor based system and
is thus very handy.
Easy to troubleshoot.
More reliable.
All these features are available in a 40 pin package as in an 8 bit processor.
3. What are the Features of microcontroller?
8 bit CPU.
On chip oscillator and clock circuitry.
32 I/O lines.
64 Kbyte address space for external data memory.
64Kbyte address space for external program memory.
D6
CY AC
D5
D4
D3
D2
D1 D0
F0
RS1
RS0
OV
-- P
port 0
port 1
port 2
port 3.
Ex: INC A
The content of accumulator is increment by one.
DEC: This type of Instructions subtracts one from the content of source operand and
stores the result in same operand.
Ex: DEC Rn
The content of Rn is decremented by one.
38. Define Multiplication with Example.
MUL instruction performs an unsigned multiplication of the A register by the B
register ,and produces a double byte result .ACC receives the low order byte,and B receives
the higher order byte.
Ex:MUL AB
The content of Accumulator is multiplied with the content of B register .After multiplication
lower order result stored in Accumulator, higher order result is stored in B register.
39. Define division with example.
DIV instruction performs an unsigned division of the register A and B register. After
division quotient is stored in A register and the remainder is stored in B register.
Ex:DIV AB
The content of Accumulator is divided by content of B register .After division, the quotient is
stored in A register and remainder is stored in B register.
40. Draw the table to show the flags are affected during the execution of arithmetic
instructions.
S.NO
1.
2.
3.
4.
5.
6.
INSTRUCTIONS
ADD
ADDC
SUBB
MUL
DIV
DA
FLAG
C
Y
X
X
X
0
0
X
O
V
X
X
X
X
X
--
AC
X
X
X
----
II.unconditional jump.
53. Define unconditional jump instructions with example.
This type of instruction does not depend on any specific condition.
Ex: AJMP addr11;
LJMP addr 16;
SJMP rel; JMP@A+DPTR.
54. Define conditional jump instructions and classify their types.
Conditional jumps perform a jump upon a specific condition .if the mentioned
condition is true, the control will jump to the target address; otherwise it will execute the
instructions continuously. The destination will be within the 256 byte range (-128D to +
127D).
Conditional jump instructions are two types ,
I.bit level,II.byte level logical instructions.
55.Give some example for byte level unconditional jump instructions.
JZ rel,
JNZ rel,
CJNE A,direct,rel,
CJNE A,#data,rel,
CJNE Rn,#data,rel,
CJNE @Ri,#data,rel.
56. Give some examples for bit level jump instructions.
JC rel,
JNC rel,
JB bit,rel,
JBC bit,rel,JNB bit,rel.
57. Write short notes on CALL instruction Classify their types.
The call instruction replaces the contents of the program counter with a new program
address that causes the program execution to begin at the code located at the new address.
During the execution of call instructions the control is transferred from main program to
subroutine or from one subroutine to another subroutine.
58. Define ACALL.
9|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)
D6
D5
D4
D3
ES
ET1
D2
D1 D0
74. Which port is used for alternate input and output functions? (Board exam)
11 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
Port 3.
Priority level
highest
.
.
vector address
0003H
000BH
0013H
.
Lowest
001BH
0023H
77. What are the signals are used to access the external data memory? (Board exam)
MOVX instructions are used to access the external data memory.
78. What is the use of PSEN signal? (Board exam)
This pin is not activated for internal fetches.
It is activated when the cpu is accessing external program memory.
It is activated twice every machine cycle.
79. Explain MOV Rn, direct instruction. (Board exam)
MOV Rn, direct-The content of directly addressed location is copied into
register Rn.
80. Explain JMP @A+DPTR instruction. (Board exam)
JMP @A+DPTR-This instruction adds the 8-bit unsigned contents of the
accumulator with the 16 bit data pointer, loads the resulting sum in the
program counter.
This will be address for subsequent instruction fetches.
No flags are affected.
81. What is bit manipulation instruction?
The bit manipulation instructions perform data transfer, logical and branching
operations only on bit operand.
Ex.MOV C,bit.
12 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
UNIT II
PROGRAMMING EXAMPLES
1. List the addressing modes of 8051. (Board exam)
Immediate addressing mode.
Direct addressing mode.
Indirect addressing mode
Register addressing mode.
Index addressing mode.
2. Write the example for immediate addressing mode.
MOV A ,#64; this instruction loads the accumulator with the hexadecimal data of 64H.
3. Write the example for register addressing mode.
MOV A, R3; This instruction moves the data from register R3 into accumulator.
4. Write the example for direct addressing mode.
MOV DIRECT,A;this instruction moves the content of accumulator to direct address
directly.
MOVA, DIRECT: This instruction copies the content of directly specified location to
accumulator.
5. Write the example for indirect addressing mode.
MOV @Ri,A;this instruction moves the content of ACC to the memory location specified by
the register R1.
6. Write example for index addressing mode.
MOVC A, @A+DPTR; the content of program memory ,which address is specified by the
sum of the contents of the registers A and DPTR is moved into Accumulator.
7. Define Assembler. (Board exam)
An assembler is basically translator.
It translates the assembly language program in to machine language program.
8. Classify the types of assembler.
Manual assembler
Macro assembler,
Cross assembler,
One pass assembler,
Two pass assembler.
13 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
MOVX A,@DPTR
MOVX @DPTR, A,
MOVX A,@Ri,
MOVX@Ri,A.
15. How can you perform Multiplication with Example. (Board exam)
MUL instruction performs an unsigned multiplication of the A register by the B
register, and produces a double byte result .ACC receives the low order byte, and B
receives the higher order byte.
Ex:MUL AB
The content of Accumulator is multiplied with the content of B register .After
multiplication lower order result stored in Accumulator, higher order result is stored
in B register.
14 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
16. What is the operation carried out when 8051 executes the instruction? (Board
exam)
MOVC A,@A+DPTR?
The content of program memory which is addressed by the sum of DPTR and
Accumulator is copied into Accumulator.
UNIT III
I/O AND TIMER
1. Classify types of timer/counter operating modes. (Board exam)
D6
D5
D4
D3
GATE C/T
M1 M0 GATE
3. Write TCONregister format.
D7
D6
D5
D4
D3
D2
C/T
D1 D0
M1 M0
D2
D1 D0
Alternate use
P3.0
P3.1
P3.2
P3.3
P3.4
15 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
P3.5
P3.6
P3.7
FUNCTION
P0
P1
P2
P3
input/output
latch
input/output
latch
input/output
latch
input/output
latch
BYTE ADDRESS
port 0 80H
90H
port 1 A0H
0B0H
port 2
BIT ADDRESSES
MSB LSB
87H 80H
97H 90H
A7H A0H
B7H B0H
port 3
14. How many bit addressable locations are placed in internal RAM? (Board exam)
128 bit addressable locations in internal RAM. (00-7F)
17. State the function of M1, M0 bits in TMOD register. (Board exam)
M1, M0 bits are mode selector bits.
M1 M0
Operating modes
18. What is the function of TF0 bit in TCON register? (Board exam)
TF0-Timer 0 overflow flag bit.
Set by hardware on timer/counter overflow.
Cleared by hardware when processor vectors to its interrupt routine.
19. State the use of T0 pin of 8051. (Board exam)
T0-Timer/counter 0 external input pin.
UNIT IV
INTERRUPT AND SERIAL COMMUNICATION
1. Classify the types of serial port operating modes and their baud rates. (Board exam)
Modes
Mode 0-shift registers
Mode 1-8 bit UART
Baud rate
Fosc/12
variable
17 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
Fosc/64 or Fosc/32
variable
2. Classify the types of interrupts, priority levels and their vector addresses in 8051.
(Board exam)
The microcontroller 8051 provides 5 interrupt sources. They are
Interrupts
Priority level
vector address
highest
0003H
000BH
0013H
001BH
Lowest
0023H
D6
D5
D4
D3
ES
ET1
D2
D1 D0
D6
D5
D4
D3
PS
PT1
D2
D1 D0
D6
D5
D4
D3
SM0
SM1
D2
D1 D0
RB8 TI
RI
D6
SMOD --
D5
D4
D3
--
--
GF1
D2
D1 D0
GF0 PD
IDL
The data to be transmitted are all 0s and 1s, it is difficult to find out where the byte of
data starts and ends. Therefore, a set of rules called as protocol.
19. Define framing.
The start bit indicates the beginning of a byte and stop bit indicate the end of that
byte. That is the actual data is placed in between start and stop bit. This procedure is called as
framing.
20. Define baud rate.
The rate of data transfer is specified in terms of bits per second (bps).This rate is
called as baud rate.
21. Define band rate.
The band rate is defined as the number of signal changes per second.
22. What is the use of start and stop bit?
To identify the beginning and end of a byte of data, we have add the start bit and stop
bit with the byte of data to be transmitted.
64
39. What is interrupt signal? (Board exam)
Interrupts are control signals, used for getting immediate attention of
microcontroller.
When an interrupt occurs, the microcontroller stops the execution of main
program and its control is immediately transferred to its corresponding service
subroutine.
40. What are the SFRs used in interrupt operations? (Board exam)
IE, IP, SCON, TCON.
41. Write the pindetails of RS232. (Board exam)
Pin number
1
2
3
Description
Protective ground
Transmitted data(TxD)
Received data(RxD)
4
Request to send(RTS)
5
6
7
8
9/10
11
12
Clear to send
Data set ready
Signal ground
Data carrier detect
Reserved for data testing
Unassigned
Secondary datacarrier detect
22 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
13
14
15
16
17
18
19
20
21
22
23
24
25
Unassigned
UNIT V
INTERFACING TECHNIQUES
1. Define peripheral. (Board exam)
The microcontroller accepts data from input devices (keyboard, switches) then
it processes the data as per the instructions received from the memory unit.
After processing the data, it sends the result to the output devices (LED
display, LCD, printers).
These input and output devices are called peripherals.
2. Define interfacing. (Board exam)
Designing logic circuits and writing instructions to
enable the
microcontroller/microprocessor to communicate with these peripherals is called interfacing.
3. What is the use of 8255?
8255 is a programmable peripheral interface. It is used to perform a variety of
input/output functions in a microcomputer system. The 8255 interfaces the
microprocessor/microcontroller on one side with peripherals on the other side.
4. Mention the ports placed in 8255. (Board exam)
The 8255 consists of two 8 bit ports of port A and port B, and two 4 bit ports of port C
upper and port C lower. The ports are grouped as Group A and Group B.Group A consists of
port A (PA0 PA7) and port C upper (PC7 PC4).Group B consists of port B (PB7 PB0)
and port C lower (PC3 PC0).
5. Define control word.
The control section of 8255 has an 8 bit register called control register. An 8 bit
binary word present in the control register is called control word.
6. State the modes of operation of 8255. (Board exam)
The operation of 8255 can be classified into two modes. They are Bit set/Reset mode
and I/O mode.
23 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
28. Mention the capacity of nonvolatile RAM placed inside of DS 12887. (Board exam)
The DS 12887 has a total of 128 bytes of nonvolatile RAM. It uses 14 bytes of RAM
for clock/calendar and control registers, and the other 114 bytes of RAM for general purpose
data storage.
29. What is key bounce?
One of the most common problems with a single switch is keybounce.key bounce
refers to the fact that when the contacts of a mechanical switch is closed, they bounce for a
short time before staying together.
30. Define conversion time of ADC.
The conversion time of ADC is defined as the time it takes the ADC to convert the
analog input to digital number.
31. What is the use of IC 8253? (Board exam)
IC 8253 is a programmable counter /timer
It generate accurate time delays
It can be used for applications such as real time clock, an event counter, square
wave generator.
32. Which mode of IC 8253 is called as software triggered strobe? (Board exam)
Mode 4
33. List the operating modes of IC 8253. (Board exam)
26 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )
27 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )