You are on page 1of 27

RANGANATHAN POLYTECHNIC COLLEGE

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.

4. What are the Disadvantages of microcontroller?


Learn large instruction set.
Limited calculation procedure.
Fixed programming technique to control machine.
5. What are the Applications of microcontroller?

Small business system.


Office automation.
Entertainment.
Traffic control.

6. Write short notes on 8051.


The microcontroller 8051 is a second generation 8-bit microcontroller. It is a single
chip 40 pin DIP IC. It provides more powerful architecture, more powerful instruction set. It
operates +5V dc supply.

1|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

7. Define program status word (PSW). (Board exam)


It is one of the special function register.
This register contains program status information.
It is a bit and byte addressable register.
D7

D6

CY AC

D5

D4

D3

D2

D1 D0

F0

RS1

RS0

OV

-- P

8. Define stack pointer.


This register is an 8-bit register. The stack may reside anywhere in on-chip RAM. It is
incremented before data is stored during PUSH and CALL executions. it is decremented after
data is retrieve from memory during POP and RET execution. After, the stack pointer is
initialized to 07H.this causes the stack begins at location 08H.
9. Define data pointer. (Board exam)
It is a 16 bit register. This register contains a higher byte (DPH) and lower
byte (DPL) 8 bit registers.
It may be manipulated as a 16 bit register or as two 8 bit registers.
10. Define serial data buffer.
The serial data buffer contains two independent registers of a transmit buffer register
and a receive buffer register.when data is moved to SBUF,it goes to transmit buffer,where it
is held for serial communication.when data is moved from SBUF ,it comes from the receive
buffer.
11. Define timer registers/How many timer/counters are placed in 8051. (Board exam)
Microcontroller 8051 has two 16-bit timer/counter registers.
They are timer 0 and timer 1.
They are specified as two Register pairs (TH0, TL0) and (TH1, TL1).
12. Define control registers.
The special function registers IP, IE, TMOD, TCON, SCON and PCON contain
control and status information for interrupts,timer/counters and serial port.so,these registers
are called control registers.
13. Write about oscillator.
This circuit generates the basic timing clock signal for the operation of the circuit
using crystal oscillator.
14. Write about internal RAM and ROM capacity of 8051. (Board exam)
Data memory-internal RAM (256 Bytes). External RAM (64Kbytes).
Program memory-internal ROM (4Kbytes), external ROM (64Kbytss).

2|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

15. Define program counter of 8051. (Board exam)


The program instruction bytes fetched from locations in memory that are
addressed by the program counter.
The pc is automatically incremented after every instruction byte is fetched and
may also be altered by certain instructions.
16. Classify types of I/O ports in 8051. (Board exam)
8051 contains 4 I/O ports. Each port has 8 I/O lines. All ports are bi-directional. They
are

port 0
port 1
port 2
port 3.

17. Define timer.


The counter is programmed to count the internal clock pulses, and then it is known as
timer.
18. Write about 8051 timer functions.
In the timer function, the register is incremented every machine cycle. That means in
timer operation it counts the machine cycles. Since a machine cycle consists of 12 oscillator
periods, the count rate is 1/12 of oscillator frequency.
19. Define counter.
The counter is programmed to count the external clock pulses, then it is known a
counter.
20. Write about 8051 counter functions.
In the counter function, the register is incremented in response to 1 to 0 transition at
its corresponding external input pin T0 or T1.since it takes at least 2 machine cycles (24
oscillator periods) to recognize a 1 to transition. The maximum count rate is 1/24 of the
oscillator frequency (fosc/24).
21. How many clock cycles and states are placed in one machine cycle? (Board exam)
In 8085 1 machine cycle consists 6 states, each state having 2 clock cycles. Therefore
one machine cycle consists of 12 clock cycles.
22. Define clock cycle. (Board exam)
The square wave generated by the clock sources are called as clock cycles.
23. Define machine cycle of 8051. (Board exam)
Certain numbers of clock cycles are required to execute an instruction. These clock
cycles are called as machine cycle. One machine cycle of 8051 is made up of six states.
24. Define state. (Board exam)
A state is the time interval required for the discrete operations of the microcontroller
such as fetching an opcode, decoding an opcode or writing a data byte to memory. Each state
consists of two oscillator pulses (clock cycles).
3|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

