Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list p=18f4620 r=DEC
- #include <p18f4620.inc>
- leido equ 0x21
- entrada equ 0x20
- config OSC = INTIO67, FCMEN = OFF, IESO = OFF ;// CONFIG1H
- config PWRT = OFF, BOREN = OFF, BORV = 0 ;// CONFIG2L
- config WDT = OFF, WDTPS = 32768 ;// CONFIG2H
- config MCLRE = ON, LPT1OSC = OFF, PBADEN = OFF, CCP2MX = PORTC ;// CONFIG3H
- config STVREN = ON, LVP = OFF, XINST = OFF ;// CONFIG4L
- config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF ;// CONFIG5L
- config CPB = OFF, CPD = OFF ;// CONFIG5H
- config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF ; // CONFIG6L
- config WRTB = OFF, WRTC = OFF, WRTD = OFF ; // CONFIG6H
- config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF ;// CONFIG7L
- config EBTRB = OFF
- org 0x0000
- goto main
- ;CONFIGURACION DE ENTRADA
- main
- movlw h'0F' ; Configuramos todos los pines como digitales
- movwf ADCON1
- movlw b'11111111' ; configura los bits RA7-RA0 del puerto A
- movwf TRISA
- clrf TRISB ;pongo todo en 0 el PUERTO B
- clrf TRISC ;pongo todo en 0 en el PUERTO C
- clrf TRISD ;pongo todo en 0 en el PUERTO D
- goto inicio ;SALTO A LA ETIQUETA
- conversorBinDec
- movff PORTA, entrada
- movf entrada, W
- btfsc STATUS, Z ; Z = 1 ? Consulta si es 0 (cero)
- call Cero ; 0
- movwf leido ; Mueve el valor de W a leido y comienza a decrementarlo
- decf leido ; hasta que llegue a 0 el que de cero es el valor a representar
- btfsc STATUS, Z
- call Uno ; 1
- decf leido
- btfsc STATUS, Z
- call Dos ; 2
- decf leido
- btfsc STATUS, Z
- call Tres ; 3
- decf leido
- btfsc STATUS, Z
- call Cuatro ; 4
- decf leido
- btfsc STATUS, Z
- call Cinco ; 5
- decf leido
- btfsc STATUS, Z
- call Seis ; 6
- decf leido
- btfsc STATUS, Z
- call Siete ; 7
- decf leido
- btfsc STATUS, Z
- call Ocho ; 8
- decf leido
- btfsc STATUS, Z
- call Nueve ; 9
- decf leido
- btfsc STATUS, Z
- call Diez
- decf leido
- btfsc STATUS, Z
- call Once
- decf leido
- btfsc STATUS, Z
- call Doce
- decf leido
- btfsc STATUS, Z
- call Trece
- decf leido
- btfsc STATUS, Z
- call Catorce
- decf leido
- btfsc STATUS, Z
- call Quince
- decf leido
- btfsc STATUS, Z
- call Dieciseis
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- btfsc STATUS, Z
- decf leido
- ;PUENTES BITS
- ;bits ;SALTO A LA ETIQUETA
- ;movff PORTA,PORTB
- return ;SALTO A LA ETIQUETA INICIO
- Cero
- movlw b'0111111'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Uno
- movlw b'0111111'
- movwf PORTC
- movlw b'0000110'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Dos
- movlw b'0111111'
- movwf PORTC
- movlw b'1011011'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Tres
- movlw b'0111111'
- movwf PORTC
- movlw b'1001111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Cuatro
- movlw b'0111111'
- movwf PORTC
- movlw b'1100110'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Cinco
- movlw b'0111111'
- movwf PORTC
- movlw b'1101101'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Seis
- movlw b'0111111'
- movwf PORTC
- movlw b'1111101'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Siete
- movlw b'0111111'
- movwf PORTC
- movlw b'0000111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Ocho
- movlw b'0111111'
- movwf PORTC
- movlw b'1111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Nueve
- movlw b'0111111'
- movwf PORTC
- movlw b'1101111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Once
- movlw b'0000110'
- movwf PORTC
- movlw b'0000110'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Doce
- movlw b'0000110'
- movwf PORTC
- movlw b'1011011'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Trece
- movlw b'0000110'
- movwf PORTC
- movlw b'1001111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Catorce
- movlw b'0000110'
- movwf PORTC
- movlw b'1100110'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Diez
- movlw b'0000110'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinte
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinte
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinte
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinte
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinte
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veinticinco
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veintiseis
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veintisiete
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veintiocho
- movlw b'1011011'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Veintinueve
- movlw b'1011011' ;;Decena
- movwf PORTC
- movlw b'0111111' ;;Unidad
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- Treinta
- movlw b'1001111'
- movwf PORTC
- movlw b'0111111'
- movwf PORTD
- movf entrada, W
- movwf PORTB
- return
- inicio
- call conversorBinDec
- ; movwf PORTC
- ; movwf PORTD
- goto inicio
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement