Microcontroller Lab Manual

Similar documents
S.J.P.N Trust's. Hirasugar Institute of Technology, Nidasoshi.

Microcontroller Intel [Instruction Set]

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

1. Write A Program to move a block of data within the internal RAM

Programming of 8085 microprocessor and 8051 micro controller Study material

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

8051 Microcontroller

Module Contents of the Module Hours COs


Assembly Language programming (2)

Principle and Interface Techniques of Microcontroller

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

Digital Blocks Semiconductor IP

8051 Overview and Instruction Set

SN8F5000 Family Instruction Set

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP

~: Simple Programs in 8051 assembly language :~

Microcontroller. Instruction set of 8051

TUTORIAL Assembly Language programming (2)

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

Programming Book Microcontroller Kit. Rev 3.0 January, Wichit Sirichote

8051 Microcontrollers

MODEL ANSWER SUBJECT- MICROCONTROLLER(12187) CLASS-EJ5E CLASS TEST-02 Q1.)Attempt any THREE of the following.

Dodatak. Skup instrukcija

Contents. Join the Technical Community Today!

Q. Classify the instruction set of 8051 and list out the instructions in each type.

WINTER 14 EXAMINATION Subject Code: Model Answer Page No: 1/ 26

Microcontroller and Applications

MODEL ANSWER WINTER 17 EXAMINATION Subject Title: Microcontroller and applications

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

Instruction Set Of 8051

C51 Family. Architectural Overview of the C51 Family. Summary

MODEL ANSWER SUMMER 17 EXAMINATION Subject Title: Microcontroller and Applications Subject Code:

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics

Dragonchip. Instruction Set Manual

Microcontroller and Embedded Systems:

8051 Microcontroller

ELEG3923 Microprocessor Ch.9 Timer Programming

DR bit RISC Microcontroller. Instructions set details ver 3.10

8051 Programming using Assembly

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

Principle and Interface Techniques of Microcontroller

Embedded Controller Programming

MODEL ANSWER SUMMER 17 EXAMINATION Subject Title: Microcontroller Subject Code:

MICROCONTROLLER AND PLC LAB-436 SEMESTER-5

8051 Microcontroller Assembly Programming

Application Brief D-005

Introduction To MCS-51

Lecture 5. EEE3410 Microcontroller Applications Department of Electrical Engineering Assembly Language Programming (1)

MICROPROCESSOR LABORATORY MANUAL

8051 Programming: Arithmetic and Logic

Control Transfer Instructions Jump, Loop, and Call. ECE473/573 Microprocessor System Design, Dr. Shiue

INSTRUCCIONES ARITMETICAS ERROR! MARCADOR NO DEFINIDO.

M.S ENGINEERING COLLEGE NAVARTNA AGRAHARA,SADAHALLI P.O, BANGALORE

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

Assembly Language programming (3)

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

Microcontrollers can be considered as self-contained systems with a processor, memory and I/O ports.

2. Write an 8051 program to generate a square wave of 25 khz at pin P2.3 using XTAL = 12 MHz. Solution:

8051 Interfacing and Applications Microcontroller

Figure Programming model

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor

MICROCONTROLLER LAB Version 1.0 Aug 2017

Report Title: Digital Voltmeter using 89C51

NAME as31 - An Intel 8031/8051 assembler. SYNOPSIS as31 [-h] [-l] [-s] [-v] [-Aarg] [-Ffmt] [-Ofile] infile.asm

EE6502- MICROPROCESSOR AND MICROCONTROLLER

Highlights. FP51 (FPGA based 1T 8051 core)

Q.1. A) Attempt any THREE of the following:

MCS -51 Programmer s Guide and Instruction Set

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

8051 Core Specification

What Registers are available? Programming in Assembler. Assembler Programming - like early Basic. Assembler Data Movement Instructions

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MODULE-1. Short Answer Questions

Unit-I. 1. INTRODUCTION TO MICROCONTROLLERS. Micro controller, types, selection of a microcontroller and applications

LCD AND KEYBOARD INTERFACING

Lab-Report Microprocessors

AL8051S 8-BIT MICROCONTROLLER Application Notes

