Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:avr:external_interrupts [2010/03/04 15:25] – Translated to English yllarsen:avr:external_interrupts [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== External interrupts ======+====== External Interrupts ======
  
-External interrups are one of the most simple peripheral functions. AVRs typically have 1 to 8 special pins, which are used to cause interrupts in the program when their logical value changes or they are at a certain state. Since this function is usually used to monitor external logical signals, these pins are called external interrupt pins.+External interrups are one of the most simple peripheral functions. Typically AVRs have 1 to 8 special pins, which are used to cause interrupts in the program when their logical value changes or they are at a certain state. Since this function is usually used to monitor external logical signals, these pins are called external interrupt pins.
  
-To use an external interrupt, the pin has to be configured as 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:+To use an external interrupt, the pin has to be configured as 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:
  
   * Logical zero (voltage of 0V)   * Logical zero (voltage of 0V)
Line 11: Line 11:
  
  
-When the mode is set to logical zero, the interrupt will fire continuously as long as the pin has a value of zero. The execution of the main program is stopped during that period.+When the mode is set to logical zero, the interrupt will fire continuously as long as the pin has a value of zero. During this period the execution of the main program is stopped.
  
-Grouped by principal, there are two types of interrupts: synchronized to the controller's clock and asynchronous. Synchronized interrupts work by remembering the values of the inputs, which means that the changes in logical values are found by comparing values read during two different clock cycles. If the logical changes in the signal happen faster than the controller's duty-cycle, then the interrupts either fire incorrectly or are skipped altogether. Asynchronous interrupts do not depend on the controller's clock and enable detecting faster changes in the external signal as well - the logical level must still be constant for at least 50 ns. ATmega128 has 4 synchronized and 4 asynchronous external interrupts.+Grouped by principle, there are two types of interrupts: synchronized to the controller's clock and asynchronous. Synchronized interrupts work by remembering the values of the inputs, which means that the changes in logical values are found by comparing values read during two different clock cycles. If the logical changes in the signal happen faster than the controller's duty-cycle, the interrupts either fire incorrectly or are skipped altogether. Asynchronous interrupts do not depend on the controller's clock and enable detecting faster changes in the external signal as well - the logical level must still be constant for at least 50 ns. ATmega128 has 4 synchronized and 4 asynchronous external interrupts.
  
-~~PB~~+<pagebreak>
  
 <box 100% round #EEEEEE|Example> <box 100% round #EEEEEE|Example>
Line 35: Line 35:
  DDRE &= ~(1 << PIN7);  DDRE &= ~(1 << PIN7);
  
- // Defining a pull-up resistor to to pin 7 on bus E to prevent input floating+ // Defining a pull-up resistor to to pin 7 on bus E 
 +        // to prevent input floating
  PORTE |= (1 << PIN7);  PORTE |= (1 << PIN7);
  
Line 55: Line 56:
 </box> </box>
  
-In addition to interrupts fired by single pins, it is possible to use entire groups of pins to fire logical value change interrupts, if the AVR has enough pins. These interrupts are simply called pin change interrupts. They fire when the value of at least one pin in the group is changed.+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.
en/avr/external_interrupts.1267716357.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0