Modifications

Sauter à la navigation Sauter à la recherche
129 octets supprimés ,  21 septembre 2018 à 22:04
Ligne 166 : Ligne 166 :  
Thanks to [http://forum.arduino.cc/index.php?topic=365830.msg2542879#msg2542879 this discussion thread] on the Arduino forums for the trick!
 
Thanks to [http://forum.arduino.cc/index.php?topic=365830.msg2542879#msg2542879 this discussion thread] on the Arduino forums for the trick!
   −
== Stocker des données en FLASH ==
+
== Store data in the microcontroler Flash ==
Si vous utilisez un AVR (Arduino), alors vous avez probablement déjà utilisé '''PROGMEM''' qui permet au compilateur de savoir que vous voulez placer le contenu d'une variable (ou chaine de caractère) dans la mémoire Flash (afin d'économiser de la RAM).  
+
If you use an AVR (Arduino) on regular basis, you may have a chance to use '''PROGMEM'''. PROGMEM inform the compiler to store the content of a variable (or a string) into the FLASH memory (to save RAM).  
   −
Sur un ARM, c'est un peu plus facile. Il suffit d'ajouter le mot '''const''' devant le nom de la variable:
+
It is a bit more easy on an ARM microcontroler. Just add the word '''const''' before the variable name:
    
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
const char str[] = "Ma treesss lonnnnguuuue chaiiiinnnnneeee";
+
const char str[] = "A quite lonnnnnggggggg striiiiiinnnnnnng";
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
Cette chaîne de caractère est maintenant en FLASH. Vous pouvez manipuler la chaîne de caractère comme si c'était des données en RAM, le compilateur fera automatiquement une lecture depuis la mémoire FLASH et vous n'aurez pas besoin d'utiliser de fonction spécialement conçue pour les manipulation progmem.
+
The string is now stored in the FLASH. You can handle the string as it was stored inside the RAM, the compiler would automagically read it from the FLASH (no need for special reading function like those required for PROGMEM variables).
   −
Vous pouvez vérifier l'emplacement de stockage des données en affichant leur adresse de stockage:
+
You can easily check where the data is stored! Just print the storage address of the variable:
    
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
Ligne 183 : Ligne 183 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Si l'adresse est:
+
If the adress is:
* égale ou supérieure à $2000000 alors c'est stocker en SRAM.  
+
* equal or greater than $2000000 then the data is in the SRAM.  
* entre $0000 et $3FFFF alors c'est stocké en FLASH
+
* between $0000 and $3FFFF then the data is stored in FLASH
    
{{ENG-CANSAT-TRAILER}}
 
{{ENG-CANSAT-TRAILER}}
29 836

modifications

Menu de navigation