LAB FILE of EE1531: MICROCONTROLLER & EMBEDDED SYSTEMS LAB

80C51 family programmer s guide and instruction set. 80C51 Family. PROGRAMMER S GUIDE AND INSTRUCTION SET Memory Organization. Philips Semiconductors

Question Bank Microprocessor and Microcontroller

8051 Microcontrollers

WINTER 14 EXAMINATION

Vidyalankar T.E. Sem. V [ETRX] Microprocessors and Microcontrollers I Prelim Question Paper Solution

Chapter 3. Bit Addressable Area. By DeccanRobots

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip.

C51 Family. C51 Family Programmer s Guide and Instruction Set. Summary

UNIT MICROCONTROLLER AND ITS PROGRAMMING

80C451 operation of port 6

INTEGRATED CIRCUITS. AN408 80C451 operation of port 6

CS 320. Computer Architecture Core Architecture

Assembly Language Programming Assignment 1

MICROCONTROLLER BASED WATER LEVEL CONTROL SYSTEM

build_char macro P1,P2,P3,P4,P5,P6,P7,P8 ;Macro for building a custom character

Engr. A. N. Aniedu Electronic and Computer Engineering Nnamdi Azikiwe University, Awka

Transcription:

Microcontroller Lab Manual

PROGRAM TO TRANSFER A BLOCK OF DATA FROM SOURCE TO DESTINATION Write an Assembly Level Program to transfer a source block of Five Bytes, stored at RAM location 20H to 24H, to Destination Location from 30H to 34H. ORG 0000H MOV R0,#20H MOV R1,#30H MOV R2,#05H UP:MOV A,@R0 MOV @R1,A INC R0 INC R1 DJNZ R2, UP END

PROGRAM TO EXCHANGE THE BLOCK OF DATA Write an assembly language program in 8051 to exchange a source block of 5 bytes, stored in internal RAM memory locations from 50h to 54h, with destination block of 5 bytes, stored in internal RAM locations from 70h to 74h. ORG 0000H MOV R0,#50H MOV R1,#70H MOV R2,#05H UP:MOV A,@R0 XCH A,@R1 MOV @R0,A INC R0 INC R1 DJNZ R2,UP END

PROGRAM TO ARRANGE THE NUMBERS IN DESCENDING ORDER Write an assembly language program in 8051 to arrange an array of 5 bytes, stored in internal RAM locations from 30h to 34h, in descending order. ORG 0000H MOV R1,#05H DEC R1 PASS:MOV 02H,R1 MOV R0,#30H BACK:MOV A,@R0 INC R0 MOV B,@R0 CJNE A,B,TEMP TEMP:JNC NEXT MOV @R0,A DEC R0 MOV @R0,B INC R0 NEXT:DJNZ R2,BACK DJNZ R1,PASS END

Program to arrange the numbers in ascending order Write an assembly language program in 8051 to arrange an array of 5 bytes, stored in internal RAM locations from 30h to 34h, in ascending order. ORG 0000h MOV R1,#05H DEC R1 PASS:MOV 02H,R1 MOV R0,#30H BACK:MOV A,@R0 INC R0 MOV B,@R0 CJNE A,B,TEMP TEMP:JC NEXT MOV @R0,A DEC R0 MOV @R0,B INC R0 NEXT: DJNZ R2,BACK DJNZ R1,PASS END

PROGRAM TO FIND THE LARGEST ELEMENT IN AN ARRAY Write an assembly language program in 8051 to find the largest element (byte) in a given array of 5 bytes, stored in internal RAM locations from 40h to 44h. ORG 0000H MOV R1,#05H MOV R0,#40H MOV A,@R0 UP:INC R0 MOV B,@R0 CJNE A,B,EXCH SJMP EXIT EXCH:JNC UP XCH A,B EXIT:DJNZ R1,UP END

PROGRAM TO ADD TWO 16 BIT NUMBERS Write an assembly language program in 8051 to add two 16-bit numbers 3412h and 7856h. Store the lower byte of result in R5 and higher byte in R6. ORG 0000H MOV R1,#12H MOV R2,#34H MOV R3,#56H MOV R4,#78H CLR C MOV A,R1 ADD A,R3 MOV R5,A MOV A,R2 ADDC A,R4 MOV R6,A END

