QUESTION 1
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
Modify the program to have a third button to reset the stop watch to "0".
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
Modify the program to have a third button to reset the stop watch to "0".
Rich (BB code):
; 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 100HMAIN:LCALL STARTUP
SETB P0.2
SETB P0.3
MOV R2,#0
MOV TMOD,#10H
SETB TR1
MOV DPTR,#LUTM1:MOV R7,#0HM2:MOV A,R7
MOVC A,@A+DPTR
MOV P1,A
LCALL DELAYB1:
JB P0.2,B2
MOV R2,#0B2:JB P0.3,B3
MOV R2,#0B3:CJNE R2,#1,B1
INC R7
CJNE R7,#10,M2
SJMP M1DELAY:MOV R1,#40DD1:MOV TH1,#3CH
MOV TL1,#0B0HD2: JNB TF1,D2
CLR TF1
DJNZ R1,D1
RET
END
Last edited by a moderator: