<b>
;	Subject: trouble in stopping the timer
;	Full Name: Ghulam Mustafa (Karachi Pakistan)
;	Date: 06/17/06 09:53 
;	Read: 1 times-- Printable Version 
;	Score: Hasn't been scored  
;	Hello, 
;	i am working on a porgram in which i have to use the 
;	timer to count the duration of an event and when the 
;	event completes it stop counting it for this purpose 
;	i made a program but in it i am getting trouble to 
;	make the timer stop counting. 
;
;	The problem is that as long as the P0.0 is low it 
;	stops counting but as it goes high again it starts 
;	counting again. But you can see that i have 
;	dissabled all the intrupts. 
;	Please tell me how could i solve this problem. 
;	Thanks 
;
;	here is the program 

ORG 000H 
RESET1:
	JMP MAIN 

ORG 00BH 
TIMER0:
	JMP RPM 

ORG 030H 
MAIN: 
	MOV TMOD,#01H 
	MOV TH0,#HIGH(-1000)	; 0xFC 
	MOV TL0,#LOW(-1000) 	; 0x18
	SETB EA 
	SETB ET0 
	JNB P0.0,$ 
	SETB TR0 
	JB P0.0,$ 
	CLR EA 			; Intrupt disabbled as p0.0 goes low 
	CLR ET0 
	CLR TR0 
	JMP DISPLAY 

RPM: 
	MOV TH0,#HIGH(-1000) 
	MOV TL0,#LOW(-1000) 
	INC R0 			; value is increamented in R0 
	RETI 

DISPLAY: 
	MOV P1,R0 
	SJMP $                  ; Your program need this!!!
END

Hex Listing
:02000000802E50
:02000B00804033
:10003000758901758CFC758A18D2AFD2A93080FD04
:10004000D28C2080FDC2AFC2A9C28C8008758CFC06
:09005000758A180832889080FEC0
:00000001FF

</b>