Sie sind auf Seite 1von 10

Interrupciones

Una interrupcin es un evento que requiere


que el CPU detenga la ejecucin normal del programa y a
continuacin, ejecutar un cdigo del programa relacionado
con el suceso causante de la interrupcin.
Las interrupciones pueden ser generados:
Internamente (por algn evento dentro del chip) o
Externa (por parte de algunos externos evento).
Un ejemplo de una interrupcin interna es un contador de
desbordamiento o de A / D de completar una conversin.
Un ejemplo de una interrupcin externa es un pin de E/S
al cambiar el estado.

Interrupciones

PIC18F4550
El microcontrolador PIC18F4550 tiene dos fuente principales de
interrupcin: del Ncleo y de los perifricos.
La principales fuentes de interrupcin del ncleo son:
Exteriores disparado por el interrupcin en los pines :
INT0, INT1 e INT2.
Pines PORTB interrumpe cuando cambia el estado de uno
de los pines RB4 a RB7 .
Temporizador 0.

Alguna de las fuentes de interrupcin perifrica son:


Conversin A / D completa.
USART interrupcin de recepcin.
USART interrupcin de transmisin.
Deteccin de bajo voltaje.
Otros

PIC18F4550
Las interrupciones en la familia PIC18F se puede dividir en dos
grupos: dealtaprioridadybajaprioridad.
Si en la aplicacin no es necesario establecer prioridades para las
interrupciones, el usuario puede optar por desactivar el esquema de
prioridades para que todas las interrupciones se encuentran en la
misma nivel de prioridad.
El PIC18F4550 utiliza varios registros para el control de la
interrupcin. Estos son:

RCON
INTCON
INTCON2
INTCON3
PIR1, PIR2
PIE1, PIE2
IPR1, IPR2

PIC18F4550
Cada fuente de
Interrupcin (excepto INT0) tiene tres bits para
controlar su funcionamiento. Estos bits son:
Un bit que indique si se ha producido una interrupcin.
Este bit tiene
un nombre
que
terminan

en. . . IF.

Un bit para habilitar o deshabilitar el origen de la interrupcin.


Este bit tiene el nombre que termina en. . . IE.
Un bit de prioridad para seleccionar alta o baja prioridad.
Este bit tiene un nombre que termina en. . . IP

Importante:
Los bits de interrupcin se establecen cuando una condicin de
interrupcin se
produce
independientemente del
estado de su correspondiente
bit
de
habilitacin.
El
usuario debe asegurarse limpiar el adecuado bits antes de
habilitar una interrupcin.

Registro RCON

bit7 IPEN:InterruptPriorityEnablebit
1 = Enable priority levels on interrupts
0 = Disable priority levels on interrupts
bit6SBOREN:BORSoftwareEnablebit(1)
For details of bit operation, see Register 4-1.
bit5Unimplemented:Readas0
bit 4 RI:RESETInstructionFlagbit
For details of bit operation, see Register 4-1.
bit3TO:WatchdogTime-outFlagbit
For details of bit operation, see Register 4-1.
bit2PD:Power-DownDetectionFlagbit
For details of bit operation, see Register 4-1.
bit1POR:Power-onResetStatusbit(2)
For details of bit operation, see Register 4-1.
bit0BOR:Brown-outResetStatusbit
For details of bit operation, see Register 4-1.

Registro intCON

bit 7 GIE/GIEH:GlobalInterruptEnablebit
When IPEN = 0:
1 = Enables all unmasked interrupts
0 = Disables all interrupts
When IPEN = 1:
1 = Enables all high-priority interrupts
0 = Disables all interrupts
bit 6 PEIE/GIEL:PeripheralInterruptEnablebit
When IPEN = 0:
1 = Enables all unmasked peripheral interrupts
0 = Disables all peripheral interrupts
When IPEN = 1:
1 = Enables all low-priority peripheral interrupts (if GIE/GIEH = 1)
0 = Disables all low-priority peripheral interrupts

Registro intCON

bit 5 TMR0IE:TMR0OverflowInterruptEnablebit
1 = Enables the TMR0 overflow interrupt
0 = Disables the TMR0 overflow interrupt
bit 4 INT0IE:INT0ExternalInterruptEnablebit
1 = Enables the INT0 external interrupt
0 = Disables the INT0 external interrupt
bit 3 RBIE:RBPortChangeInterruptEnablebit
1 = Enables the RB port change interrupt
0 = Disables the RB port change interrupt
bit 2 TMR0IF:TMR0OverflowInterruptFlagbit
1 = TMR0 register has overflowed (must be cleared in software)
0 = TMR0 register did not overflow
bit 1 INT0IF:INT0ExternalInterruptFlagbit
1 = The INT0 external interrupt occurred (must be cleared in software)
0 = The INT0 external interrupt did not occur
bit 0 RBIF:RBPortChangeInterruptFlagbit(1)
1 = At least one of the RB7:RB4 pins changed state (must be cleared in
software)
0 = None of the RB7:RB4 pins have changed state

Registro intCON

bit 5 TMR0IE:TMR0OverflowInterruptEnablebit
1 = Enables the TMR0 overflow interrupt
0 = Disables the TMR0 overflow interrupt
bit 4 INT0IE:INT0ExternalInterruptEnablebit
1 = Enables the INT0 external interrupt
0 = Disables the INT0 external interrupt
bit 3 RBIE:RBPortChangeInterruptEnablebit
1 = Enables the RB port change interrupt
0 = Disables the RB port change interrupt
bit 2 TMR0IF:TMR0OverflowInterruptFlagbit
1 = TMR0 register has overflowed (must be cleared in software)
0 = TMR0 register did not overflow
bit 1 INT0IF:INT0ExternalInterruptFlagbit
1 = The INT0 external interrupt occurred (must be cleared in software)
0 = The INT0 external interrupt did not occur
bit 0 RBIF:RBPortChangeInterruptFlagbit(1)
1 = At least one of the RB7:RB4 pins changed state (must be cleared in
software)
0 = None of the RB7:RB4 pins have changed state

Registro y bits de interrupcion

Das könnte Ihnen auch gefallen