25. Define instruction cycle. (Board exam)


The time required to fetch and execute an instruction is called as instruction cycle.
Instruction cycle = fetch cycle + execute cycle.
26. How many instructions in 8051 microcontroller? (Board exam)
The 8051 instruction set includes 111 instructions, 49 of which are single byte, 45 two
byte and 17 three byte instructions.
27. Classify the instruction set of 8051. (Board exam)

Data transfer instructions


Arithmetic instructions
Logical instructions
Control transfer instructions
Bit manipulation instructions.

28. Classify the three types of data transfer instructions in 8051.


i.General purpose instructions.
ii.Accumulator specific instructions and
iii.Address specific data transfer instructions.
29. Write the types of general purpose data transfer instructions.
MOV instructions
PUSH Instructions
POP instructions
30. Write the types of accumulator specific data transfer instructions.
The accumulator specific data transfer instructions move data into and out of the
accumulator. There are four types of instructions,
i).XCH, ii).XCHD, iii).MOVX, iv).MOVC.
31. Write the types of address specific data transfer instructions.
This instruction is used to load 16-bits of address/data into the data pointer.
MOV DPTR,#address.
32. Write some byte level data transfer instructions.
The data transfer instructions moves data from source operand to destination operand.
Actually the copy of the data is moved from one place to another place.
Ex: MOV A,Rn
The content of the register Rn is copied into the Accumulator.
4|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

MOV Rn, #data


The content of the second byte of the instruction is copied into the Register Rn.
33. Write some bit level instructions (Board exam)
MOV C, bit
The content of the directly addressed bit is copied into the carry flag.
MOV bit, C
The content of the carry bit is copied into the directly addressed bit.
34. Define addition with examples.
ADD: This type of instruction adds the content of the accumulator to the content of
source operand and puts the result in accumulator.
ADD A, Rn
The content of register Rn is added with the content of Accumulator and the result is stored in
the accumulator.
ADD A, #data
The content of second byte of the instruction is added with the content of accumulator and the
result is stored in accumulator.
35. Define addition with Carry. Give some Examples.
This type of instruction adds the content of accumulator and the content of Carry flag
with the content of source operand and puts the result in the accumulator.
Ex: ADDC A, Rn
The content of register Rn and the content of carry flag, both are added with the
content of Accumulator, and the result is stored in accumulator.
36. Define SUBB with examples
SUBB(Subtraction with borrow): This type of instructions subtracts the content of
second source operand and the content of Carry flag from the content of accumulator. Stored
result in the accumulator.
Ex: SUBB A, Rn
The content of register Rn and the content of carry flag both are subtracted from the
content of accumulator and the result is stored in the accumulator.
37. Define increment and decrement with example
INC: This type of instruction adds one to the content of source operand, and puts the
result in the same operand.
5|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

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
----

6|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

41. Write short notes on overflow problem.


If the result of operations is too large then an overflow has occurred. The programmer
has to monitor the overflow flag while operating the signed numbers.
In the 8 bit signed number operation, the OV is set for following two conditions:
i.A carry from D6 to D7 bit, but no carry from D7 bit.
ii.A carry from D7(cy=1),but no carry from D6 to D7 bit.
(if there is a carry both from D6 to D7 bit and from D7 out(cy=1),then OV = 0 (overflow
will not set)).
42. Classify the two types of logical instructions.
The microcontroller 8051 performs basic logic operations on both
operands. It is classified in to two types,

bit and byte

I. single operand instruction,