PROGRAM TO SUBSTRACT TWO 16 BIT NUMBERS Write an assembly language program in 8051 to subtract a 16-bit number 3412h from 7856h. Store the lower byte of result in R5 and higher byte in R6. ORG 0000H MOV R1,#56H MOV R2,#78H MOV R3,#12H MOV R4,#34H CLR C MOV A,R1 SUBB A,R3 MOV R5,A MOV A,R2 SUBB A,R4 MOV R6,A END

PROGRAM TO MULTIPLY TWO 8 BIT NUMBERS Write an assembly language program in 8051 to multiply two 8-bit numbers. 1 st no. is stored in external RAM location 8000h and 2 nd no. is stored in external RAM location 8001h. Store the result of multiplication in external RAM locations 8002h & 8003h. ORG 0000H MOV DPTR,#8000H MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR MUL AB INC DPTR MOVX @DPTR,A MOV A,B INC DPTR MOVX @DPTR,A

END PROGRAM FOR DIVISION OF TWO 8 BIT NUMBER Write an assembly language program in 8051 to Divide two 8-bit numbers. 1 st no. is stored in external RAM location 8000h and 2 nd no. is stored in external RAM location 8001h. Store the result of multiplication in external RAM locations 8002h & 8003h. ORG 0000H MOV DPTR,#8000H MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR DIV AB INC DPTR MOVX @DPTR,A MOV A,B

INC DPTR MOVX @DPTR,A END PROGRAM TO FIND THE SQUAR OF THE NUMBER Write an assembly language program in 8051 to find the square of an 8-bit number, stored in external RAM location 8000h. Store the result in external RAM locations 8001h & 8002h. ORG 0000H MOV DPTR,#8000H MOVX A,@DPTR MOV B,A MUL AB INC DPTR

MOVX @DPTR,A MOV A,B INC DPTR MOVX @DPTR,A END PROGRAM TO FIND THE CUBE OF THE NUMBER Write an assembly language program in 8051 to find the cube of an 8-bit number, stored in external RAM location 8000h. Store the result in external RAM locations 8001h & 8002h. ORG 0000H MOV R1,#00H MOV DPTR,#8000H MOVX A,@DPTR MOV R1,A MOV B,A

MUL AB MOV B,R1 MUL AB INC DPTR MOVX @DPTR,A MOV A,B INC DPTR MOVX @DPTR,A END HEX COUNTER (00 TO FF) Write an assembly language program in 8051 to count from 00h to ffh with some delay in between the successive counts and update the count in internal RAM memory location 10h. ORG 0000H MOV A,#00H BACK:INC A

MOV 10H,A ACALL DELAY SJMP BACK DELAY:MOV R0,#OFH D3:MOV R2,#0FFH D2:MOV R1,#0FFH D1:NOP NOP NOP NOP DJNZ R1,D1 DJNZ R2,D2 DJNZ R0,D3 RET E:SJMP E END HEX COUNTER (0 TO F) Write an assembly language program in 8051 to count from 0h to fh with some delay in between the successive counts and update the count in internal RAM memory location 10h. ORG 0000H UP:MOV A,#00H BACK:MOV 10H,A

ACALL DELAY INC A CJNE A,#010H,BACK SJMP UP DELAY: MOV R0,#0FH D3:MOV R2,#0FFH D2:MOV R1,#0FFH D1:NOP NOP NOP NOP DJNZ R1,D1 DJNZ R2,D2 DJNZ R0,D3 RET E:SJMP E END DECADE COUNTER (0TO 9) Write an assembly language program in 8051 to count from 0 to 9 with some delay in between the successive counts and update the count in internal RAM memory location 10h.

ORG 0000H UP:MOV A,#00H BACK:MOV 10H,A ACALL DELAY ADD A,#01H CJNE A,#0AH SJMP UP DELAY:MOV R0,#0FH D3:MOV R2,#0FFH D2:MOV R1,0FFH D1:NOP NOP NOP NOP DJNZ R1,D1 DJNZ R2,D2 DJNZ R0,D3 RET E:SJMP E END BCD COUNTER (00TO 99)

