MCS-51 single chip computer test questions and answers

Publisher:Yinyue1314Latest update time:2015-12-22 Source: eefocusKeywords:MCS-51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Questions 
1. Fill in the blanks (1 point for each blank, 10 points in total)

  1. When using 8031 ​​microcontroller, it is necessary to expand the external program memory. In this case, EA should be _________.

  2.P0 is usually used as _________.

  3. If RS1 and RS0 are set to 10 by the program, the direct address of the working registers R0 to R7 is _________.

  4. The return address (or breakpoint) is the contents of the program counter of _________.

  5. The central processing unit (CPU) is the core of the microcontroller, and it completes _________.

  6. The working process of a single-chip microcomputer is actually _________.

  7. The so-called interrupt source is _________.

  8. A port (or port) is _________.

  9. The transmission signal during asynchronous serial short-range communication is _________.

  10. If the data in accumulator A is 01110010B, then P in PSW = _________.

  II. Single-choice questions (Select one correct answer from the four alternative answers for each question and fill in the correct answer number in the brackets of the question stem. Each question is worth 1 point, for a total of 10 points)

  1.The reset signal of MCS-51 microcontroller is (   ) valid.

  A. High level   B. Low level   C. Pulse   D. Falling edge

  2. If the MCS-51 microcontroller uses a crystal oscillator frequency of 6MHz, its reset duration should exceed (   ).

  A.2μs   B.4μs   C.8μs   D.1ms

  3. If PSW.4=0, PSW.3=1, to push the contents of register R0 into the stack, you should use the (   ) instruction.

  A. PUSH   R0   B. PUSH   @R0

  C. PUSH   00H   D. PUSH   08H

  4. The read-only memory that can use ultraviolet light to erase the program in ROM is called (   ).

  A. Mask ROM   B. PROM   C. EPROM   D. EEPROM

  5. To expand a 2764 program memory chip outside the chip, you need to (   ) address lines.

  A.8B.13C.16D.20  ​  ​  

  6.Timer/counter working mode 1 is (   ).

  A. 8-bit counter structure   B. 2 8-bit counter structure

  C. 13-bit counting structure   D. 16-bit counting structure

  7. If the crystal oscillator frequency of the MCS-51 microcontroller is 12MHz, when the timer is used as a counter, its maximum input counting frequency should be (   )

  A.2MHz   B.1MHz   C.500KHz   D.250KHz

  8. Given a common cathode LED display, where segment a is the lowest bit of the glyph code, if the number 1 needs to be displayed, its glyph code should be (   ).

  A.06H   B.F9H   C.30H   D.CFH

  9. In the following table of data word definitions, (   ) is wrong.

  A.DW "AA"   B.DW "A"

  C.DW "OABC"   D.DWOABCH

  10. In the serial port control register SCON, the function of REN is (   ).

  A. Receive interrupt request flag   B. Send interrupt request flag

  C. Serial port allows receiving bit   D. Address/data bit

  3. Short answer questions (4 points for each question, 20 points in total)

  1. Briefly describe the stack.

  2. Briefly describe the displacement addressing method and give examples.

  3. Briefly describe the main contents of interrupt response.

  4. Briefly describe the rules for labels in assembly language

  5. There are several ways to transmit data converted by A/D converter.

  IV. Reading procedures (4 points for each question, 20 points in total)

  1. After executing the first instruction in the following program segment, (1) (P1.7) = ____   (P1.3) = _____, (P1.2) = _________; after executing the second instruction, (2) (P1.5) = _________, (P1.4) = _________, (P1.3) = _________.

  ANL   P1, #73H

  ORL   P1, #38H

  2. After the following program segments are executed, (A) = _________, (B) = _________.

  MOV   A, #0FBH

  MOV   B, #12H

  DIV   AB

  3. After the following program segment is executed, (R0) = _________, (7EH) = _________, (7FH) = _________.

  MOV   R0, #7FH

  MOV   7EH, #0

  MOV   7FH, #40H

  DEC   @R0

  DEC   R0

  DEC   @R0

  4. Given that (SP) = 09H, (DPTR) = 4567H, after executing the following instructions, (SP) = _________, internal RAM (0AH) = _________, (0BH) = _________

  PUSH   DPL

  PUSH   DPH

  5. The number annotated in the following program is the number of machine cycles required to execute the instruction. If the crystal oscillator frequency of the microcontroller is 6MHz, how long does it take to execute the following program?

  MOV R3,#100;1

  LOOP: NOP   ; 1

  NOP

  NOP

  DJNZ   R3, LOOP   ; 2

  RET    2

  5. Programming questions (4 points for each question, 20 points in total)

  1. Please use bit operation instructions to implement the following logical operations:

  P1.5=ACC.2∧P2.7∨ACC.1∧P2.0

  2. There are 10 bytes of data in the data table with the first address of the external RAM as TABLE. Please program to set the highest bit of each byte to 1 unconditionally.

  3. It is known that the internal RAM   30H unit starts to store 20H data, and it is transferred to the storage area starting from the 0000H unit of the external RAM. Please implement it through programming.

  4. It is known that the sum of 8 unsigned numbers is stored in R3R4. Find their average value. The result is still stored in R3R4. Please implement it through programming (R3 is the high byte).

  5. Two strings are stored in the internal RAM with the first address of 42H and 52H respectively, and the string length is placed in the 41H unit. Please program to compare the two strings. If they are equal, send the number 00H to the 40H unit, otherwise send 0FFH to the 40H unit.

  VI. Comprehensive application questions (10 points for each question, 20 points in total)

  1. Use an 8031 ​​microcontroller and one 2716 (2KB) and one 6116 (2KB) to form an expansion system with both program memory and data memory. Please:

  (1) Draw a logic circuit diagram

  (2) Description of its storage space

  2. As shown in the figure, the D/A converter DAC   0832 has a port address of 7FFFH, an op amp power supply of +5V, Vref = +5V,

  (1) Draw a single buffer interface circuit

  (2) Programming to generate a positive sawtooth wave

 