II. Two operand instruction.
43. Write about single operand instructions.
CLR instructions set Acc, Carry flag or any directly addressable bit to zero.
SETB instructions sets carry flag or directly addressable bit to 1.
CPL instruction is used to complement the content of Acc without affecting
any flags, Carry flag or directly addressable bit location.
RL,RLC,RR,RRC and SWAP are the five rotate instructions that can be
performed on Acc.RL rotates left,RR rotates right,RLC rotates left through
carry,RRC rotates right through carry and SWAP rotates left through four
bits.
44. Write about two operand instructions.
ANL (AND Logic) instructions perform bit level and byte level AND logic
functions. The result is returned to the first operand.
ORL (OR Logic) instructions perform bit level and byte level OR logic
functions. The result is returned to the first operand.
XRL (Ex-OR logic) instructions perform byte level Exclusive OR logic
function. The result is returned to the first operand.
45. Give some example for byte level logical instructions.
ANL A,Rn; the content of register Rn is logically ANDed with the content of
accumulator, and the result is stored in Accumulator.
ORL A, direct: the content of directly specified location is logically OR ed with the
content of Accumulator, and the result is stored in accumulator.
XRL A,@Ri: the content of memory location addressed by register Ri is logically
Exclusive OR ed with the content of accumulator, and the result is stored in Accumulator.
7|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

CLR A,CPL A,RL A,RLC A,RRA,RRC A,SWAP A.


46. Give some examples for bit level logical instructions.
CLR C:carry flag is cleared. No other flags are affected.
CLR bit:the content of directly addressed bit is cleared.
SETB C: carry flag is set.
SETB bit;CPL C;CPL bit;ANL C,bit;ANL C,/bit;ORL C,bit;ORL C,/bit;
47. Define compare instructions.
Microcontroller 8051 has four types of compare instructions. All compare instructions
are three byte instructions. All are control jump instructions that means compare the two
operands specified in the instruction, if their values are not equal, it will branch to the
indicated address, otherwise proceed with next instruction.
48. Give some examples for compare jump instructions.
CJNE A,direct,rel;
CJNE A,#data,rel;
CJNE Rn,#data,rel;
CJNE @Ri,#data,rel;
49. Write short notes on rotate instruction with example.
The A register can be rotated one bit position to the left or right with or without
including carry flag in the rotation. If the carry bit is not included, then the rotation involves
the 8 bits of the A register. If the carry flag is included, the 9 bits are involved in rotation .the
SWAP instruction rotate the nibbles in A register.Ex: RL A;RR A;RLC A;RRC A;SWAP A;
50. Define loop instruction, give one example.
Loop instructions are used to execute a group of instructions, a number of times as
specified by a count value stored in any one of register or direct byte location. Ex: ACALL
delay.
51. Define jump instruction.
A jump instruction can replace the content of the program counter with a new
program address number that causes the program execution to begin at the code located at the
new address. In jump instructions, the control may be transferred within main program or
within subroutine program. Ex: DJNZ R0,8089(R0-decrement value stored,8089-jump
location).
52. Classify types of jump instruction.
The jump instructions are classified in to two types,
I. conditional jump
8|preparedbyK.Shanmu ga priya&R.Siva kumar/ Lecturer (MC)

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)

ACALL address 11 (absolute call): ACALL is a two byte instruction .ACALL


instruction is only used for handling subroutines. These instruction increments the programs
counter twice. The subroutine called must therefore to start within the same 2k block of
memory.
59. Define LCALL.
LCALL address 16 (long call): LCALL is a 3 byte instruction. The call instructions
are generally used for handling subroutines and interrupts. These instructions increments
program counter by 3. The subroutine may begin anywhere in the full 64K byte of memory
address space.
60. Classify the types of return instructions, write short note to each. (Board exam)
There are 2 types of return instructions, they are RET, RETI.
RET: The RET is a return from subroutine instruction.
RETI: The RETI is a return from an interrupt service subroutine instruction.
During the execution of both instructions, the high and low bytes of the pc are successively
POP from the stack ,and decrementing the stack pointer by 2.
61. Differentiate RET and RETI instruction. (Board exam)
The only difference between RET and RETI is that RETI tells the interrupt control
system that the interrupt in progress is done. If there is no interrupt in progress at the time
RETI is executed, then the RETI is functionally identical to RET.
62. Write short notes on time delay routine.
Delay routines are subroutines used for maintaining the timing of various operations
in microcontroller. In control applications ,certain equipment is need to be ON/OFF after a
specific time delay .In some applications ,certain operation has to be repeated after a
specified time period .In such cases delay routines are used.
63. How is internal RAM classified? (Board exam)
The 128 bytes Internal RAM classified into,
Register bank area,
Bit and byte addressable area,
Byte addressable area.
64. How many I/O ports placed in microcontroller 8051? (Board exam)
3 I/O ports.
65. How many SFRs are placed in microcontroller 8051. (Board exam)
21 special function 8 bit registers. Among them
11 Byte and bit addressable registers
10 Only byte addressable registers.
10 | 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 )

66. What is the purpose of SFRs? (Board exam)


SFRs used to done some special functions in 8051, this registers are called special
function registers. Eg.SCON,PCON etc.,
67. What is the use of EA pin. (Board exam)
D7
EA

D6

D5

D4

D3

ES

ET1

D2

D1 D0

EX1 ET0 EX0

EA-Disable all interrupts. If EA=0, no interrupts will be acknowledged.


If EA=1, each interrupt source is individually disabled by its corresponding
bit.
68. How is the internal RAM is classified. (Board exam)
Register bank area (0-31)
Bit and byte addressable locations (32-47)
Only byte addressable locations (48-127)
69. Mention the three different address spaces of 8051. (Board exam)
ROM (program memory) area.
RAM (128 bytes data memory) area.
Special function registers (upper 128 bytes of RAM) area.
70. How many register banks are placed in internal RAM? (Board exam)
4 Register banks (Bank 0, 1, 2, 3).
71. How many bit addressable locations are placed in internal RAM? (Board exam)
128 bit addressable locations in internal RAM. (00-7F)
72. What is the use of carry flag? (Board exam)
In an arithmetic operation when a carry is generated, the carry flag is set,
otherwise reset.
The carry flag also serves as a borrow flag for subtraction.
73. Where is the stack memory placed in 8051? (Board exam)
Stack may reside anywhere in the on-chip RAM memory area.

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.

75. Define interrupt. (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.
76. 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
External interrupt 0 (IE0)

Priority level
highest

Timer interrupt 0 (TF0)


External interrupt 1 (IE1)
Timer interrupt 1 (TF1)
Serial port interrupt (TI+RI).

.
.

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 )

9. Define assembler directive.


Assembler directives are some instructions in the assembly language program, which
are not a part of processor instruction set. The assembler directives allow as to control the
way in which a program assembles and lists. They will not create any executable machine
language codes. The assembler directives also called pseudo operations.
10. Give some examples for AD (Assembler directives). (Board exam)
DB;EQU;END;Label;Comment.
11. Mention the different fields in assembly language instructions. (Board exam)
An assembly language instructions consists of 4 fields,
They are [Label:] mnemonic [operands] [; comment]
Brackets indicate that a field is optional.
12. What is operand field? (Board exam)
The operand field, if required, must follow the operation field, and must be
preceded by at least one white space character.
The operand field may contain a symbol, an expression or a combination of
symbols and expressions separated by commas.
13. What are the fields used in assembly language instructions as optional? (Board
exam)
Label,operants,comment fields are optional in assembly language instructions.
14. What are the instructions used to access the external RAM? (Board exam)

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)

Mode 0-13bit timer.


Mode1-16 bit timer /counter.
Mode 2-8 bit auto reload timer/counter.
Mode 3-split timer.

2. Write TMOD register format.


D7

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

TF TR TF TR IE1 IT1 IE0 IT0


1 1 0 0
4. How many ports available in 8051?
Microcontroller 8051 contains four I/O ports. They are port 0, port 1, port 2, and port
3.
5. Which port is called multifunctional I/O port?
Port 3 is called as multifunctional I/O port.
6. Write alternate functions of port 3.
Port pins

Alternate use

P3.0

RXD serial data input

P3.1

TXD serial data output

P3.2

INT0 external interrupt 0

P3.3

INT1 external input 1

P3.4

T0 external timer 0 input

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

T1 external timer 1 input

P3.6

WR external memory write pulse

P3.7

RD external memory read pulse.

7. Specify byte addresses of 8051 I/O ports. (Board exam)


NAME

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

8. How is internal RAM classified?


