This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Infinite trend cycles AJMP

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
;      SI PULSAMOS P1.0 TENEMOS UNA ONDA CUADRADA
;         CONTROLADA POR EL FLAG DE SU TMR DE <6 HZ A 26 kHz>
;           LA RUTINA LIMPIA LA BANDERA TF1    
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		



		ORG	00H
        USING	00H


		MOV	IE,10001111B	// IE (EA+TMR0+)	
		MOV	088H,01011111B	// TCON - START/STOP TMRs
		MOV	091H,11111000B	// TCONB  | PSC	| PWM
		MOV	089H,00001000B	// TMOD | (13 bits)                  
		MOV	08FH,00000000B	// CLKREG | TPS / CDV
		
		MOV	0BFH,#00000000B	// P4M1
		MOV	0BEH,#00000000B	// P4M0
		MOV	0C7H,#00000000B	// P3M1
		MOV	0C6H,#00000000B	// P3M0
		MOV	0C5H,#00000000B	// P2M1
		MOV	0C4H,#00000000B	// P2M0
		MOV	0C3H,#00000000B	// P1M1
		MOV	0C2H,#00000001B	// P1M0		


CUADRADA:	SETB	P1.6
		    ACALL	TIEMPO
		    CLR	P1.6
		    ACALL	TIEMPO
PULSA:		JB	P1.0,PULSA	// Captura pulsación
		    SJMP	CUADRADA


TIEMPO:		MOV	TL1,#000H
		    MOV	TH1,TL1
		    SETB	TR1
AQUI1:		JNB	TF1,AQUI1	// Rearma FLAG TMR_0
		    CLR	TF1
		    CLR	TR1
		    RET
		
		    END

Can someone tell me why two routines cannot be executed in closed loop? I already introduced the DJNZ instruction for not using an AJMP, which is a closed loop tending to infinity and maybe the processor core could not get out of the loop.