La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

INTERRUPCIONES Introducción.

Presentaciones similares


Presentación del tema: "INTERRUPCIONES Introducción."— Transcripción de la presentación:

1 INTERRUPCIONES Introducción

2 Interrupciones Una interrupción es un evento que requiere que el CPU detenga la ejecución normal del programa y a continuación, ejecutar un código del programa relacionado con el suceso causante de la interrupción.  Las interrupciones pueden ser generados:  Internamente (por algún evento dentro del chip) o Externa (por parte de algunos externos evento).  Un ejemplo de una interrupción interna es un contador de desbordamiento o de A / D de completar una conversión.  Un ejemplo de una interrupción externa es un pin de E/S  al cambiar el estado.

3 Interrupciones

4 PIC18F4550 El microcontrolador PIC18F4550 tiene dos fuente principales de interrupción: del Núcleo  y de los periféricos.  La principales fuentes de interrupción del núcleo son:    Exteriores disparado por el interrupción 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 interrupción periférica son:    Conversión A / D completa.    USART interrupción de recepción.    USART interrupción de transmisión. Detección de bajo voltaje. Otros…

5 PIC18F4550 Las interrupciones en la familia PIC18F se puede dividir en dos grupos: de alta prioridad y baja prioridad.  Si en la aplicación 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 interrupción. Estos son: RCON INTCON INTCON2 INTCON3 PIR1, PIR2 PIE1, PIE2 IPR1, IPR2

6 PIC18F4550 Cada fuente de Interrupción (excepto INT0) tiene tres bits para controlar su funcionamiento. Estos bits son:  Un bit que indique si se ha producido una interrupción.  Este bit tiene un nombre que terminan en. . . IF. Un bit  para habilitar o deshabilitar el origen de la interrupción.  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 interrupción  se establecen cuando una condición de interrupción se produce independientemente del estado de su correspondiente bit de habilitación. El usuario debe asegurarse limpiar el  adecuado bits  antes de habilitar una interrupción. 

7 Registro RCON bit 7 IPEN: Interrupt Priority Enable bit
1 = Enable priority levels on interrupts 0 = Disable priority levels on interrupts bit 6 SBOREN: BOR Software Enable bit(1) For details of bit operation, see Register 4-1. bit 5 Unimplemented: Read as ‘0’ bit 4 RI: RESET Instruction Flag bit bit 3 TO: Watchdog Time-out Flag bit bit 2 PD: Power-Down Detection Flag bit bit 1 POR: Power-on Reset Status bit(2) bit 0 BOR: Brown-out Reset Status bit

8 Registro intCON bit 7 GIE/GIEH: Global Interrupt Enable bit
When IPEN = 0: 1 = Enables all unmasked interrupts 0 = Disables all interrupts When IPEN = 1: 1 = Enables all high-priority interrupts bit 6 PEIE/GIEL: Peripheral Interrupt Enable bit 1 = Enables all unmasked peripheral interrupts 0 = Disables all peripheral interrupts 1 = Enables all low-priority peripheral interrupts (if GIE/GIEH = 1) 0 = Disables all low-priority peripheral interrupts

9 Registro intCON bit 5 TMR0IE: TMR0 Overflow Interrupt Enable bit
1 = Enables the TMR0 overflow interrupt 0 = Disables the TMR0 overflow interrupt bit 4 INT0IE: INT0 External Interrupt Enable bit 1 = Enables the INT0 external interrupt 0 = Disables the INT0 external interrupt bit 3 RBIE: RB Port Change Interrupt Enable bit 1 = Enables the RB port change interrupt 0 = Disables the RB port change interrupt bit 2 TMR0IF: TMR0 Overflow Interrupt Flag bit 1 = TMR0 register has overflowed (must be cleared in software) 0 = TMR0 register did not overflow bit 1 INT0IF: INT0 External Interrupt Flag bit 1 = The INT0 external interrupt occurred (must be cleared in software) 0 = The INT0 external interrupt did not occur bit 0 RBIF: RB Port Change Interrupt Flag bit(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

10 Registro intCON bit 5 TMR0IE: TMR0 Overflow Interrupt Enable bit
1 = Enables the TMR0 overflow interrupt 0 = Disables the TMR0 overflow interrupt bit 4 INT0IE: INT0 External Interrupt Enable bit 1 = Enables the INT0 external interrupt 0 = Disables the INT0 external interrupt bit 3 RBIE: RB Port Change Interrupt Enable bit 1 = Enables the RB port change interrupt 0 = Disables the RB port change interrupt bit 2 TMR0IF: TMR0 Overflow Interrupt Flag bit 1 = TMR0 register has overflowed (must be cleared in software) 0 = TMR0 register did not overflow bit 1 INT0IF: INT0 External Interrupt Flag bit 1 = The INT0 external interrupt occurred (must be cleared in software) 0 = The INT0 external interrupt did not occur bit 0 RBIF: RB Port Change Interrupt Flag bit(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

11 Registro y bits de interrupcion


Descargar ppt "INTERRUPCIONES Introducción."

Presentaciones similares


Anuncios Google