You are on page 1of 6

Esquema circuital realizado en proteus 8

Programa realizado en mplab 10 , leguaje de programacin assembler


list P=18F4550
include <P18F4550.INC>
; CONFIG1H
CONFIG FOSC = INTOSCIO_EC ; Oscillator Selection bits (Internal
oscillator, port function on RA6, EC used by USB (INTIO))
CONFIG FCMEN = OFF
Clock Monitor disabled)

; Fail-Safe Clock Monitor Enable bit (Fail-Safe

CONFIG IESO = OFF


; Internal/External Oscillator Switchover bit
(Oscillator Switchover mode disabled)

; 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

; Watchdog Timer Postscale Select bits

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

You might also like