Write an assembly language program in 8051 to count from 00 to 99 with some delay in between the successive counts and update the count in internal RAM memory location 10h. ORG 0000H MOV A,#00H BACK:DA A MOV 10H,A ACALL DELAY SJMP BACK DELAY:MOV R0,#0FH D3:MOV R2,#0FFH D2:MOV R1,0FFH D1:NOP NOP NOP NOP DJNZ R1,D1 DJNZ R2,D2 DJNZ R0,D3 RET E:SJMP E END

PROGRAM TO FIND THE NUMBER ONES AND ZEROS IN A GIVEN 8 BIT DATA Write an assembly language program in 8051 to count number of 1 s and 0 s in a given byte, stored in internal RAM location 40h. Store the count of 1 s in R 3 and count of 0 s in R 2. ORG 0000H MOV A,40H MOV R1,#08H MOV R2,#00H MOV R3,#00H UP:RLC A JNC L1 INC R3 SJMP L2 L1:INC R2 L2:DJNZ R1,UP MOV 41H,R2 MOV 42H,R3 END

PROGRAM TO FIND THE POSITIVE AND NEGATIVE NUMBERS IN A GIVEN ARRAY Write an assembly language program in 8051 to count positive and negative bytes in a given array of 8 bytes, stored in internal RAM locations from 50h onwards. Store the count of negative bytes in R 2 and count of positive bytes in R 1. ORG 0000H MOV R0,#50H MOV R1,#00H MOV R2,#00H MOV R3,#08H UP:MOV A,@R0 RLC A JC DOWN INC R1 SJMP L1 DOWN:INC R2 L1:INC R0 DJNZ R3,UP END

PROGRAM TO FIND THE ODD AND EVEN NUMBERS IN A GIVEN ARRAY Write an assembly language program in 8051 to count odd and even bytes in a given array of 8 bytes, stored in internal RAM locations from 50h onwards. Store the count of odd bytes in R 2 and count of even bytes in R 1. ORG 0000H MOV R0,#50H MOV R1,#00H MOV R2,#00H MOV R3,#08H UP:MOV A,@R0 RRC A JC DOWN INC R1 SJMP L1 DOWN:INC R2 L1:INC R0 DJNZ R3,UP END

PROGRAM TO CONVERT A PACKED BCD TO UNPACK BCD NUMBER Write an assembly language program in 8051 to convert a packed BCD number, stored in internal RAM location 40h, into ASCII numbers. Store the result in internal RAM locations 41h and 42h. ORG 0000H MOV A,40H ANL A,#0FH MOV 41H,A MOV A,40H ANL A,#0F0H SWAP A MOV 42H,A END

PROGRAM TO CONVERT ASCII NUMBER TO BCD NUMBER Write an assembly language program in 8051 to convert ASCII numbers, stored in internal RAM locations 40h and 41h, into two digit decimal number. Store the result in internal RAM location 42h. ORG 0000H MOV A,40H MOV R0,A MOV A,41H SUBB A,#30H SWAP A MOV R1, A MOV A,R0 SUBB A,#30H ADD A,R1 MOV 42H,A END

PROGRAM TO CONVERT A BCD NUMBER TO ASCII NUMBER Write an assembly language program in 8051 to convert a two digit decimal number, stored in internal RAM location 40h, into ASCII numbers. Store the result in internal RAM locations 41h and 42h. ORG 0000H MOV A,40H MOV R0,A ANL A,#0FH ADD A,#30H MOV 41H,A MOV A,R0 ANL A,#0F0H SWAP A ADD A,#30H MOV 42H,A END

PROGRAM TO CONVERT BCD NUMBER TO HEXADECIMAL Write an assembly language program in 8051 to convert a two digit decimal number, stored in internal RAM location 40h into hexadecimal number. Store the result in R 2. ORG 0000H MOV A,40H ANL A,#0FH MOV R1,A MOV A,40H ANL A,#0F0H SWAP A MOV B,#0AH MUL AB ADD A,R1 MOV R2,A END

