This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| pt:avr:external_interrupts [2015/11/30 17:33] – Criação deste novo documento. artica | pt:avr:external_interrupts [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | External interrups are one of the most simple peripheral functions. Typically | + | As interrupções externas são das funções periféricas mais simples. AVRs típicos têm 1 a 8 pinos especiais, que são utilizados para causar interrupções no programa quando o valor lógico destes muda ou quando se encontram num determinado estado. Uma vez que esta função é normalmente usada para monitorar sinais lógicos externos, estes pinos são designados como pinos de interrupção externos. |
| - | To use an external interrupt, the pin has to be configured as a standard IO input (it can also be used as an output, but in this case the interrupt can only be created by the controller itself). It is necessary to allow receiving interrupts and specify the condition that causes the interrupt to fire in the external interrupt configuration register. There are four possible conditions: | + | Para utilizar uma interrupção externa, o pino tem de ser configurado como uma entrada |
| - | * Logical | + | * De zero lógico |
| - | * Change in the logical value | + | * Alteração do valor lógico. |
| - | * Descending front - logical change from one to zero. | + | * Frente Decrescente |
| - | * Rising front - logical change from zero to one. | + | * Frente Crescente |
| + | Quando o modo for definido para o zero lógico, a interrupção irá disparar continuamente enquanto o pino tem um valor de zero. Durante este período, a execução do programa principal é interrompida. | ||
| - | When the mode is set to logical zero, the interrupt will fire continuously | + | Agrupados por princípio, existem dois tipos de interrupção: |
| - | Grouped by principle, there are two types of interrupts: synchronized to the controller' | + | < |
| - | ~~PB~~ | + | <box 100% round #EEEEEE|Exemplo> |
| - | + | ||
| - | <box 100% round #EEEEEE|Example> | + | |
| Task: Make ATmega128 pin number 9 (pin 7 on bus E) fire an interrupt if its value is changed. This pin corresponds to the INT7 external interrupt, which is synchronous. | Task: Make ATmega128 pin number 9 (pin 7 on bus E) fire an interrupt if its value is changed. This pin corresponds to the INT7 external interrupt, which is synchronous. | ||
| Line 56: | Line 55: | ||
| </ | </ | ||
| - | In addition to interrupts fired by single pins, if the AVR has enough pins it is possible to use entire groups of pins to fire logical value change interrupts. These interrupts are simply called pin change interrupts. They fire when the value of at least one pin in the group is changed. | + | Além de interrupções disparadas por pinos individuais, se o AVR tem pinos suficientes, |