MICROPROCESSOR TECHNOLOGY LAB TEST 2

Test Instructions
1.
Duration of test: 1 hr
2.
Open Book Test. However, no computer storage media and communication devices are allowed.

 

QUESTION 1 (70 MARKS)

The program shown is a 1-sec stop watch timer with two push buttons; a start and a stop button. When the program is executed, it does not work as it should.

Debug the program and show the working program to your examiner.

 

QUESTION 2 (30 MARKS)

Modify the program to have a third button to reset the stop watch to "0".

; Stop Watch
$include (c8051f200.inc)
EXTRN CODE (STARTUP)
  CSEG AT 0000H
LJMP MAIN
CSEG AT 90H
LUT: DB 3FH
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 27H
DB 7FH
DB 6FH
CSEG AT 100H
MAIN: LCALL STARTUP
SETB P0.2
SETB P0.3
MOV R2,#0
MOV TMOD,#10H
SETB TR1
MOV DPTR,#LUT
M1: MOV R7,#0H
M2: MOV A,R7
MOVC A,@A+DPTR
MOV P1,A
LCALL DELAY
B1:
JB P0.2,B2
MOV R2,#0
B2: JB P0.3,B3
MOV R2,#0
B3: CJNE R2,#1,B1
INC R7
CJNE R7,#10,M2
SJMP M1
DELAY: MOV R1,#40D
D1: MOV TH1,#3CH
MOV TL1,#0B0H
D2:

JNB TF1,D2
CLR TF1
DJNZ R1,D1
RET
END