Modifications

Sauter à la navigation Sauter à la recherche
Ligne 21 : Ligne 21 :  
Le "Brown out" est une brève baisse de tension qui se produit généralement à la mise sous-tension. De nombreux microcontrôleurs intègre un mécanisme de détection de Brown-out.
 
Le "Brown out" est une brève baisse de tension qui se produit généralement à la mise sous-tension. De nombreux microcontrôleurs intègre un mécanisme de détection de Brown-out.
    +
Unlike many other ATmega32U4 boards, our 32U4 family of boards have brown-out detection enabled. The brown-out threshold is 4.3 V, and if the voltage on VCC goes below this then the AVR will reset. The bootloader was designed so that the user program can detect brown-out resets. To do so, check to see if the BORF bit in the MCUSR register is set, and then clear it later. Here is some example code you could put in your {{fname|setup}} function for detecting brown-out resets:
   −
 
+
<syntaxhighlight lang="c">
[[Fichier:Pololu-Romi-32U4-A-Star-Bootloader-01.jpg]]
+
pinMode(13, OUTPUT);
 +
if (MCUSR & (1 << BORF))
 +
{
 +
  // A brownout reset occurred.  Blink the LED
 +
  // quickly for 2 seconds.
 +
  for(uint8_t i = 0; i < 10; i++)
 +
  {
 +
    digitalWrite(13, HIGH);
 +
    delay(100);
 +
    digitalWrite(13, LOW);
 +
    delay(100);
 +
  }
 +
}
 +
MCUSR = 0;
 +
</syntaxhighlight>
          
{{Pololu-Romi-32U4-TRAILER}}
 
{{Pololu-Romi-32U4-TRAILER}}
29 917

modifications

Menu de navigation