Programa asm de un temporizador en pìc 18f452

Solo disponible en BuenasTareas
  • Páginas : 7 (1516 palabras )
  • Descarga(s) : 0
  • Publicado : 9 de noviembre de 2010
Leer documento completo
Vista previa del texto
list p=18f452
#include<p18f452.inc>

CBLOCK 0X0a
jj
kk
respaldo
mm
aa
bb
cc
dd
ee
decimas
u_seg
d_seg
u_min
d_min
temp
st
in
endc
org 0x00
goto inicio
org 0x08
goto interrupcion

org 0x0c
tabla
mullw d'2'
movf PRODL,w
addwf PCL,f
retlw '0'
retlw '1'
retlw '2'
retlw '3'
retlw '4'
retlw '5'
retlw '6'
retlw '7'
retlw '8'
retlw '9'inicio
movlw d'0'
movwf TRISD
movlw d'0'
movwf TRISC
movlw b'11110000'
movwf TRISB

clrf PORTC
clrf PORTD
clrf PORTB

movlw b'00110000'
call R_I
call R_1

movlw b'00110000'
call R_I
call R_2

movlw b'00110000'
call R_I
call R_3

movlw b'00111000'
call R_I

movlw b'00001100'
call R_I

movlw b'00000001'
call R_I


call mensaje

bcfINTCON2,7
movlw b'00001111'
movwf PORTB
movf PORTB,f

movlw b'10101000'
movwf INTCON

movlw d'0'
movwf T0CON

lazo

bcf PORTB,0
nop
nop
bsf PORTB,0
bcf PORTB,1
nop
nop
bsf PORTB,1
bcf PORTB,2
nop
nop
bsf PORTB,2
bcf PORTB,3
nop
nop
bsf PORTB,3
goto lazo

mensaje
movlw b'00000001'
call R_I

movlw d'5'
movwf aa
movlw d'9'movwf bb
movlw d'5'
movwf cc
movlw d'9'
movwf dd
movlw d'9'
movwf ee
bcf st,0

movlw d'0'
movwf mm

movlw 'T'
call R_E
movlw '.'
call R_E
movlw 'R'
call R_E
movlw 'E'
call R_E
movlw 'S'
call R_E
movlw 'T'
call R_E
movlw '.'
call R_E

movlw d'137'
call R_I

movlw '0'
call R_E
movlw '0'
call R_E
movlw ':'
call R_E
movlw '0'
call R_Emovlw '0'
call R_E
movlw ':'
call R_E
movlw '0'
call R_E

movlw d'192'
call R_I

movlw 'T'
call R_E
movlw '.'
call R_E
movlw 'T'
call R_E
movlw 'R'
call R_E
movlw 'A'
call R_E
movlw 'N'
call R_E
movlw 'S'
call R_E
movlw '.'
call R_E

movlw d'201'
call R_I

movlw '0'
call R_E
movlw '0'
call R_E
movlw ':'
call R_E
movlw '0'call R_E
movlw '0'
call R_E
movlw ':'
call R_E
movlw '0'
call R_E

return

interrupcion
movff PORTB,respaldo
btfsc INTCON,0
goto rebote
btfsc INTCON,5
goto conteo
goto volver
rebote
call R_1
btfss PORTB,7
goto rebote
btfss PORTB,6
goto rebote
btfss PORTB,5
goto rebote
btfss PORTB,4
goto rebote
btfss respaldo,7
goto f1
btfss respaldo,6
goto f2btfss respaldo,5
goto f3
btfss respaldo,4
goto f4
goto volver

f1
incf mm,f
btfss respaldo,3
goto c11
btfss respaldo,2
goto c12
btfss respaldo,1
goto c13
btfss respaldo,0
goto c14
goto volver
f2
incf mm,f
btfss respaldo,3
goto c21
btfss respaldo,2
goto c22
btfss respaldo,1
goto c23
btfss respaldo,0
goto c24
goto volver

f3
incf mm,f
btfssrespaldo,3
goto c31
btfss respaldo,2
goto c32
btfss respaldo,1
goto c33
btfss respaldo,0
goto c34
goto volver
f4
incf mm,f
btfss respaldo,3
goto c41
btfss respaldo,2
goto c42
btfss respaldo,1
goto c43
btfss respaldo,0
goto c44
goto volver

c11
movlw d'6'
cpfslt mm
goto volver
movlw d'1'
movwf temp
call tabla
goto datos
c12
movlw d'6'
cpfsltmm
goto volver
movlw d'2'
movwf temp
call tabla
goto datos
c13
movlw d'6'
cpfslt mm
goto volver
movlw d'3'
movwf temp
call tabla
goto datos
c14
bcf T0CON,7
call mensaje
goto volver
c21
movlw d'6'
cpfslt mm
goto volver
movlw d'4'
movwf temp
call tabla
goto datos
c22
movlw d'6'
cpfslt mm
goto volver
movlw d'5'
movwf temp
call tabla
gotodatos
c23
movlw d'6'
cpfslt mm
goto volver
movlw d'6'
movwf temp
call tabla
goto datos
c24
btfsc st,0
bsf T0CON,7
decf mm,f
goto volver

c31
movlw d'6'
cpfslt mm
goto volver
movlw d'7'
movwf temp
call tabla
goto datos
c32
movlw d'6'
cpfslt mm
goto volver
movlw d'8'
movwf temp
call tabla
goto datos
c33
movlw d'6'
cpfslt mm
goto...
tracking img