{"id":2113,"date":"2021-03-30T21:13:12","date_gmt":"2021-03-30T12:13:12","guid":{"rendered":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/?p=2113"},"modified":"2021-04-03T14:54:29","modified_gmt":"2021-04-03T05:54:29","slug":"attiny202","status":"publish","type":"post","link":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/2021\/03\/attiny202\/","title":{"rendered":"ATtiny202\u3067L\u30c1\u30ab"},"content":{"rendered":"<h1>ATTiny202\u3067L\u30c1\u30ab\u3092<\/h1>\n<p>&nbsp;<\/p>\n<p>\u79cb\u6708\u96fb\u5b50\u3067\u4e00\u500b40\u5186\u306eATtiny202\u3092Arduino IDE\u304b\u3089\u30d7\u30ed\u30b0\u30e9\u30e0\u3057\u307e\u3059\u3002<\/p>\n<p>\u5148\u65e5\u4f5c\u6210\u3057\u305f\u3001jtag2updi\u7d4c\u7531\u3067\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/ATtiny202-arduino.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-2123 size-medium\" src=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/ATtiny202-arduino-400x235.jpg\" alt=\"\" width=\"400\" height=\"235\" srcset=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/ATtiny202-arduino-400x235.jpg 400w, http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/ATtiny202-arduino-768x451.jpg 768w, http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/ATtiny202-arduino.jpg 1024w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>megaTinyCore \u3067\u306fLED_BUILTIN\u304cPA3\u306a\u306e\u3067\u3001\u56de\u8def\u56f3\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-2140\" src=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/T202-1-400x246.jpg\" alt=\"\" width=\"400\" height=\"246\" srcset=\"http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/T202-1-400x246.jpg 400w, http:\/\/morecatlab.akiba.coocan.jp\/lab\/wp-content\/uploads\/2021\/03\/T202-1.jpg 640w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n<p><!--more--><\/p>\n<h2>\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5c0f\u3055\u304f\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>\u6700\u521d\u306b\u666e\u901a\u306eL\u30c1\u30ab\u3002Arduino IDE\u3067\u3001\u30b9\u30b1\u30c3\u30c1\u306e\u4f8b\u304b\u3089blink\u3092\u9078\u3073\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nvoid setup() {\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n}\r\n\r\nvoid loop() {\r\n  digitalWrite(LED_BUILTIN, HIGH);\r\n  delay(1000);\r\n  digitalWrite(LED_BUILTIN, LOW);\r\n  delay(1000);\r\n}\r\n\r\n\/\/ 636\u30d0\u30a4\u30c8\uff0831%\uff09\r\n\r\n<\/pre>\n<p>L\u30c1\u30ab\u3060\u3051\u306a\u306e\u306b3\u5272\u3082\u30e1\u30e2\u30ea\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3059\u3002\u6b21\u306b\u3001\u30d4\u30f3\u306e\u30c8\u30b0\u30eb\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u5c11\u3057\u7c21\u7565\u5316\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u624b\u6cd5\u306ftwitter\u3067<a href=\"https:\/\/twitter.com\/i_juno\">@i_juno \u3055\u3093<\/a>\u306b\u6559\u3048\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: cpp; highlight: [5]; title: ; notranslate\" title=\"\">\r\nvoid setup() {\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n}\r\nvoid loop() {\r\n  digitalWrite(LED_BUILTIN, CHANGE);\r\n  delay(1000);\r\n}\r\n\r\n\/\/ 598\u30d0\u30a4\u30c8\uff0829%\uff09\r\n\r\n<\/pre>\n<p>\u3053\u308c\u3060\u3068\u5c11\u3057\u5c0f\u3055\u304f\u306a\u308a\u307e\u3057\u305f\u3002\u3055\u3089\u306b\u3001digitalWrite()\u3092\u4f7f\u308f\u305a\u306b\u81ea\u5206\u3067\u5c55\u958b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; highlight: [5,6,7]; title: ; notranslate\" title=\"\">\r\nvoid setup() {\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n}\r\nvoid loop() {\r\n  PORT_t *port = digitalPinToPortStruct(LED_BUILTIN);\r\n  uint8_t bit_mask = digitalPinToBitMask(LED_BUILTIN);\r\n  port-&gt;OUTTGL = bit_mask; \/\/ toggle the bit\r\n  delay(1000);\r\n}\r\n\/\/ 548\u30d0\u30a4\u30c8\uff0826%\uff09\r\n<\/pre>\n<p>Arduino\u306edelay()\u306e\u4ee3\u308f\u308a\u306b\u3001AVR\u30e9\u30a4\u30d6\u30e9\u30ea\u306e_delay_ms()\u95a2\u6570\u3092\u547c\u3076\u3088\u3046\u306b\u3059\u308c\u3070\u3001\u3055\u3089\u306b\u6e1b\u3089\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; highlight: [1,11]; title: ; notranslate\" title=\"\">\r\n\r\n#include &lt;util\/delay.h&gt;\r\n\r\nvoid setup() {\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n}\r\n\r\nvoid loop() {\r\n  PORT_t *port = digitalPinToPortStruct(LED_BUILTIN);\r\n  uint8_t bit_mask = digitalPinToBitMask(LED_BUILTIN);\r\n  port-&gt;OUTTGL = bit_mask; \/\/ toggle the bit\r\n  _delay_ms(1000);\r\n}\r\n\r\n\/\/ 368\u30d0\u30a4\u30c8\uff0817%\uff09\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>avr-libc\u3060\u3051\u3067\u4f5c\u6210\u3059\u308b<\/h2>\n<p>&nbsp;<\/p>\n<p>\u3055\u3089\u306b\u7bc0\u7d04\u3059\u308b\u305f\u3081\u306b\u3001avr-libc\u3060\u3051\u3092\u4f7f\u3063\u3066\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; highlight: [5]; title: ; notranslate\" title=\"\">\r\n#include &lt;avr\/io.h&gt;\r\n#include &lt;util\/delay.h&gt;\r\n\r\nint main() {\r\n    _PROTECTED_WRITE(CLKCTRL_MCLKCTRLB, 0x00);\r\n    PORTA.DIR = 1 &lt;&lt; 3; \/\/ PA3 = OUTPUT\r\n    for ( ; ; ) {\r\n        PORTA.OUTTGL = 1 &lt;&lt; 3; \/\/ toggle PA3\r\n        _delay_ms(1000);\r\n    }\r\n}\r\n\/\/ 114\u30d0\u30a4\u30c8\uff085%)\r\n<\/pre>\n<p>5\u884c\u3081\u3067\u306f\u3001CPU\u30af\u30ed\u30c3\u30af\u306e\u30d7\u30ea\u30b9\u30b1\u30fc\u30e9\u3092\u30aa\u30d5\u306b\u3057\u3066\u3001CPU\u309220MHz\u3067\u52d5\u304b\u3059\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><div class=\"note\"><div class=\"notewarning\">avr-libc\u3060\u3051\u3092\u4f7f\u3063\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u3001Arduino\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u542b\u307e\u308c\u308b\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u306e\u521d\u671f\u5316\u51e6\u7406\u304c\u5b9f\u65bd\u3055\u308c\u307e\u305b\u3093\u3002\u4e0a\u8a18\u306fCPU\u30af\u30ed\u30c3\u30af\u30b9\u30d4\u30fc\u30c9\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306e\u6700\u4f4e\u9650\u306e\u8a2d\u5b9a\u306e\u307f\u3067\u3059\u3002\u3053\u306e\u4ed6\u3001\u30bf\u30a4\u30de\u30fc\u306a\u3069\u3092\u4f7f\u3046\u5834\u5408\u306b\u3082\u81ea\u5206\u3067\u521d\u671f\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/div><\/div><\/p>\n<p><div class=\"note\"><div class=\"notetip\">Arduino IDE\u304b\u3089\u7d14\u7c8b\u306aC\u306e\u30d7\u30ed\u30b0\u30e9\u30e0(\u4f8b\u3067\u306fblink)\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306b\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u6b21\u306e\u3088\u3046\u306b\u914d\u7f6e\u3057\u307e\u3059\u3002<br \/>\nblink\/blink.ino &lt;-\u7a7a\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u826f\u3044<br \/>\nblink\/blink.c\u3000main()\u3092\u542b\u3080\u4e0a\u8a18\u30d5\u30a1\u30a4\u30eb\u3092\u7f6e\u304f\u3002<\/div><\/div><\/p>\n<p><div class=\"note\"><div class=\"noteclassic\">UPDI\u3092\u4f7f\u3046\u3053\u306e\u8a2d\u5b9a\u3067\u306f\u30d6\u30fc\u30c8\u30ed\u30fc\u30c0\u306f\u4f7f\u7528\u3057\u307e\u305b\u3093\u3002\u30d6\u30fc\u30c8\u30ed\u30fc\u30c0\u306e\u66f8\u304d\u8fbc\u307f\u306f\u4e0d\u8981\u3067\u3059\u3002(Arduino IDE\u304b\u3089\u300c\u30d6\u30fc\u30c8\u30ed\u30fc\u30c0\u3092\u66f8\u304d\u8fbc\u3080\u300d\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u30d2\u30e5\u30fc\u30ba\u30d3\u30c3\u30c8\u306e\u8a2d\u5b9a\u3060\u3051\u304c\u53cd\u6620\u3055\u308c\u307e\u3059\u3002)<\/div><\/div><\/p>\n<h2>\u9591\u8a71\u4f11\u984c<\/h2>\n<p><del>\u30b1\u30c1\u30b1\u30c1\u3057\u3066\u304f\u308b\u3068\u3001\u3060\u3093\u3060\u3093Arduino IDE\u3092\u4f7f\u3046\u610f\u5473\u304c\u306a\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u306d\u3002\u6700\u521d\u304b\u3089C\u3067\u66f8\u3044\u305f\u65b9\u304c\u3001\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/del><\/p>\n<p>ATTiny202\u306f2KB\u30e1\u30e2\u30ea\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u307e\u3067\u4f7f\u3063\u3066\u304d\u305fATTiny10\u3068\u304b\u306b\u6bd4\u3079\u308b\u3068\u500d\u3067\u3059\u304c\u305d\u308c\u3067\u3082\u8db3\u308a\u306a\u304f\u306a\u308b\u3053\u3068\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li>Arduino\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u308f\u305a\u306bavr-libc\u3060\u3051\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3059\u308b\u3053\u3068\u3067\u3001\u5bb9\u91cf\u3092\u7bc0\u7d04\u3067\u304d\u307e\u3059\u3002<\/li>\n<li>Arduino\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u308f\u306a\u3044\u5834\u5408\u306b\u3082\u3001Ardino IDE\u3092\u4f7f\u3046\u3068GUI\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3084\u66f8\u304d\u8fbc\u307f\u306e\u5236\u5fa1\u3092\u3067\u304d\u3066\u4fbf\u5229\u3067\u3059\u3002<\/li>\n<li>\u81ea\u5206\u3067\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u306e\u521d\u671f\u5316\u3092\u3057\u306a\u3044\u3068\u6b63\u3057\u304f\u52d5\u304d\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n<p>\uff08\u4e86\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ATTiny202\u3067L\u30c1\u30ab\u3092 &nbsp; \u79cb\u6708\u96fb\u5b50\u3067\u4e00\u500b40\u5186\u306eATtiny202\u3092Arduino IDE\u304b\u3089\u30d7\u30ed\u30b0\u30e9\u30e0\u3057\u307e\u3059\u3002 \u5148\u65e5\u4f5c\u6210\u3057\u305f\u3001jtag2updi\u7d4c\u7531\u3067\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002 &nbsp; megaTinyCo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,11,24],"tags":[],"_links":{"self":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/2113"}],"collection":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/comments?post=2113"}],"version-history":[{"count":43,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/2113\/revisions"}],"predecessor-version":[{"id":2162,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/posts\/2113\/revisions\/2162"}],"wp:attachment":[{"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/media?parent=2113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/categories?post=2113"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/morecatlab.akiba.coocan.jp\/lab\/index.php\/wp-json\/wp\/v2\/tags?post=2113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}