38. What is difference between microcontroller and microprocessor? Ans: Microprocessor
Microcontroller
Memory, ports, timers, interrupts and controllers are external to the chip.
Memory, ports, interrupts and controllers are internal to the chip.
Based on Von-Neumann architecture.
Based on Harvard architecture.
Have many instructio instructions ns for data transfer b/w
Have limited limited instructions instructions for data transfer b/w
the microprocess microprocessor or and external memory.
the microcontroller and external memory.
The instruction sets contains limited number of instructions for bit operation.
It performs large number of bit level operation.
39. What are flags and Program Progr am status word (PSW)? Ans: Flags are 1-bit registers registers provided provided to store the result of certain program instructions. instructions. PSW: The PSW contains the math flags, user program flag F0, and the registerselect bits that identify which of the four general purpose purpose register banks is currently in use by the program.
CY AC F0 RS1 RS0 OV -- P 40. What is stack?
Ans: The stack refers to an area of internal RAM that is used in conjugation conjugation with certain opcodes to Store and retrieve data quickly.
41.What is counter? Ans; Counter is the process process of counting the the pulses generated generated by any system.
42. Explain the TCON special function register? Ans: TCON special function register register
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 Explain the above table based on your microcontroller knowledge of flags1 and 0’s and others.
43. Explain TMOD special function register. Ans: TMOD special function function register
Gate C/Tbar M1 M0 Gate C/Tbar M1 M0
44. Draw the special function funct ion register for SCON and PCON. Ans: SCON
SM0 SM1 SM2 REN TB8 RB8 TI RI PCON:
SM0D -- -- -- GF1 GF0 PD IDL 45. What do you mean by timer flag interrupt?
Ans: When W hen a timer/counter overflows, the correspondi corresponding ng timer t imer flag, TF0 or TF1, is set to t o 1. The flag is cleared to 0 when the resulting interrupt generates a program call to the appropriate timer subroutine in memory.
46. Draw and explain the Interrupt enable (IE) and Interrupt Priority (IP) special function register. Ans: IE special function function register:
EA -- ET2 ES ET1 EX1 ET0 EX0 IP special function registers:
-- -- PT2 PS PT1 PX1 PT0 PX0 --“not implemented PT2: Reserved for future use. PS: Priority of serial port interrupt.
PT1: Priority of timer of PX1: Priority of external int1.
1
overflow
interrupt.
Set
cleared
by
program.
PT0: Priority of timer0 overflow interrupt.
PX0: Priority of external int 0.
47. What are different addressing modes in microcontroller? Give one example for each. Ans:1.Immediate addressin addressing g mode. 2. Register addressing mode. 3. Direct addressing mode. 4. Indirect addressing mode.
Eg: (ADD A,#77) Eg: (ADD A, R0) Eg: (MOV A, 088H) Eg: (MOV A,@R0)
48.What are the different instruction instruction sets ? Ans:1. Data transfer instruction. instruction.
2.Arithmetic instruction instruction..
3.Logical Instruction.
4.Boolean variable manipulation instruction.
5. Program branching instructions.
49. For the given set of instruction name the operation and addressing modes. i)MOV A,#n ii)MOV A, addr iii)MOVX A,@DPTR iv)MOVC A,@A+DPTR v)XCH A,Rn
Ans: i) Operation: Copy the immediate Addr Ad dr ess in ing g mo mode de:: Immediate add mode.
8
bit
data
into
the accumulator. accumulator.
It is a 2 byte instruction.
ii) Operation: Copy the contents of the internal RAM address (addr) into theaccumulator. Addr Ad dr ess in ing g mo mode: de: Direct addressing mode.
It is a 2 byte instruction.
iii) Operation: Copy the contents of the external RAM address stored in DPTR into the accumulator. a ccumulator. Addr Ad dr ess in ing g mo mode: de: Indirect addressing mode.
It is a 1 byte instruction.
iv) Operation: Copy the code byte, found at the ROM address formed by adding A and the DPTR, into the accumulator. a ccumulator.
It is a 1 byte instruction.
v) Operation: Exchange data bytes between t he accumulator and the register Rn.
Addressing: Register Addressing Addressing mode. mode.
It is a 1 byte instruction.
50.
What
are
the
various
jump
instructions
in
microcontroller?
Ans: It is of two types- conditional jump and unconditional jump. Conditional jump is of two types byte level instruction an bit level instruction. Similarly unconditional jump is also divided into 3 sub-jump and these are- Short jump, Absolute jump, Long jump.
51. What do you mean by subroutine? Ans: A subroutine is a program that t hat may be used many times in the execution of a larger program
MULTIPLE CHOICE QUESTIONS
1.
The internal RAM memory of the 8051 is: A.
32 bytes
B.
64 bytes
C.
128 bytes
D.
256 bytes
Answer: Option C
2.
This program code will be executed continuously: STAT: MOV A, #01H JNZ STAT A.
True
B.
False
Answer: Option A
3.
The 8051 has ________ 16-bit counter/timers. A.
1
B.
2
C.
3
D.
4
Answer: Option B
4.
The address space of the 8051 is divided into four distinct areas: internal data, external data, internal code, and external code. A.
True
Answer: Option A
B.
False
5.
Data transfer from I/O to external data memory can only be done with the MOVX command. A.
True
B.
False
Answer: Option A
6.
The 8051 can handle ________ interrupt sources. A.
3
B.
4
C.
5
D.
6
Answer: Option C Explanation:
There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be enabled or disabled by setting bits of the IE register. Likewise, the whole interrupt system can be disabled by clearing the EA bit of the same register. 7.
The special function registers are maintained in the next 128 locations after the general-purpose data storage and stack. A.
True
B.
False
Answer: Option A
8.
This statement will set the address of the bit to 1 (8051 Micro-controller): SETB 01H
A.
True
Answer: Option B
9.
MOV A, @ R1 will: A.
copy R1 to the accumulator
B.
copy the accumulator to R1
B.
False
C.
copy the contents of memory whose address is in R1 to the accumulator
D.
copy the accumulator to the contents of memory whose address is in R1
Answer: Option C
10. A label is used to name a single line of code. A.
True
B.
False
Answer: Option A
11. The following program will receive data from port 1, determine whether bit 2 is high, and then send the number FFH to port 3: READ: MOV A,P1 ANL A,#2H CJNE A,#02H,READ MOV P3,#FFH A.
True
B.
False
Answer: Option A
12. Device pins XTAL1 and XTAL2 for the 8051 are used for connections to an external oscillator or crystal. A.
True
B.
False
Answer: Option A
13. When the 8051 is reset and the first program instruction in the: A.
internal code memory
B.
external code memory
C.
internal data memory
line is HIGH, the program counter points to the
D.
external data memory
Answer: Option A
14. An alternate function of port pin P3.4 in the 8051 is: A.
Timer 0
B.
Timer 1
C.
interrupt 0
D.
interrupt 1
Answer: Option A
15. Both registers TL0 and TL1 are needed to start Timer 0. A.
True
B.
False
Answer: Option B
16. The I/O ports that are used as address and data for external memory are: A.
ports 1 and 2
B.
ports 1 and 3
C.
ports 0 and 2
D.
ports 0 and 3
Answer: Option C
17. The last 96 locations in the internal data memory are reserved for general-purpose data storage and stack. A.
True
B.
False
Answer: Option B
18. Microcontrollers often have: A.
CPUs
B.
RAM
C.
ROM
D.
all of the above
Answer: Option D
19. The 8051 has ________ parallel I/O ports. A.
2
B.
3
C.
4
D.
5
Answer: Option C
20. The total external data memory that can be interfaced to the 8051 is: A.
32K
B.
64K
C.
128K
D.
256K
Answer: Option B
21. Which of the following instructions will load the value 35H into the high byte of timer 0? A.
MOV TH0, #35H
B.
MOV TH0, 35H
C.
MOV T0, #35H
D.
MOV T0, 35H
Answer: Option A
22. Bit-addressable memory locations are: A.
10H through 1FH
B.
20H through 2FH
C.
30H through 3FH
D.
40H through 4FH
Answer: Option B
23. The 8-bit address bus allows access to an address range of: A.
0000 to FFFFH
B.
000 to FFFH
C.
00 to FFH
D.
0 to FH
Answer: Option C
24. The contents of the accumulator after this operation MOV A,#0BH ANL A,#2CH will be A.
11010111
B.
11011010
C.
00001000
D.
00101000
Answer: Option C
25. The start-conversion on the ADC0804 is done by using the: A. B.
CS line
C.
INTR line
D.
V ref/2 line
Answer: Option A
26. This program code will be executed once: STAT: MOV A, #01H JNZ STAT A.
True
B.
False
Answer: Option B
27. Which of the following instructions will move the contents of register 3 to the accumulator? A.
MOV 3R, A
B.
MOV R3, A
C.
MOV A, R3
D.
MOV A, 3R
Answer: Option C
28. Which of the following statements will add the accumulator and register 3? A.
ADD @R3, @A
B.
ADD @A, R3
C.
ADD R3, A
D.
ADD A, R3
Answer: Option D
29. Data transfer from I/O to external data memory can only be done with the MOV command. A.
True
B.
False
Answer: Option B
30. Which of the following commands will move the number 27H into the accumulator? A.
MOV A, P27
B.
MOV A, #27H
C.
MOV A, 27H
D.
MOV A, @27
Answer: Option B
31. This program code will read data from port 0 and write it to port 2, and it will stop looping when bit 3 of port 2 is set: STAT: MOV A, PO MOV P2,A JNB P2.3, STAT A.
True
B.
False
Answer: Option A
32. Which of the following commands will move the value at port 3 to register 2? A.
MOV P2, R3
B.
MOV R3, P2
C.
MOV 3P, R2
D.
MOV R2, P3
Answer: Option D
33. The number of data registers is: A.
8
B.
16
C.
32
D.
64
Answer: Option C
34. When the 8051 is reset and the EA line is LOW, the program counter points to the first program instruction in the: A.
internal code memory
B.
external code memory
C.
internal data memory
D.
external data memory
Answer: Option B
35. The designs of a centigrade thermometer and a PWM speed-control circuit can be implemented by the 8051. A.
True
B.
False
Answer: Option A
36. What is the difference between the 8031 and the 8051? A.
The 8031 has no interrupts.
B.
The 8031 is ROM-less.
C.
The 8051 is ROM-less.
D.
The 8051 has 64 bytes more memory.
Answer: Option B
37. The I/O port that does not have a dual-purpose role is: A.
port 0
B.
port 1
C.
port 2
D.
port 3
Answer: Option B
38. To interface external EPROM memory for applications, it is necessary to demultiplex the address/data lines of the 8051. A.
True
B.
False
Answer: Option A
39. The following command will copy the accumulator to the location whose address is 23H: MOV 23H,A A.
True
B.
False
Answer: Option A
40. The special function registers can be referred to by their hex addresses or by their register names. A.
True
B.
False
Answer: Option A
41. The contents of the accumulator after this operation MOV A,#2BH ORL A,00H will be: A.
1B H
B.
2B H
C.
3B H
D.
4B H
Answer: Option B
42. The following program will cause the 8051 to be stuck in a loop:
LOOP: MOV A, #00H JNZ LOOP A.
True
B.
False
Answer: Option B
43. Which of the following commands will copy the contents of RAM whose address is in register 0 to port 1? A.
MOV @ P1, R0
B.
MOV @ R0, P1
C.
MOV P1, @ R0
D.
MOV P1, R0
Answer: Option C
44. The statement LCALL READ passes control to the line labelled READ. A.
True
B.
False
Answer: Option A
45. Which of the following commands will copy the contents of location 4H to the accumulator? A.
MOV A, 04H
B.
MOV A, L4
C.
MOV L4, A
D.
MOV 04H, A
Answer: Option A
46. The microcontroller is useful in systems that have nonvariable programs for dedicated applications. A.
True
B.
False
Answer: Option A
47. The total amount of external code memory that can be interfaced to the 8051 is: A.
32K
B.
64K
C.
128K
D.
256K
Answer: Option B
48. The ADC0804 has ________ resolution. A.
4-bit
B.
8-bit
C.
16-bit
D.
32-bit
Answer: Option B
49. A HIGH on which pin resets the 8051 microcontroller? A.
RESET
B.
RST
C.
PSEN
D.
RSET
Answer: Option B
50. An alternate function of port pin P3.1 in the 8051 is: A.
serial port input
B.
serial port output
C.
memory write strobe
D.
memory read strobe
Answer: Option B 51. Which of the following instructions will move the contents of the accumulator to register 6? A.
MOV 6R, A
B.
MOV R6, A
C.
MOV A, 6R
D.
MOV A, R6
Answer: Option B
52. The following command will rotate the 8 bits of the accumulator one position to the left: RL A
A.
True
B.
False
Answer: Option A
53. An alternate function of port pin P3.0 (RXD) in the 8051 is: A.
serial port input
B.
serial port output
C.
memory write strobe
D.
memory read strobe
Answer: Option A