Answer

   1. Fill in the blanks (1 point for each blank, 10 points in total)

  1. Low level

  2. The address/data bus of the microcontroller system

  3.10H~17H

  4. During program interruption or subroutine call

  5. Calculation and control functions

  6. The process of fetching and executing instructions over and over again

  7. Cause of the interrupt (or source that can issue an interrupt request)

  8. Registers in the interface circuit that have been addressed and can be read or written

  9.TTL level signal

  10.0

  II. Single-choice questions (1 point for each question, 10 points in total)

  1.A   2.B   3.D   4.C   5.B

  6.D   7.C   8.A   9.C   10.C

  3. Short answer questions (4 points each, 20 points in total)

  1. (1) A RAM area set up to protect the return address (breakpoint) and the context when a program is interrupted or a subroutine is called.

  (2) Use MOV SP, #STK instructions to create a stack.

  (3) Data is stored according to the "last in, first out" principle.

  (4) Use the PUSH and POP instructions to perform stack push and pop operations.

  2. (1) Displacement addressing uses DPTR or PC as the base register and accumulator A as the index register, with the 16-bit address in the form of the sum of the two contents as the operand address.

  (2) Displacement addressing can only address fixed memory, and there are only three instructions:

  MOVC A, @A+DPTR

  MOVC A, @A+PC

  JMP @A+DPTR

  The first two are table lookup instructions, and the last one is an unconditional transfer instruction.

  3. The hardware automatically generates a call instruction LCALL to transfer to the interrupt service. The specific operations are:

  (1) Push the contents of the program counter PC (breakpoint) onto the stack

  (2) Load the interrupt entry address into PC and execute the interrupt service routine

  4. (1) The label consists of 1 to 8 characters, and the first character must be a letter.

  (2) Symbols defined in assembly language cannot be used.

  (3) The label must be followed by a colon:

  (4) The same label can only be defined once in a program.

  5. (1) Timing transmission mode: After A/D is started, the data can be read after calling the delay program with a delay time greater than the conversion time.

  (2) Query method: After the A/D is started, query the EOC (conversion end signal) and read the conversion data once the conversion is completed.

  (3) Interrupt mode: Use EOC as the external interrupt request signal. Once the conversion is completed, an interrupt is caused to read the conversion data.

  IV. Reading procedures (4 points for each question, 20 points in total)

  1. (1) (P1, 7) = 0, (P1.3) = 0, (P1.2) = 0

  (2) (P1.5)=1, (P1.4)=1, (P1.3)=1

  2. (A) = 0DH (or 13)

  (B) = 11H (or 17)

  3. (R0)=7EH, (7EH)=FFH, (7FH)=3FH

  4. (SP) = 0BH

  (0AH) = 67H

  (0BH) = 45H

  5. One machine cycle is 2μs

  The time required to execute the program is T = 2μs*(5×100+3) = 1006μs≈1ms

  5. Programming questions (4 points each, 20 points in total)

  1. Perform the AND operation first, then the OR operation. The procedure is as follows:

  MOV   C, ACC.1

  ANL   C,P2,0

  MOV   12H, C

  MOV, C, A   CC.2

  ANL   C, P2.7

  ORL   C, 12H

  MOV   P1.5, C

  RET

  2.   MOV   R2, #10

  MOV   DPRT, #TABLE

  LOOP:   MOV    A, @DPRT; take a number

  ORL   A, #80H; highest position 1

  MOV    @DPTR, A; write back to the original address

  1NC   DPTR; process the next unit

  DJNZ   R2, LOOP

  RET

  3.   MOV   R0, #30H

  MOV   R1, #00H

  MOV   R2, #20H

  LOOP: MOV   A, @R0; get data

  MOV    @R1, A; store data

  1NC   R0

  1NC   R1

  DJNZ R2, LOOP

  RET

  4. Use the shift instruction to perform the division by 8 operation. The procedure is as follows:

  MOV   R2, #3

  LOOP: CLR   C

  MOV   A, R3

  RRC    ; high byte is divided by 2, the last bit is shifted into C, and the high bits are filled with 0

  MOV   R3, A   ; temporarily store high byte

  MOV   A, R4

  RRC    ; The low byte is divided by 2, and the last bit of the high byte is shifted into the high bit of the low byte

  MOV   R3, A

  DJNZ R2, LOOP

  RET

  5. If one byte is different, the entire string is not equal. If all bytes are equal, the two strings are equal.

  MOV   R0, #42H

  MOV   R1, #52H

  LOOP: MOV   A, @R0

  CLR    ; not equal, FFH→40H

  SUBB A, @R1

  JNZ   LOOP1   ; When equal, compare the next byte

  INC   R0

  INC   R1

  DJNZ   41H, LOOP

  MOV   40H, #0   ; If all characters are equal, the two strings are equal.

  RET

  LOOP1: MOV   40H, #0FFH

  RET

  VI. Comprehensive application questions (10 points each, 20 points in total)

  1. (1) Logic diagram

  (2) Address:

  Chip P2.2 P2.1 P2.0 P0.7 …… P0.0 address range

  2716 0 0 0 0 … 0 0000H

  …

  1 1 1 1 … 1 07FFH

  6116 0 0 0 0 … 0 0000H

  1 1 1 1 … 1 07FFH

  2. (1)

  (2) Procedure

  DASAW: MOV   DPTR, #7FFFH

  MOV, A, #0

  LOOP:MOVX   @DPRT,A

  1NC   A

  NOP

  AJMP   LOOP

Keywords:MCS-51 Reference address:MCS-51 single chip computer test questions and answers

Previous article:C51 MCU serial communication points
Next article:MCS-51 MCU Memory Structure

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号