PROGRAM TO CONVERT HEXADECIMAL NUMBER TO BCD NUMBER Write an assembly language program in 8051 to convert a hexadimal number, stored in internal RAM location 30h into decimal number. Store the result in internal RAM locations 50h and 51h. ORG 0000H MOV A,30H MOV R0,#40H MOV R2,#00H UP:MOV B,#0AH DIV AB MOV @R0,B CJNE A,02H,DOWN SJMP DOWN1 DOWN:INC R0 SJMP UP DOWN1:MOV A,41H SWAP A ADD A,40H MOV 50H,A

MOV 51H,B END RAMP WAVE #INCLUDE<REG51.H> SFR P0=0X80; SFR P1=0X90; VOID MAIN(VOID) VOLATILE UNSIGNED CHAR VALUE; WHILE(1); FOR(VALUE=0;VALUE<25;VALUE++) P0=VALUE; P1=VALUE;

SEVEN SEGMENT LED DISPLAY #INCLUDE<REG51.H> VOID DELAY(VOID); SBIT X=P1^1; SBIT Y=P1^0; VOID MAIN (VOID) UNSIGNED CHAR a[]=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f, 0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71; UNSIGNED CHAR M; X=1; Y=0; WHILE(1)

FOR(M=0;M<16;M++) P0=a[M]; DELAY(); VOID DELAY(VOID) UNSIGNED INT J,K; FOR(J=0;J<800;J++) FOR(K=0;K<360;K++); SINE WAVE #INCLUDE<REG51.H> #INCLUDE<STDIO.H> UNSIGNED CHAR SINE_VAL; UNSIGNED INT COUNT; VOID MS_DELAY(UNSIGNED CHAR R1); UNSIGNED CHAR SINE_TAB[48]=0x80,0x90,0xa1,0xb1,0xc0,0xcd,0xda,0xe5,0xee,0xf6,0xfb,0xfe, 0xff,0xfe,0xfb,0xf6,0xee,0xe5,0xda,0xcd,0xc0,0xb1,0xa1,0x90,0x80,0x70,0x5f,0x4 f,0x40,0x33,0x26,0x1b,0x12,0x0a,0x05,0x02,0x00,0x02,0x05,0x0a,0x12,0x1b,0x26,0x33,0x40,0x4f,0x5f,0x70; VOID MAIN(VOID)

WHILE(1) IF(COUNT<48) P0=SINE_TAB[COUNT]; P1=SINE_TAB[COUNT]; COUNR=COUNT++; ELSE COUNT=0; VOID MS_DELAY(UNSIGNED CHAR R1) WHILE(R1) R1--; PROGRAM TO FIND THE SMALLEST ELEMENT IN AN ARRAY ORG 0000H MOV R1,#05H MOV R0,#40H MOV A,@R0 UP:INC R0 MOV B,@R0 CJNE A,B,EXCH SJMP EXIT EXCH:JC UP XCH A,B

EXIT:DJNZ R1,UP END SQUARE WAVE #INCLUDE<REG51.H> VOID MAIN(VOID) VOID DELAY(INT); UNSIGNED CHAR CH=0x00; P0=0x00;

WHILE(1) P0=CH; DELAY(50); P0=~CH; DELAY(50); VOID DELAY(INT N) INT I; FOR( I=0;I<N;I++); STAIRCASE #INCLUDE <REG51.H> VOID DELAY (VOID); SFR P0=0X80; SFR P1=0X90; VOID MAIN(VOID)

UNSIGNED CHAR M; WHILE(1) FOR(M=0;M<255;M++) P0=M; P1=M; DELAY(); M=M+0X33; P0=M; P1=M; DELAY(); VOID DELAY(VOID) UNSIGNED INT I,J; FOR(I=0;I<10;I++) FOR(J=0;J<36;J++); STEPPER MOTOR(CLOCKWISE) #INCLUDE<REG51.H> VOID DELAY(); VOID MAIN(VOID)

UP:DELAY(); P2=0X99; DELAY(); P2=0XCC; DELAY(); P2=0X66; DELAY(); P2=0X33; DELAY(); GOTO UP; VOID DELAY() UNSIGNED INT X=10000,Y; FOR(Y=0;Y<=X;Y++) Y++; STEPPER MOTOR(ANTICLOCKWISE) #INCLUDE<REG51.H> VOID DELAY();

VOID MAIN(VOID) UP:DELAY(); P2=0X33; DELAY(); P2=0X66; DELAY(); P2=0XCC; DELAY(); P2=0X99; DELAY(); GOTO UP; VOID DELAY() UNSIGNED INT X=10000,Y; FOR(Y=0;Y<=X;Y++) Y++; TRIANGLE WAVE

#INCLUDE<REG51.H> SFR P0=0x80; SFR P1=0x90; VOID MAIN(VOID) UNSIGNED CHAR M,N; WHILE(1) FOR(M=254;M>0;M--) P0=M; P1=M; FOR(N=1;N<255;N++) P0=N; P1=N; MICROCONTROLLER OBJECTIVE TYPE 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 B.False Answer: Option A 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 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 C 8. 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 9. This statement will set the address of the bit to 1 (8051 Micro-controller): SETB 01H A.True B.False Answer: Option B 10. MOV A, @ R1 will: A.Copy R1 to the accumulator B. Copy the accumulator to R1 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

11. A label is used to name a single line of code. A.True B.False Answer: Option A 12. 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 13. 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 14. When the 8051 is reset and the line is HIGH, 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 A

15. 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 16. Both registers TL0 and TL1 are needed to start Timer 0. A.True B.False Answer: Option B 17. 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. 18. The last 96 locations in the internal data memory are reserved for general-purpose data storage and stack. A.True B.False Answer: Option A 19. Microcontrollers often have: A.CPUs B. RAM C.ROM D.all of the above

Answer: Option D 20. The 8051 has parallel I/O ports. A.2 B. 3 C.4 D. Answer: Option C 21. The total external data memory that can be interfaced to the 8051 is: A.32K C.128K B. 64K D.256K Answer: Option B 22. 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 23. Bit-addressable memory locations are: A.10H through 1FH B. 20H through 2FH C.30H through 3FH

D.40H through 4FH Answer: Option B 24. 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 25. 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 26. 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 27. This program code will be executed once: STAT: MOV A, #01H JNZ STAT A.True B.False

Answer: Option B 28. 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 29. Which of the following statements will add the accumulator to register 3? A.ADD @R3, @A B. ADD @A, R3 C.ADD R3, A D.ADD A, R3 Answer: Option C 30. Data transfer from I/O to external data memory can only be done with the MOV command. A.True B.False 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

A.True JNB P2.3, STAT 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. The end-of-conversion on the ADC0804 is done by using the: A. B. CS line C.INTR line D.V ref/2 line Answer: Option A 35. When the 8051 is reset and the 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 36. 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 37. 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 38. 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 39. 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 40. The contents of the accumulator after this operation MOV A,#02H MOV RO,#04H MUL A,RO

will be: A.02H C.06H B. 04H D.08H Answer: Option D 41. The following command will copy the accumulator to the location whose address is 23H: MOV 23H,A A.True B. False Answer: Option A 42. The special function registers can be referred to by their hex addresses or by their register names. A.True B.False Answer: Option A 43. The contents of the accumulator after this operation MOV A,#2BHORL A,00H will be: A.1B H B. 2B H C.3B H D.4B H Answer: Option B 44. The following program will cause the 8051 to be stuck in a loop: LOOP: MOV A, #00H

A.True JNZ LOP B.False Answer: Option B 45. 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 46. The statement CALL READ passes control to the line labelled READ. A.True B.False Answer: Option A 47. 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

48. The microcontroller is useful in systems that have nonvariable programs for dedicated applications. A.True B.False Answer: Option A 49. The total amount of external code memory that can be interfaced to the 8051 is: A.32K C.128K B. 64K D.256K Answer: Option B 50. The ADC0804 has resolution. A.4-bit C.16-bit B. 8-bit D.32-bit Answer: Option B 51. A HIGH on which pin resets the 8051 microcontroller? A.RESET C.PSEN B. RST D.RSET Answer: Option B 52. 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 53. 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 54. 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 55. 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