You are on page 1of 16

GONZALES CHACON ERLAND GUIDO

1/2021

1. _CONFIG _CP OFF& _WDT_OFF& _PWRTE_ON& _XT_OSC

LIST P=16F84A

#INCLUDE<P16F84A.INC>

#DEFINE OUT PORTA,0

ORG 0

goto configuration

ORG 4

goto interrupcion_INT

configuration

bsf STATUS,RP0

clrf PORTA

movlw 0xFF

movwf PORTB

movlw b'01000001'

movwf OPTION_REG

bcf STATUS,RP0

movlw b'10010000'

movwf INTCON

clrf PORTA

inicio_P

bsf OUT

call delay_500us

bcf OUT call delay_500us

goto inicio_P

interrupcion_INT

bsf OUT

call delay_750us

bcf OUT

call delay_250us
GONZALES CHACON ERLAND GUIDO
1/2021

btfsc PORTB,0 goto interrupcion_INT

bcf INTCON,INTF

bcf INTCON,INTF

retfie

delay_250us

movlw .193

movwf TMR0

bcf INTCON,T0IF

bucle

btfss INTCON,TOIF

goto bucle

return

delay_500us

movlw .130

movwf TMR0

bcf INTCON,T0IF

bucle1

btfss INTCON,T0IF

goto bucle1

return

delay_750us

movlw .68

movwf TMR0

bcf INTCON,T0IF

bucle2

btfss INTCON,TOIF

goto bucle2

return
END
GONZALES CHACON ERLAND GUIDO
1/2021

2.-

CONFIG _CP _OFF& MDT_OFF& PWRTE_ONs _XT_OSC

LIST P=16F84A

INCLUDE <P16F84A.INC>

CBLOCK 0x0C

contA

contB

contTMR0

Unidades

Decenas

Centenas

ENDC

ORG 0

goto configuración

ORG 4

goto interrupcion_TMR0

configuracion

bsf STATUS,RP0

clrf PORTB

movlw b'11000'

movwf PORTA

movlw b'00000111'

movwf OPTION_REG

bcf STATUS,RP0

movlw b'10100000'

movwf INTCON

movlw .60

movwf TMR0

clrf Unidades

clrf Decenas
GONZALES CHACON ERLAND GUIDO
1/2021

clrf Centenas

clrf PORTB

clrf contTMR0

inicio_P

ciclo

movf Centenas,W

call Tabla7SEG

movwf PORTB

bsf PORTA,2

call delay

bcf PORTA,2

call delay

movf Decenas,W

call Tabla7SEG

movwf PORTB

bsf PORTA,1

call delay

bcf PORTA,1

call delay

movf Unidades,W

call Tabla7SEG

movwf PORTB

bsf PORTA,0

call delay

bcf PORTA,0

call delay

goto ciclo

interrupcion_TMR0

incf contTMR0

movlw .2
GONZALES CHACON ERLAND GUIDO
1/2021

subwf contTMR0,W

btfss STATUS,Z

goto fin

call contador

fin

movlw .60

movwf TMR0

bcf INTCON,T0IF

retfie

contador

clrf contTMR0

incf Unidades

movlw .10

subwf Unidades,w

btfss STATUS ,Z

return

clrf Unidades

incf Decenas

movlw .10

subwf Decenas,w

btfss STATUS,Z

return

clrf Decenas

incf Centenas

movlw .10

subwf Centenas,w

btfss STATUS,Z

return

clrf Unidades

clrf Decenas
GONZALES CHACON ERLAND GUIDO
1/2021

clrf Centenas

return

delay

movlw .10

movwf contB

ciclo2

movlw .248

movwf contA

ciclo1

nop

decfsz contA,f

goto ciclo1

decfsz contB,f

goto ciclo2

return

Tabla7SEG

Asswf PCL,F

retlw .63

retlw .6

retlw .91

retlw .79

retlw .102

retlw .109

retlw .125

retlw .7

retlw .127

retlw .111

retlw .119

retlw .124

retlw .57
GONZALES CHACON ERLAND GUIDO
1/2021

retlw .94

retlw .121

retlw .113

END
GONZALES CHACON ERLAND GUIDO
1/2021

3.- __CONFIG _CP_OFF& _WDT_OFF& _PWRTE_ON& _XT_OSC

LIST P=16F84A

#INCLUDE <P16F84A.INC>

CBLOCK 0X0C

contA

contB

contTMR0

Unidades

Decenas

Centenas

ENDC

ORG 0

goto configuracion

ORG 4

goto interrupcion_TMR0

configuracion

bsf STATUS,RP0

clrf PORTB

movlw b'11000'

movwf PORTA

movlw b'00000111'

movwf OPTION_REG

bcf STATUS,RP0

movlw b'10100000'

movwf INTCON

movlw .60

movwf TMR0

clrf Unidades

clrf Decenas

clrf Centenas
GONZALES CHACON ERLAND GUIDO
1/2021

clrf PORTB

clrf conTMR0

inicio_P

ciclo

movf Centenas,W

call Tabla7SEG

movwf PORTB

bsf PORTA,2

call delay

bcf PORTA,2

call delay

movf Decenas,W

call Tabla7SEG

movwf PORTB

bsf PORTA,1

call delay

bcf PORTA,1

call delay

movf Unidades,W

call Tabla7SEG

movwf PORTB

bsf PORTA,0

call delay

bcf PORTA,0

call delay

goto ciclo

interrupcion_TMR0

incf contTMR0

movlw .2

subwf contTMR0_W
GONZALES CHACON ERLAND GUIDO
1/2021

btfss STATUS,Z

goto fin

call contador

fin

movlw .60

movwf TMR0

bcf INTCON,TOIF

retfie

contador

clrf contTMR0

incf Unidades

movlw .10

subwf Unidades,w

btfss STATUS,Z

return

clrf Unidades

incf Decenas

movlw .10

subwf Decenas,w

btfss STATUS,Z

return

clrf Decenas

incf Centenas

movlw .10

subwf Centenas,w

btfss STATUS,Z

return

clrf Unidades

clrf Centenas

clrf Decenas
GONZALES CHACON ERLAND GUIDO
1/2021

return

; Subrutina de retardo

delay

movlw .20

movwf contB

ciclo2

movlw .248

movwf contA

ciclo1

nop

decfsz contA,f

goto ciclo1

decfsz contB,f

goto ciclo2

return

Tabla7SEG

addwf PLC,F

retlw .63 ;0

retlw .6 ;1

retlw .91 ;2

retlw .79 ;3

retlw .102 ;4

retlw .109 ;5

retlw .125 ;6

retlw .7 ;7

retlw .127 ;8

retlw .111 ;9

retlw .119 ;A

retlw .124 ;B

retlw .57 ;C
GONZALES CHACON ERLAND GUIDO
1/2021

retlw .94 ;D

retlw .121 ;E

retlw .113 ;F

END
GONZALES CHACON ERLAND GUIDO
1/2021

4.- __CONFIG _CP_OFF& _WDT_OFF& _PWRTE_ON& _XT_OSC

LIST P=16F84A

#INCLUDE <P16F84A.INC>

CBLOCK 0X0C

contA

contB

contTMR0

Unidades

Decenas

ENDC

ORG 0

goto configuracion

ORG 4

goto interrupcion_TMR0

configuracion

bsf STATUS,RP0

clrf PORTB

movlw b'11000'

movwf PORTA

movlw b'00000111'

movwf OPTION_REG

bcf STATUS,RP0

movlw b'10100000'

movwf INTCON

movlw .60

movwf TMR0

clrf Unidades

clrf Decenas

clrf Centenas

clrf PORTB
GONZALES CHACON ERLAND GUIDO
1/2021

clrf conTMR0

inicio_P

ciclo

movf Decenas,W

call Tabla7SEG

movwf PORTB

bsf PORTA,1

call delay

bcf PORTA,1

call delay

movf Unidades,W

call Tabla7SEG

movwf PORTB

bsf PORTA,0

call delay

bcf PORTA,0

call delay

goto ciclo

interrupcion_TMR0

incf contTMR0

movlw .2

subwf contTMR0_W

btfss STATUS,Z

goto fin

call contador

fin

movlw .60

movwf TMR0

bcf INTCON,TOIF

retfie
GONZALES CHACON ERLAND GUIDO
1/2021

contador

clrf contTMR0

incf Unidades

movlw .10

subwf Unidades,w

btfss STATUS,Z

return

clrf Unidades

incf Decenas

movlw .10

subwf Decenas,w

btfss STATUS,Z

return

clrf Decenas

incf Centenas

movlw .10

subwf Centenas,w

btfss STATUS,Z

return

clrf Unidades

clrf Centenas

clrf Decenas

return

; Subrutina de retardo

delay

movlw .20

movwf contB

ciclo2

movlw .248

movwf contA
GONZALES CHACON ERLAND GUIDO
1/2021

ciclo1

nop

decfsz contA,f

goto ciclo1

decfsz contB,f

goto ciclo2

return

Tabla7SEG

addwf PLC,F

retlw .63 ;0

retlw .6 ;1

retlw .91 ;2

retlw .79 ;3

retlw .102 ;4

retlw .109 ;5

retlw .125 ;6

retlw .7 ;7

retlw .127 ;8

retlw .111 ;9

retlw .119 ;A

retlw .124 ;B

retlw .57 ;C

retlw .94 ;D

retlw .121 ;E

retlw .113 ;F

END

You might also like