Академический Документы
Профессиональный Документы
Культура Документы
AUTNOMA DE PUEBLA
Facultad de Ciencias de la Electrnica
Licenciatura en Electrnica
Desarrollo de Sistemas basados en
Microcontroladores y DSP's
Maestro:
M.C. Nicols Quiroz Hernndez
Otoo 2016
A los 17 das del mes octubre, 2016
Contenido
Introduccin.......................................................................................................3
Objetivos.........................................................................................................3
Generales.....................................................................................................3
Especficos..................................................................................................3
Marco terico.....................................................................................................4
Caractersticas generales y funcionamiento de un encoder rotatorio............4
Definamos primeramente que es un encoder rotatorio?...........................4
Algunas aplicaciones de los encoders.........................................................4
Encoders de tipo incremental.........................................................................5
Descripcin de interrupciones que se pueden generar con el PIC18F4550
utilizadas en esta practica...............................................................................6
Desarrollo...........................................................................................................8
Cdigo..............................................................................................................10
Conclusiones....................................................................................................12
Apndice..........................................................................................................13
Cdigo completo...........................................................................................13
Introduccin
Los microcontroladores son sistemas que pueden realizar un sin fin de tareas, siempre y
cuando se pueda desarrollare un cdigo para estas, teniendo en cuenta que cada
microcontrolador est diseado para diferentes ambientes, aplicaciones y cada uno posee
diferentes recursos.
Una de las caractersticas de los microcontroladores, es que pueden ser sistemas
multitareas, esto se refiere a que se puede estar actualizando una LCD y a las vez leyendo
un dato en uno de los puertos, calculando datos, etc.
En esta prctica se pretende utilizar la bandera de interrupcin para poder crear un sistema,
con el fin de entender el proceso que realiza el microcontrolador para responder a cada tipo
de interrupcin.
Objetivos
Generales
Identificar las caractersticas del PIC18F4550 que se requieren para generar una
interrupcin.
Manejar el software MPLAB para crear el proyecto y simular.
Analizar el proceso para generar una interrupcin.
Entender el proceso de multitarea basado en interrupciones.
Especficos
Identificar los tipos de interrupciones que el microcontrolador tiene, su prioridad y
en que registros aparecen las banderas de interrupcin.
Identificar el funcionamiento de una interrupcin cuando se ejecuta una tarea de
baja prioridad y en que registros asignar las tareas de prioridad alta.
Configurar las banderas de interrupcin globales en el microcontrolador y los
puertos generadores de interrupciones.
Asignarles al microcontrolador diferentes tareas y que este pueda ejecutarlas de
acuerdo a su nivel de prioridad.
Marco terico
Caractersticas generales y funcionamiento de un
encoder rotatorio
Definamos primeramente que es un encoder rotatorio?
Un encoder rotatorio es un sensor cuya funcin es generar seales digitales al obtener un
movimiento es su perilla. Existen los encoders que responden a la rotacin y otros al
movimiento lineal. Estos dispositivos al usarse en conjunto son utilizados para medir
movimientos lineales, velocidad y posicin.
Existen diversos tipos de encoders, uno de ellos son los incrementales cuyo funcionamiento
genera pulsos mientras la perilla que contiene se rota hacia izquierda o derecha segn sea el
caso. Otro tipo de encoders son los absolutos que generar multi-bits digitales que indican su
posicin actual
En esta practica se uso un encoder tipo incremental, con esto, aqu solo haremos referencia
a este tipo de encoders, los de tipo absoluto no sern descritos.
RCON
INTCON
INTCON2
INTCON3
PIR1, PIR2
PIE1, PIE2
IPR1, IPR2
Cada fuente de interrupcin tiene 3 bits para controlar su operacin. Las funciones de estos
bits son:
Desarrollo
Lo primero que se hace a la hora de realizar un programa, es el diagrama de flujo, y en
nuestro caso, no es la excepcin. A continuacin se muestran los diagramas de flujo
realizados para nuestra prctica.
Cdigo
En
los
prioridad
en
las
detectaba
(El botn del Encoder), por lo
solo una prioridad. Se dejaron
ocupa la prioridad baja.
Esta es la
parte
de
nuestro
cdigo que detecta el botn del Encoder, dentro de cada "Edo X".
En lugar de esto, se planeaba mandar a llamar la interrupcin
baja, pero por fallas en cdigo que no se lograron detectar, se tuvo
que mantener este proceso, y despreciar el otro.
Rutina
de
Interrupciones.
Atencin
Conclusiones.
De acuerdo con los resultados obtenidos en la prctica, la implementacin de las
interrupciones y la tarea que se le asigno en el registro de interrupciones, como tarea
de prioridad baja, actualizar un LCD y tarea con prioridad alta fue encender leds de
acuerdo al movimiento de un encoder rotatorio fue posible, el micro controlador
respondi de acuerdo al movimiento del encoder encendiendo el led que se
seleccionaba al igual que actualizaba el LCD con el men que se le asigno.
Esta caracterstica de los microcontroladores de poder hacer mltiples tareas por
medio de interrupciones se puede decir que as es como funcionan todos los
dispositivos que hoy conocemos, con un micro se pueden hacer muchas tareas al
igual que en una computadora pero el nico detalle es que una computadora tiene
ms capacidad, su arquitectura es abierta, sus recursos son ampliables a
comparacin de un microcontrolador.
Apndice
Cdigo completo
;****************************************************************************
;Plantilla para el PIC18F4550
;Microcontroladores y DSPs
;Nombre Practica: Encoder
;Nmero de prctica: 4
;Fecha: 04/Oct/2016
;notas: Interrupciones externas
;
;******************************************************************************
List P=18F4550
include <P18F4550.inc>
;Microcontrolador a utilizar
;Definiciones de constantes
cte7L
cte7H
cte8L
cte8H
cte9L
cte9H
equ 0x11
equ 0x12
equ 0x13
equ 0x14
equ 0x15
equ 0x16
;**********************************************************************************
org
goto
0x0000
MAIN
org
goto
0x0008
RAIH
org
goto
0x0018
RAIL
org
0x0100
MAIN
movlw
movwf
clrf
clrf
;bcf
setf
clrf
clrf
clrf
clrf
;bsf
bsf
bsf
bcf
bsf
bsf
bcf
0x0F
ADCON1
; Todos los pones digitales
PORTD
TRISD
INTCON2,RBPU
TRISB
PORTC
TRISC
PORTA
TRISA
INTCON,GIE ;Se habilitaron int globales
RCON,IPEN
; Habilito prioridades
INTCON,INT0IE
; Habilito la interrupcion del puerto B0
INTCON3,INT2IP
; B2 es baja prioridad
INTCON3,INT2IE
; Habilitas B2 como interrupcion
INTCON2,INTEDG0
; con flanco de sub se activa
INTCON2,INTEDG2
; con flanco de sub se activa
bsf
bsf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
bcf
cte4L
0x14
cte4H
0x13
cte5L
0x19
cte5H
0x18
cte6L
0x1E
cte6H
0x1D
cte7L
0x23
cte7H
0x22
cte8L
0x28
cte8H
0x27
cte9L
0x2D
cte9H
0x00
i
c,0
;*********Inicializacin********
call
call
call
call
movlw
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
call
movlw
Retardo1
Retardo1
Retardo1
Retardo1
0x30
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo1
0x30
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
0x30
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo1
0x20
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
0x20
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x80
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0xE0
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x20
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x60
PORTD
Retardom
PORTD,0
Retardom
bcf
call
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
PORTD,0
Retardo3
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
call
Retardo4
;******Fin de inicializacion*******
Led0
movf
cpfsgt
bra
call
i,W
cte1
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte2L
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte3L
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte4L
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte5L
movf
i,W
Led1
Edo0
Led1
Led2
cte2H
Led2
Edo1
Led2
Led3
cte3H
Led3
Edo2
Led3
Led4
cte4H
Led4
Edo3
Led4
Led5
cte5H
Led5
Edo4
Led5
cpfslt
bra
cpfsgt
bra
call
cte6L
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte7L
movf
cpfslt
bra
cpfsgt
bra
call
i,W
cte8L
movf
cpfslt
bra
cpfsgt
bra
call
bra
i,W
cte9L
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
0x42
PORTD
Led6
cte6H
Led6
Edo5
Led6
Led7
cte7H
Led7
Edo6
Led7
Led8
cte8H
Led8
Edo7
Led8
Led0
cte9H
Led0
Edo8
Led0
Edo0
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
call
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
0x32
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
bcf
call
PORTD,0
Retardo3
btfsc
bra
bsf
call
call
bcf
PORTC,0
Brinco0
PORTC,0
Retardo1
Retardo1
PORTC,0
btfsc
btg
call
return
PORTB,2
PORTC,0
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
0x42
PORTD
Brinco0
Edo1
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
bcf
call
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTC,1
Brinco1
PORTC,1
Retardo1
Retardo1
PORTC,1
btfsc
btg
call
PORTB,2
PORTC,1
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x12
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Brinco1
return
Edo2
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
bsf
call
bcf
call
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTC,2
Brinco2
PORTC,2
Retardo1
Retardo1
PORTC,2
btfsc
btg
call
PORTB,2
PORTC,2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x22
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardo1
Brinco2
return
Edo3
movlw
movwf
call
bsf
call
bcf
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
movlw
movwf
call
bsf
call
bcf
call
call
0x10
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
0x22
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
call
bcf
movlw
movwf
call
bsf
call
bcf
call
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTA,3
Brinco3
PORTA,3
Retardo1
Retardo1
PORTA,3
btfsc
btg
call
return
PORTB,2
PORTA,3
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x32
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Brinco3
Edo4
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
0x32
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
btfsc
bra
bsf
call
call
bcf
PORTA,4
Brinco4
PORTA,4
Retardo1
Retardo1
PORTA,4
btfsc
btg
call
return
PORTB,2
PORTA,4
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
0x42
PORTD
Brinco4
Edo5
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
PORTA,5
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
bra
bsf
call
call
bcf
Brinco5
PORTA,5
Retardo1
Retardo1
PORTA,5
Brinco5
btfsc
btg
call
return
PORTB,2
PORTA,5
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
Edo6
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTC,6
Brinco6
PORTC,6
Retardo1
Retardo1
PORTC,6
btfsc
btg
call
return
PORTB,2
PORTC,6
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x62
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Brinco6
Edo7
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x22
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTC,7
Brinco7
PORTC,7
Retardo1
Retardo1
PORTC,7
btfsc
btg
call
return
PORTB,2
PORTC,7
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
call
0x00
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x72
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Brinco7
Edo8
Retardom
PORTD,0
Retardom
PORTD,0
0x10
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo2
Retardo1
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x42
PORTD
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
0x22
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
0xC2
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x52
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x42
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Retardom
PORTD,0
Retardom
PORTD,0
0x02
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
call
Retardo3
movlw
movwf
call
bsf
call
bcf
movlw
movwf
call
bsf
call
bcf
call
0x32
PORTD
btfsc
bra
bsf
call
call
bcf
PORTC,8
Brinco8
PORTC,8
Retardo1
Retardo1
PORTC,8
btfsc
btg
call
return
PORTB,2
PORTC,8
Retardo1
Retardom
PORTD,0
Retardom
PORTD,0
0x82
PORTD
Retardom
PORTD,0
Retardom
PORTD,0
Retardo3
Brinco8
RAIH
MOVWF W_TEMP
; W_TEMP is in virtual bank
MOVFF STATUS, STATUS_TEMP
; STATUS_TEMP located anywhere
MOVFF BSR, BSR_TEMP
; BSR_TMEP located anywhere
btfsc
bra
incf
bra
continuar
decf
final
bcf
PORTB,1
continuar
i,F
final
i,F
INTCON,INT0IF
RAIL
MOVWF W_TEMP
; W_TEMP is in virtual bank
MOVFF STATUS, STATUS_TEMP
; STATUS_TEMP located anywhere
MOVFF BSR, BSR_TEMP
; BSR_TMEP located anywhere
bsf
c,0
bcf
INTCON3,INT2IF
Retardom
movlw
movwf
movlw
movwf
Ciclom
btfss
bra
bcf
return
Retardo1
movlw
movwf
movlw
movwf
Ciclo1
btfss
bra
bcf
return
Retardo2
movlw
movwf
movlw
movwf
Ciclo2
btfss
bra
bcf
return
Retardo3
movlw
movwf
movlw
movwf
Ciclo3
btfss
bra
bcf
return
0xFF
TMR0H
0xFF
TMR0L
; T0 <= minimo
INTCON,TMR0IF
;TMR0IF=1????
Ciclom
INTCON,TMR0IF
;TMR0IF=0
0xFF
TMR0H
0x50
TMR0L
; 4.5 ms
INTCON,TMR0IF
;TMR0IF=1????
Ciclo1
INTCON,TMR0IF
;TMR0IF=0
0xFF
TMR0H
0xFB
TMR0L
; 120 us
INTCON,TMR0IF
;TMR0IF=1????
Ciclo2
INTCON,TMR0IF
;TMR0IF=0
0xFF
TMR0H
0xFE
TMR0L
; 45 us
INTCON,TMR0IF
;TMR0IF=1????
Ciclo3
INTCON,TMR0IF
;TMR0IF=0
Retardo4
movlw
movwf
movlw
movwf
Ciclo4
btfss
bra
bcf
return
end
0xB3
TMR0H
0xB0
TMR0L
.5 s
INTCON,TMR0IF
;TMR0IF=1????
Ciclo4
INTCON,TMR0IF
;TMR0IF=0