;sonico1
	processor 16f84
	include	  <p16f84.inc>
	__config  _XT_OSC & _WDT_OFF & _PWRTE_ON

	CBLOCK	0XC
	cuenta
	R_Int
	R_Med
	R_Ext
	ENDC

#DEFINE	BANCO0	BCF	STATUS,RP0
#DEFINE	BANCO1	BSF	STATUS,RP0

	org	0x0
	movlw	0x0
	movwf	PORTB
	movwf	cuenta
	BANCO1
	movwf	TRISB
	BANCO0
pulso	btfss	PORTA,4
	goto	pulso
	call	crece
	goto	retraso
crece	incf	cuenta
	movfw	cuenta	
	movwf	PORTB
	return
retraso	movlw	0x4
	goto	SEG
SEG
	movwf	R_Ext
Peri	movlw	0xd9
	movwf	R_Med
Medio	movlw	0xff
	movwf	R_Int
Inter	decfsz	R_Int,f
	goto	Inter	
	decfsz	R_Med,f
	goto	Medio
	decfsz	R_Ext,f
	goto	Peri			
	goto	pulso
	end