The 128 bytes Internal RAM classified into,
Register bank area,
Bit and byte addressable area,
Byte addressable area.
9. Specify the address range of bit addressable locations of internal RAM area.
The address range of bit addressable locations of internal RAM area is 00 7FH.
10. What type of addressing is used for accessing bit addressable internal RAM?
The bit addresses of internal RAM can be accessed only by using direct addressing.
11. What will happen during the execution of MOV P2.0, C instruction?
Moves the data placed in carry flag to port P2.0.
12. What are the registers used for timer/counter operations?
TMOD timer/counter mode control register,
TCON timer/counter control register.
TH0,TL0
TH1,TL1
13. What is the use of GATE bit in TMOD register? (Board exam)
Timer/counter gating control .when GATE =1, timer/counter X is enabled
only while INTX pin is high (hardware control) and TRX (in TCON register)
is set.
When GATE =0, TIMER/COUNTER X will run only while TRX =1
(software control).
16 | 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 )

14. How many bit addressable locations are placed in internal RAM? (Board exam)
128 bit addressable locations in internal RAM. (00-7F)

15. Mention the SFRs used in Timer operation. (Board exam)


TMOD,TCON,TH0,TL0,TH1,TL1
16. What is the function of c/t bit in TMOD register? (Board exam)
C/T: countr/timer operation bit.
This Bit=0 Timer operation.
Bit= 1 counter operation

17. State the function of M1, M0 bits in TMOD register. (Board exam)
M1, M0 bits are mode selector bits.
M1 M0

Operating modes

Mode 0-13bit timer.

Mode1-16 bit timer /counter.

Mode 2-8 bit auto reload timer/counter.

Mode 3-split timer.

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 )

Mode 2-9 bit UART

Fosc/64 or Fosc/32

Mode 3- 9 bit UART

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

external interrupt 0 (IE0)

vector address

highest

0003H

timer interrupt 0 (TF0)

000BH

external interrupt 1 (IE1)

0013H

timer interrupt 1 (TF1)

001BH

serial port interrupt (TI+RI).

Lowest

0023H

3. Write IE register format.


D7
EA

D6

D5

D4

D3

ES

ET1

D2

D1 D0

EX1 ET0 EX0

4. Write IP register format.


D7
X

D6

D5

D4

D3

PS

PT1

D2

D1 D0

PX1 PT0 PX0

5. Write SCON register format.


D7

D6

D5

D4

D3

SM0

SM1

SM2 REN TB8

D2

D1 D0

RB8 TI

RI

6. Write PCON register format.


D7

D6

SMOD --

D5

D4

D3

--

--

GF1

D2

D1 D0

GF0 PD

IDL

7. What is the difference between mode 2 and mode 3 in serial communication?


Only one difference between mode 2 and mode 3 are mode 2 is fixed baud rate and
mode 3 is variable baud rate.
8. What are the registers used for serial communication in 8051?
SCON serial port control register
18 | 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 )

PCON power control register.


9. Specify the baud rate of serial communication in mode 2.
The baud rate is programmable to either Fosc/32 or Fosc/64.

10. What is the use of RS 232? (Board exam)


It is used for serial communication.
It is a protocol standard as well as electrical standard.
11. Why drivers are used in between RS 232 and microcontroller? (Board exam)
Line drivers are (voltage converter) used to convert RS232s signals to TTL voltage
levels, that will be acceptable to the 8051s TXD and RXD pins.
12. What are the SFR registers used in interrupt operations?
The TCON, IP and IE special function registers are used for executing interrupts in
microcontroller 8051.
13. What are the different classifications of serial communication?
i. synchronous data transfer,
ii. asynchronous data transfer.
14. Write about synchronous and asynchronous data transfer.
In synchronous data transfer a block of data is transferred at a time. In asynchronous
data transfer only one byte of data transfer at a time.
15. Specify some special IC chips used for serial communication.
UART Universal asynchronous receiver transmitter.
USART Universal synchronous - asynchronous receiver transmitter.
16. Classify the types of serial communication based on direction of communication.
i. simplex communication
ii. Half duplex communication
iii. Full duplex communication.
17. Define simplex, half duplex, full duplex communication.
Simplex if the data transmission takes place only in one direction. Ex:
Radio/TV station Transmission
Half duplex - if the data transmission is in one direction at a time. Ex: Walky
talky
Full duplex if the data transmission takes place on both the direction at a
time or simultaneously. Ex: Mobile phone
18. Define protocol.
19 | 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 )

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.

23. What is RS - 232? (Board exam)


