Lectura de Teclado Con Pic 18f4550 Assembler
Lectura de Teclado Con Pic 18f4550 Assembler
Lectura de Teclado Con Pic 18f4550 Assembler
; CONFIG2H
CONFIG WDT = OFF
; Watchdog Timer Enable bit (WDT disabled
(control is placed on the SWDTEN bit))
CONFIG WDTPS = 32768
(1:32768)
org 0x00
goto configuracion
org 0x40
configuracion:
movlw b'01110011' ; configuracion frecuencia de reloj
movwf OSCCON ; configuracion frecuencia de reloj
movlw 0x0f ; configurar todos los puertos como digitales
movwf ADCON1 ; configurar todos los puertos como digitales
;movlw b'01110101' ; activar resistencias pull up
;movwf INTCON2 ; activar resistencias pull up
movlw b'11110000'
movwf TRISB
clrf TRISD
clrf PORTD
clrf PORTB
movlw b'10001000'
movwf INTCON
inicio:
movlw b'00001000'
movwf PORTB
movlw b'00000100'
movwf PORTB
movlw b'00000010'
movwf PORTB
movlw b'00000001'
movwf PORTB
goto inicio
columna1:
btfss PORTB,7
goto f21
movlw .7
movwf PORTD
f21:
btfss PORTB,6
goto f31
movlw .4
movwf PORTD
f31:
btfss PORTB,5
goto f41
movlw .1
movwf PORTD
f41:
btfss PORTB,4
goto finc1
movlw .10
movwf PORTD
finc1:
return
columna2:
btfss PORTB,7
goto f22
movlw .8
movwf PORTD
f22:
btfss PORTB,6
goto f32
movlw .5
movwf PORTD
f32:
btfss PORTB,5
goto f42
movlw .2
movwf PORTD
f42:
btfss PORTB,4
goto finc2
movlw .0
movwf PORTD
finc2:
return
columna3:
btfss PORTB,7
goto f23
movlw .9
movwf PORTD
f23:
btfss PORTB,6
goto f33
movlw .6
movwf PORTD
f33:
btfss PORTB,5
goto f43
movlw .3
movwf PORTD
f43:
btfss PORTB,4
goto finc3
movlw .11
movwf PORTD
finc3:
return
columna4:
btfss PORTB,7
goto f24
movlw .15
movwf PORTD
f24:
btfss PORTB,6
goto f34
movlw .14
movwf PORTD
f34:
btfss PORTB,5
goto f44
movlw .13
movwf PORTD
f44:
btfss PORTB,4
goto finc4
movlw .12
movwf PORTD
finc4:
return
org 0x08;interrupciones
movlw b'10001000'
movwf INTCON
btfss PORTB,3
goto c2
call columna1
c2:
btfss PORTB,2
goto c3
call columna2
c3:
btfss PORTB,1
goto c4
call columna3
c4:
btfss PORTB,0
goto fin
call columna4
fin:
retfie
end