Ligne 24 : |
Ligne 24 : |
| | | |
| == Compiler un programme d'exemple == | | == Compiler un programme d'exemple == |
− | Copy the following code to a file named “main.c”:
| + | Copier le code d'exemple suivant dand un fichier nommé "main.c": |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
Ligne 33 : |
Ligne 33 : |
| int main() | | int main() |
| { | | { |
− | DDRC |= (1 << DDC7); // Make pin 13 be an output. | + | DDRC |= (1 << DDC7); // Configurer broche 13 en sortie |
| while(1) | | while(1) |
| { | | { |
− | PORTC |= (1 << PORTC7); // Turn the LED on. | + | PORTC |= (1 << PORTC7); // Allumer la LED. |
| _delay_ms(500); | | _delay_ms(500); |
− | PORTC &= ~(1 << PORTC7); // Turn the LED off. | + | PORTC &= ~(1 << PORTC7); // Eteindre la LED. |
| _delay_ms(500); | | _delay_ms(500); |
| } | | } |
Ligne 44 : |
Ligne 44 : |
| </<syntaxhighlight> | | </<syntaxhighlight> |
| | | |
− | In the same folder, create a file named “Makefile” with the following contents:
| + | Dans le même répertoire, créer un fichier nommé "Makefile" avec le contenu suivant: |
| | | |
− | <nowiki>PORT=\\\\.\\USBSER000 | + | <syntaxhighlight>PORT=\\\\.\\USBSER000 |
| MCU=atmega32u4 | | MCU=atmega32u4 |
| CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) -Os | | CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) -Os |
Ligne 68 : |
Ligne 68 : |
| avrdude -p $(MCU) -c avr109 -P $(PORT) -U flash:w:$(TARGET).hex</syntaxhighlight> | | avrdude -p $(MCU) -c avr109 -P $(PORT) -U flash:w:$(TARGET).hex</syntaxhighlight> |
| | | |
− | Make sure that the PORT variable in the Makefile is set to the name of the device’s virtual serial port. In Windows, {{fname|\\\\.\\USBSER000}} should work if the A-Star is the only USB device connected that is using the usbser.sys driver, but you can change it to be the actual name of the COM port (e.g. {{fname|COM13}}).
| + | Vérifier que la variable PORT dans le Makefile contient le nom du port série (Virtual Com Port) sur lequel est branché le microcontrôleur. Sous Windows, {{fname|\\\\.\\USBSER000}} devrait fonctionner sur l'A-Star est le seul périphérique USB connecté utilisant le pilote {{fname|usbser.sys}}. Il est possible de changer cette valeur par le nom du Port COM en cours d'utilisation (ex: {{fname|COM13}}). |
| | | |
− | In a command prompt, navigate to the directory with the Makefile and main.c. If you run the command {{fname|make}}, the code should get compiled and produce a file named “main.hex”.
| + | Dans une invite de commande, naviguer vers le répertoire contenant le les fichiers Makefile et main.c. Si vous exécutez le commande {{fname|make}}, le code devrait être compilé pour produire un fichier nommé "main.hex". |
| | | |
| == Programmer == | | == Programmer == |