RS232C is a serial interface standard.
It is developed by Electronic Industries Association (EIA).this standard
describes the functions of 25 signals and handshake pins for serial data
transfer.
24. What is MAX232?
MAX 232 is a voltage converter. It converts from RS232 voltage levels to TTL
voltage levels and viseversa.one advantage of MAX232 chip is that it uses +5v power supply.
So a single power supply can be used to power both 8051 and MAX 232.
25. What do you mean by software generated interrupt?
If an interrupt lag is set 1 by the software program instruction, an interrupt is
generated and executed in a similar way the hardware generated interrupts are handled. Since
this generated by the software, it is called a software generated interrupt.
26. Define interrupt handler.
The program flow is always sequential. But the interrupts can stop the normal
program flow, execute a subroutine and then resume the normal program flow. This
subroutine called an interrupt handler.
27. What is the use of IP, IE register in 8051?
The programmer can control the interrupts by altering the control bits in the interrupt
enable register (IE), and interrupt priority register (IP).
28. How will you double the baud rate in 8051? (Board exam)
The SMOD bit in PCON is used to set the baud rate of serial communication.
20 | 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 )

It is double baud rate bit.


When SMOD bit is set to 1, the baud rate is doubled, when the serial port is
used in either mode 1, 2, 3.

29. What is the function of SMOD in PCON register? (Board exam)


The SMOD bit in PCON is used to set the baud rate of serial communication.
It is double baud rate bit.
When SMOD bit is set to 1, the baud rate is doubled, when the serial port is
used in either mode 1, 2, 3.
30. What is the function of REN bit in SCON register? (Board exam)
REN- Enable serial reception.
It is set /cleared by software to enable/disable reception.
31. How many timer/counters are placed in 8051? (Board exam)
Microcontroller 8051 has two 16-bit timer/counter registers.
They are timer 0 and timer 1.
They are specified as two Register pairs (TH0, TL0) and (TH1, TL1).
32. Define 8051 timer functions. (Board exam)
In the timer function, the register is incremented every machine cycle.
That means in timer operation it counts the machine cycles.
Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12
of oscillator frequency.
33. Define 8051 counter functions. (Board exam)
The counter is programmed to count the external clock pulses, and then it is
known a counter.
In the counter function, the register is incremented in response to 1 to 0
transitions at its corresponding external input pin T0 or T1.
Since it takes at least 2 machine cycles (24 oscillator periods) to recognize a 1
to transition. The maximum count rate is 1/24 of the oscillator frequency
(fosc/24).
34. What is the difference between mode 2 and mode 3 of serial communication? (Board
exam)
Mode 2 & 3 are used for same operation but baud rate is varied.
Mode2 9 bit UART (fixed baud rate)
Mode 3 9 bit UART (Variable baud rate)
21 | 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 )

35. How is the serial transmission is initiated in 8051? (Board exam)


The transmission is initiated by any instruction that uses SBUF as a
destination register.
Ex.MOV SBUF, A
36. What are the conditions required for initiating a serial reception? (Board exam)
Reception is initiated in Mode 0 by the condition RI = 0 and REN = 1.
In other modes it is initiated by the incoming start bit, if REN = 1.
37. What are the registers used for serial communication? (Board exam)
SCON, PCON, TMOD, TH1, TL1, TH0, TL0, SBUF.
38. Specify the baud rate of serial communication in mode 2. (Board exam)
The baud rate in Mode 2 depends on the value of SMOD in special function
register in PCON.
If SMOD = 0, the baud rate is fosc/64.
If SMOD = 1, the baud rate is fosc/32.
2SMOD X (oscillator frequency)

Mode 2 baud rate =

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

Secondary clear to send


Secondary transmitted data
Transmit signal element timing
Secondary received data
Receive signal element timing
Unassigned
Secondary request to send
Data terminal ready
Signal quality detector
Ring indicator
Data signal rate select
Transmit signal element timing

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 )

7. How is the I/O mode of 8255 classified? (Board exam)


