0% encontró este documento útil (0 votos)
52 vistas3 páginas

Interrupciones Externas en ATmega16

El documento describe las interrupciones externas INT0, INT1 e INT2 del microcontrolador ATmega16. Cada interrupción se puede configurar para activarse por flanco de subida, flanco de bajada, nivel alto o nivel bajo usando los registros MCUCR y MCUCSR. Los registros GICR y GIFR se usan para habilitar e indicar el estado de las interrupciones respectivamente. Como ejemplo, se menciona un programa que cambia el estado de un LED cada vez que se pulsa un botón usando una interrupción.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como EHTML, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
52 vistas3 páginas

Interrupciones Externas en ATmega16

El documento describe las interrupciones externas INT0, INT1 e INT2 del microcontrolador ATmega16. Cada interrupción se puede configurar para activarse por flanco de subida, flanco de bajada, nivel alto o nivel bajo usando los registros MCUCR y MCUCSR. Los registros GICR y GIFR se usan para habilitar e indicar el estado de las interrupciones respectivamente. Como ejemplo, se menciona un programa que cambia el estado de un LED cada vez que se pulsa un botón usando una interrupción.
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como EHTML, PDF, TXT o lee en línea desde Scribd

Interrupciones Externas (uC: ATmega16) 11:18 PM V. D. G.

Las interrupciones externas se activan cada vez que existe un cambio de nivel en el pin correspondiente a la interrupcin, tiene aplicaciones muchas,por ejemplo, un contador de flancos o un contador de eventos externos.

El uC ATmega16 cuenta con tres interrupciones externas INT0, INT1, INT2 que se ubican en las patas 16, 17 y 3 respectivamente.

Los registros que configuran estas interrupciones son los siguientes: MCUCR: Se encarga de configurar las INT0 e INT1 ya sea por nivel bajo, cambio lgico, flanco de bajada o flanco de subida.

ISC11 Y ISC10 controlan como va ha ser activada la INT1.

ISC01 Y ISC00 controlan como va ha ser activada la INT0.

MCUCSR: Se encarga de configurar INT2 que solo puede ser por flanco de bajada o flanco de subida.

ISC2 controla como va ha ser activada la INT2, si es cero se activa con flanco de bajada y si es uno se activa con flanco de subida. GICR: Se encarga de habilitar las interrupciones, con uno habilitamos las interrupciones y con cero las deshabilitamos.

GIFR: Nos muestra las banderas de estado de las Interrupciones Externas, cada vez que ocurre el evento toma valor uno, adems sirve como solicitud de interrupcin, es decir, organiza las interrupciones.

@Ejemplo: El programa cambia el estado del LED correspondiente cada vez que se active el pulsador.

Pseudocdigo: - Configuramos Interrupciones - Al producirse una interrupcin el LED cambia de estado.

Common questions

Con tecnología de IA

The ATmega16 can be programmed by first configuring the appropriate external interrupt, ensuring it is activated using the desired triggering mode through the MCUCR (for INT0 and INT1) or MCUCSR (for INT2). Once an interrupt is triggered, a service routine executes, which toggles the LED state. This routine will be called each time the button (connected to the configured interrupt line) is pressed, thus changing the LED's state .

MCUCR configures INT0 and INT1 for various triggering modes. MCUCSR configures INT2 to trigger by a falling or rising edge. GICR enables or disables the external interrupts by setting the corresponding bits to one or zero. The GIFR displays the state flags of external interrupts, indicating when an interrupt event occurs and helping prioritize interrupt requests .

INT0 and INT1 can be configured to trigger on low level, logical change, falling edge, or rising edge, as controlled by the MCUCR register through ISC01, ISC00 and ISC11, ISC10 bits respectively. In contrast, INT2 can only trigger on falling or rising edge, controlled by ISC2 in the MCUCSR register where a zero sets falling edge activation and a one sets rising edge activation .

Interrupt prioritization in a system with the ATmega16 can be managed by leveraging the GIFR to monitor and decide which interrupts should be serviced immediately based on the current system needs or context. Despite all interrupts being at the same initial priority, handling them based on processing needs or urgency can be achieved by inspecting the GIFR and utilizing interrupt service routines that tailor the execution flow, ensuring critical tasks are addressed promptly .

The ATmega16 microcontroller configures its external interruptions using specific registers: MCUCR for configuring INT0 and INT1 based on different activation modes like low level, logical change, falling edge, or rising edge; MCUCSR for configuring INT2, which can only be activated by falling or rising edge; and GICR is used to enable the interruptions, where setting a bit to one enables the corresponding interrupt. Additionally, GIFR shows the status flags of the external interruptions and serves as an interrupt request organizer .

The GICR register enables or disables interrupts in the ATmega16 microcontroller by setting specific bits to one or zero. If a bit corresponding to an interrupt is set to one, that interrupt is enabled; conversely, setting it to zero will disable the interrupt. This allows precise control over which interrupts the microcontroller should respond to during operation .

Setting ISC2 to zero configures INT2 to trigger on a falling edge, while setting it to one configures it to trigger on a rising edge. This bit, part of the MCUCSR register, allows the developer to choose between these two modes for signal detection, enabling INT2 to respond specifically to descending or ascending edges in the external signals .

The flexibility in configuring ATmega16's external interrupts allows it to cater to a variety of applications requiring different types of signal detection, such as counters for edges or events. This flexibility makes it possible to use the microcontroller in diverse scenarios where precise control over how and when interrupts are triggered is crucial, enhancing its utility in complex electronic and automation systems .

In the ATmega16, bits ISC11 and ISC10 control the triggering mechanism of the INT1 external interrupt, while ISC01 and ISC00 control INT0. These bits are part of the MCUCR register and determine whether the interrupts are activated on a low level, logical change, falling edge, or rising edge. The combination of these bits provides flexibility in how external signals can trigger interrupts .

GIFR influences the handling of external interrupts by tracking the status flags, where each flag is set when the corresponding interrupt condition is met. This register is crucial for organizing interrupt servicing requests, helping the microcontroller identify which interrupts have been triggered and need processing, thus significantly impacting the handling efficiency of interruptions in a system .

También podría gustarte