TESTS-for Single-Chip-Microcomputer

  • 格式:doc
  • 大小:2.65 MB
  • 文档页数:19

第1页/共19页 山东科技大学2007—2008 学年第二学期 《单片机》考试试卷(A卷)

班级 姓名 学号

PRACTICE EXAMINATION No Question Answer SECTION A (Total marks 19)

(Marking scheme: +1 mark for correct answer; -1 for incorrect; 0 for no answer) Write T (true) or F (false) in the answer column each of the following statements 1 An 8031 microcontroller has EPROM memory. 2 In the 8051 RAM there are 16 bytes of bit-addressable memory. 3 In a PUSH operation the Stack Pointer is decremented. 4 On Reset, Port 0 is set to FFh. 5 Accumulator A has a direct address. 6. When using MUL the high byte of the result is put into B. 7 When RETI is executed the Return Address is Popped off the stack. 8 To start Timer 0 running, TF0 must be set. 9 Timer Mode 0 is an 8-bit auto-reload mode. 10 If EA is set, then all interrupts will always be enabled. 11 The DB pseudo-instruction will place data bytes in memory. 12 XON-XOFF handshaking requires only two connection wires and ground. 13 The RS232 logic levels are: logic 0 = +12 V; logic 1 = -12 V. 14 In memory expansion the latch is used to hold the upper address byte. 15 The 8255A chip provides 24 lines of input/output. 16 EOC on the ADC0809 chip means End Of Conversion. 17 The DAC0823 chip requires the addition of an operational amplifier. 18 Liquid crystals can change the polarization of a light wave. 19 The step angle of a stepper motor can be doubled by half-stepping.

题号 A B C 总得分 评卷人 审核人 1 2 3 4 5 6

得分 第2页/共19页

No Question Answer SECTION B (Total 16 marks) (Marking scheme: +2 marks for correct answer; -1 for incorrect; 0 for no answer) Write A, B, C or D in the Answer column 20 If MA=0500h, What is the content of the PC after running the instruction MA: LCALL 8192h ? (LCALL instruction is a 3-byte instruction) A. 0500h B.0503h C.8192h D.8195h

21 Which instruction would move data from the address A9h in RAM? A: MOVC (indirect) B: MOV (direct) C: MOVX (indirect) D: MOV (indirect) 22 What is the highest address in a memory system with 16 data lines? A: 65534 B: 65535 C: 65536 D: 63357 23 What voltage on the RESET pin will cause a Reset to occur? A: High level B: High then low C: Low then high D: Low level 24 Where is the stack located? A: SFRs B: External RAM C: CPU D: Internal RAM 25 For which type of arithmetic can we use decimal adjust ? A. Add & subtract B. Multiply & divide C. Only add D. Only subtract

26 Which instruction will clear the low nibble of A if A = 0C5h? A. SWAP A B. ORL A,#0Fh C: XRL A,#0FFh D. ANL A,#0F0h 27 Which of the following instructions will select register bank 3 ? A: MOV PSW,#13h B: MOV PSW,#18h C: SETB RS1 CLR RS0 D: SETB RS0 CLR RS1

SECTION C (Total 35 marks) Fill in the blank spaces in the following assembly language programs for the 8051 28 Task: Calculate the square of the numbers (ranging from 0 to 10) stored in addresses 30h to 3Fh respectively. Put the results in the corresponding addresses in the 50h – 5Fh range. Program: MOV R0, _________ ; Put the first source address in R0 MOV R1, _________ ; Put the first destination address in R1 MOV R3, #16 ; Put the total number in R3 NEXT:MOV A, __________ ; Copy the number to A using indirect addressing MOV DPTR, ________ ; Put the address of TABLE into the DPTR ______ A, @A+DPTR ;Look up the square of the number 第3页/共19页

MOV ________, A ; Save the result using indirect addressing ________ R0 ; Increment the source address ________ R1 ;Increment the destination address ________ R3, NEXT ; SJMP $ TABLE: DB 00,01,04,09,16,25,36,49,64,81,100 29 Task: Change the low nibble at the address given in register R0 to ASCII code, putting the result in location 36h.: Program:- HTOASC: MOV A, ________ ; Copy the value to A ________ A, #0Fh ; Mask off the high nibble _______ ACC ; Push the value to the stack CLR _____ ; ; Reset the carry flag SUBB A, ________ ;Compare A and 10 POP ACC _______ LOOP ADD A,#07h ; If >= 10,then add 37h LOOP: ADD A,#30h ; If lower than 10 then add 30h MOV ______, A ;Save the result RET ;Return from subroutine

30 Task: Timer 0 uses interrupts to count up to 1000 before overflowing and resetting Port 1 pin 0. fosc=12MHz:- Program: ORG 0000h AJMP _______ ORG ________ ; ISR for Timer 0 AJMP COUNT START: MOV TMOD, ________ ;Counter 0,Mode 1 SETB P1.0 ; Set port1 pin 0 SETB ________ ; Enable all interrupts SETB ________ ; Enable Counter 0 MOV TH0, _________ ; Preload Counter MOV TL0, _________ SETB ________ ;Start Counting SJMP ________ ; Waiting for interrupts COUNT :________ P1.0 ; Reset port1 pin 0 ________ ;Return from interrupt