The I/O mode is further classified into 3 modes. They are
Mode 0 - simple I/O port
Mode 1 Strobe I/O port (hand shake I/O port)
Mode 2 Bidirectional I/O port
8. What is relay? (Board exam)
A relay is an electrically controllable switch widely used in industrial controls,
automobiles and appliances. It allows the isolation of two separate sections of a system with
two different voltage sources.
9. Mention the 3 important components of electromagnetic relay. (Board exam)
The electromagnetic relays have 3 components: coil, spring and contacts.
10. Define opto isolator. (Board exam)
Opto isolator is otherwise called opto coupler. It isolates two part of a system.
11. Define transducers (sensors). (Board exam)
Transducers convert physical data such as temperature, light intensity, flow and speed
to electrical signals. Depending on the transducers, the output maybe in the form of voltage,
current, resistance or capacitance.
12. How is the output voltage of LM 34 varied? (Board exam)
The sensors of LM 34 series are precision integrated circuit temperature sensors
whose output voltage is linearly proportional to the Fahrenheit temperature. Its output is
varied to 10mV for each degree of Fahrenheit temperature.
13. How is the output voltage of LM 35 varied? (Board exam)
LM 35 series sensors are precision integrated circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius temperature, Its output is varied to
10mV for each degree of centigrade temperature.
14. What is signal conditioning?
Signal conditioning is widely used for data acquisition. The most common transducers
produce an output in the form of voltage, current, charge, capacitance and resistance. These
signals are converted into voltage, in order to send input to an A to D converter. This
conversion is commonly called signal conditioning.
15. Define ADC. (Board exam)
Analog to digital converters are most widely used devices for data acquisition. Digital
computers use binary values, but in the physical world everything is analog.ADC is used to
convert these analog values into digital.
16. Mention the ports placed in group A and group B of 8255.
Group A-port A and port C upper (PC7-PC4).
Group B-port B and port C lower (PC3-PC0).
24 | 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 )

17. Which technique is used in ADC 0808? (Board exam)


Successive approximation technique is used in ADC 0808.
18. What is the use of MAX 1112 ADC chip?
MAX 1112 ADC chip is used for serial analog to digital conversion.

19. Define DAC. (Board exam)


DAC digital to analog converter. It is used to convert digital signals to analog
signals. In DAC the number of input data bits decides the resolution. An n bit DAC provides
2n discrete voltage (or current) levels.
20. State the output current of DAC 0808. (Board exam)
I out=I ref (D7/2+D6/4+D5/8+D4/16+D3/32+D2/64+D1/128+D0/256).
I ref is the input current; D0 is LSB, D7 is MSB, I out is output current.
21. Mention three major tasks of keyboard to get a meaningful data. (Board exam)
Sense a key actuation,
Debounce the key,
Decode the key.
22. Mention the different types of seven segment LEDs. (Board exam)
Common anode type
Common cathode type.
23. Mention the two important registers placed in LCD. (Board exam)
There are two important registers of Data register, Command register placed inside
the LCD.
24. Specify some important LCD module. (Board exam)
They are available in 162, 201, 202, 204, and 402 sizes. The first digit
represents number of characters in each line. Second digit represents number of
lines.ex:162 means, 16 characters per line and 2 lines.
25. What is the use of stepper motor? (Board exam)
Stepper motor is a device, used for getting accurate position control of rotating shafts.
It converts electrical pulses into mechanical movements. A stepper motor employs rotation
of its shaft, in terms of steps rather than continues rotation, as in the case of AC or DC
motors.
26. Which technique is used for varying the speed of DC motors used in
microcontrollers? (Board exam)
PWM pulse width modulation technique is used for varying the speed of DC motors
in microcontrollers.
25 | 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. What is the use of RTC? (Board exam)


The real time clock (RTC) is a widely used device that provides accurate time and
date for many applications. The RTC chip in IBMPC provides time components of hour,
minute, and second, in addition to the date/calendar components of year, month and day. It
uses an internal battery, which keeps the time and date even when the power is off.

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)

Mode 0 (interrupt on terminal count)


Mode 1 (programmable monoshot)
Mode 2 (rate generator)
Mode 3 (square wave generator)
Mode 4 (software triggered strobe)
Mode 5 (hardware triggered strobe)

34. How many counters placed in 8253? (Board exam)


3 counters (16 bit presettable down counters)
35. Draw the diagram for relay interface with 8051.

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 )

You might also like