Write C language program to AVR-1 series¶
Note
Arduino IDE and arduino-cli does not support “.c” file but only support “.ino” file. Process at this page is “hacky” as making C language file “.ino” for using Arduino tool chain.
Target board¶
-
Microcontroller: ATtiny1614
-
Pin-out:
- PA4: Tactile switch (with pullup resister)
- PA5: electromagnetic buzzer
- PA7: LED
- PA0: UPDI
- PB2: TXD
- PB3: RXD
t1614.blink-sw.c¶
Put following code to Arduino IDE sketch. The Arduino IDE generates source file with .ino extension in a directory with the same name of source file.
b1614.blink-sw.c/t1614.blink-sw.c.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Ref. ATtiny412.3.blink.c at Embedded Programming
Write program from Arduino IDE¶
The process is the same with the way to write .ino file.
- Arduino IDE: 1.18.10
- Board: megaTinycoe 2.2.9
- Boards Manager URL:
http://drazzy.com/package_drazzy.com_index.json
- Boards Manager URL:
On Arduino IDE.
- Board: ATtiny1614
- Serial Port: /dev/cu/usbserial-D207RG9Y
- check it by
ls /dev | grep -i usb
on your terminal
- check it by
- Programmer: Serial Port and 4.7k(pyupdi style)
Then click “Upload”(arrow mark) button.
Write program from arduino-cli¶
Install arduino-cli and configuration for megaTinyCore¶
Please see Build .hex file from C language program, FA2020
Compile¶
1 2 3 4 5 6 |
|
Then you will see t1614.simpleblink.c.ino.hex
the build path directory.
1 2 |
|
Write program¶
If you do not have pyupdi in your local PC, please see setup pyupdi
Run pyupdi (python virtual environment is recommended option. ref. run pyupdi)
1 2 3 |
|