crono

download crono

If you can't read please download the document

description

contador de 0 a 99

Transcript of crono

TRISA EQU 0x85PORTA EQU 0x05TRISB EQU 0x86PORTB EQU 0x06STATUS EQU 0x03UNIDADES EQU 0x0CPDel0 EQU 0x0DPDel1 EQU 0x0EPDel2 EQU 0x0FDECENA EQU 0x10BSF STATUS,5 ; Acceso al Banco 1.MOVLW b'00010000'MOVWF PORTACLRF PORTB ; Las lneas del Puerto B se configuran como salida.BCF STATUS,5;CLRF UNIDADESCLRF DECENACLRF PORTBBOTONBTFSC PORTA,4GOTO INCREMENTOGOTO DECREMENTOINCREMENTO ;RUTINA PARA EL INCREMENTOCALL MOSTRARMOVF UNIDADES,0INCF UNIDADESXORLW b'00001001'BTFSC STATUS,2GOTO REINICIA_UPGOTO BOTONREINICIA_UPCLRF UNIDADESINCF DECENAMOVF DECENA,0XORLW b'00001010'BTFSC STATUS,2GOTO REINICIAD_UPGOTO BOTONREINICIAD_UPCLRF DECENAGOTO BOTONRETRUN;-------------------------------------------------------------PDelay movlw .14 ; 1 set number of repetitions (C) movwf PDel0 ; 1 |PLoop0 movlw .72 ; 1 set number of repetitions (B) movwf PDel1 ; 1 |PLoop1 movlw .247 ; 1 set number of repetitions (A) movwf PDel2 ; 1 |PLoop2 clrwdt ; 1 clear watchdog decfsz PDel2, 1 ; 1 + (1) is the time over? (A) goto PLoop2 ; 2 no, loop decfsz PDel1, 1 ; 1 + (1) is the time over? (B) goto PLoop1 ; 2 no, loop decfsz PDel0, 1 ; 1 + (1) is the time over? (C) goto PLoop0 ; 2 no, loopPDelL1 goto PDelL2 ; 2 cycles delayPDelL2 clrwdt ; 1 cycle delay return ; 2+2 Done;-------------------------------------------------------------END