Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Este es un comentario, esta es una plantilla
- list p=18f4550 ;Modelo del microcontrolador
- #include<p18f4550.inc> ;Llamo a la librería de nombre de los regs
- ;Zona de los bits de configuración (falta)
- CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
- CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
- CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
- CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
- CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
- CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
- CONFIG CCP2MX = ON ; CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
- CONFIG MCLRE = ON ; MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
- cuenta EQU 0x60; cuenta
- ; org 0x0100; tabla
- ;tablita db 0x00, 0xD8, 0x9C, 0x74, 0x01
- ; org 0x0200; tabla2
- ;tablita2 db 0x00, 0x60, 0x9C, 0xC4, 0x01
- ;0x3f, 0x06, 0x5b, 0x4f, 0x66
- ;0,1,2,3,4
- org 0x0000; configuro
- goto configuro
- org 0x0008;interrop
- goto interroop
- org 0x0020;
- configuro:
- bcf TRISB, 4
- clrf TRISD
- clrf cuenta
- ;movlw UPPER tablita
- ;movwf TBLPTRU
- ;movlw HIGH datos
- ;movwf TBLPTRH
- ;movlw LOW datos
- ;movwf TBLPTRL ;Punteando el TBLPTR
- movlw 0xc8 ;b'11001000'
- movwf T0CON
- movlw 0xB0 ;b'11000000'
- movwf INTCON ;Interrupciones activas, INT0 habilitado
- bcf INTCON2, INTEDG0 ;Detección en flanco negativo
- inicio:
- movlw .0
- cpfseq cuenta
- goto bla
- goto cero ;verdadero
- movlw .4
- cpfseq cuenta
- goto nope
- bsf LATB,4
- goto otro
- tablasubida:
- addwf PCL,f
- dt 0xD8, 0x9C, 0x74
- tablabajada:
- addwf PCL,f
- dt 0x60, 0x9C, 0xC4
- subida: movf cuenta, W
- call tablasubida
- movwf TMR0L
- bcf INTCON,TMR0IF ;baja bandera
- bajada: btfss INTCON,TMR0IF
- goto bla2
- movf cuenta, W
- call tablabajada
- movwf TMR0L
- bcf INTCON, TMR0IF
- goto inicio
- nope: nop
- interroop: movlw .4
- cpfseq cuenta
- goto aunno
- clrf cuenta
- goto otro
- aunno: incf cuenta, f
- otro: bcf INTCON, INT0IF
- retfie
- cero: bcf LATB, 4
- movlw 0x3f
- movwf LATD
- goto inicio
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement