Documente Academic
Documente Profesional
Documente Cultură
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: de alta prioridad y baja prioridad. 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 interrupcin se produce independientemente estado de su correspondiente bit de habilitacin. usuario debe asegurarse limpiar el adecuado bits antes habilitar una interrupcin.
de del El de
Registro RCON
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 0 = Disables all interrupts bit 6 PEIE/GIEL: Peripheral Interrupt Enable bit 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: 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
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