{"id":3252,"date":"2015-01-07T23:44:02","date_gmt":"2015-01-07T14:44:02","guid":{"rendered":"http:\/\/www.syuheiuda.com\/?p=3252"},"modified":"2015-01-07T23:44:02","modified_gmt":"2015-01-07T14:44:02","slug":"windows-for-iot-ae-l6470drv-%e3%81%a7%e3%82%b5%e3%83%bc%e3%83%9c%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.syuheiuda.com\/?p=3252","title":{"rendered":"Windows for IoT + AE-L6470DRV \u3067\u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059"},"content":{"rendered":"<p>Windows for IoT \u3067 SPI \u901a\u4fe1 &amp; \u30b5\u30fc\u30dc \u30e2\u30fc\u30bf\u30fc\u3092\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u30b5\u30fc\u30dc\u306e\u30c9\u30e9\u30a4\u30d0\u306f\u79cb\u6708\u3067\u58f2\u3063\u3066\u3044\u305f <a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gK-07024\/\">AE-L6470DRV<\/a> \u3067\u3059\u3002<\/p>\n<p>\u57fa\u672c\u7684\u306b\u306f\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u69d8\u306e\u30b3\u30fc\u30c9\u3092\u4e38\u3054\u3068\u3044\u305f\u3060\u3044\u3066\u3044\u307e\u3059\u3002<br \/>\n<a title=\"http:\/\/spinelify.blog.fc2.com\/blog-entry-1.html\" href=\"http:\/\/spinelify.blog.fc2.com\/blog-entry-1.html\">L6470\u30b9\u30c6\u30c3\u30d4\u30f3\u30b0\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u30ad\u30c3\u30c8\u3067\u30de\u30a4\u30af\u30ed\u30b9\u30c6\u30c3\u30d7<\/a><\/p>\n<p>Arduino \u306e\u30b3\u30fc\u30c9\u304b\u3089\u4fee\u6b63\u7b87\u6240\u306f\u6975\u3081\u3066\u5c11\u306a\u304f\u3001C++ \u306a\u306e\u3067\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u3057\u3066\u304a\u304f\u304f\u3089\u3044\u3002<br \/>\n(\u5fd8\u308c\u3066 \u201cc3861: \u8b58\u5225\u5b50\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u201d \u3067 3 \u5206\u304f\u3089\u3044\u60a9\u307f\u307e\u3057\u305f\u3002)<\/p>\n<p>SPI.h \u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3057\u3066\u666e\u901a\u306b Arduino \u611f\u899a\u3067\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n\/\/ Main.cpp : Defines the entry point for the console application.\n\/\/\n#include &quot;stdafx.h&quot;\n#include &quot;arduino.h&quot;\n#include &quot;SPI.h&quot;\n#define PIN_SPI_SS 10\n#define PIN_SPI_MOSI 11\n#define PIN_SPI_MISO 12\n#define PIN_SPI_SCK 13\nvoid L6470_send(unsigned char add_or_val);\nvoid L6470_setup();\nint _tmain(int argc, _TCHAR* argv&#x5B;])\n{\nreturn RunArduinoSketch();\n}\nvoid setup()\n{\n\/\/ TODO: Add your code here\npinMode(PIN_SPI_MISO, OUTPUT);\npinMode(PIN_SPI_MOSI, INPUT);\npinMode(PIN_SPI_SCK, OUTPUT);\npinMode(PIN_SPI_SS, OUTPUT);\nSPI.begin();\nSPI.setDataMode(SPI_MODE3);\nSPI.setBitOrder(MSBFIRST);\n\/\/\u524d\u306e\u30b3\u30de\u30f3\u30c9\u306e\u5f15\u6570\u3092\u6d88\u53bb\nL6470_send(0x00);\/\/nop\nL6470_send(0x00);\nL6470_send(0x00);\nL6470_send(0x00);\n\/\/\u30c7\u30d0\u30a4\u30b9\u30ea\u30bb\u30c3\u30c8\u30b3\u30de\u30f3\u30c9\nL6470_send(0xc0);\/\/ResetRevice\nL6470_setup();\/\/L6470\u3092\u8a2d\u5b9a\ndelay(1000);\n\/\/\u9023\u7d9a\u904b\u8ee2\nL6470_send(0x51);\/\/Run(DIR,SPD),0x51:\u6b63\u8ee2,0x50:\u9006\u8ee2\nL6470_send(0x00);\/\/SPD\u5024(20bit)\nL6470_send(0x40);\nL6470_send(0x00);\ndelay(10000);\nL6470_send(0xB0);\/\/SoftStop\ndelay(1000);\nL6470_send(0x50);\/\/Run(DIR,SPD),0x51:\u6b63\u8ee2,0x50:\u9006\u8ee2\nL6470_send(0x00);\/\/\u5024(20bit)\nL6470_send(0x40);\nL6470_send(0x00);\ndelay(4000);\nL6470_send(0xB0);\/\/SoftStop\ndelay(5000);\nL6470_send(0x50);\/\/Run(DIR,SPD),0x51:\u6b63\u8ee2,0x50:\u9006\u8ee2\nL6470_send(0x01);\/\/\u5024(20bit)\nL6470_send(0x00);\nL6470_send(0x00);\ndelay(1000);\nL6470_send(0xB0);\/\/SoftStop\ndelay(5000);\nL6470_send(0x50);\/\/Run(DIR,SPD),0x51:\u6b63\u8ee2,0x50:\u9006\u8ee2\nL6470_send(0x01);\/\/\u5024(20bit)\nL6470_send(0x00);\nL6470_send(0x00);\ndelay(1000);\nL6470_send(0xB8);\/\/HradStop\ndelay(5000);\nL6470_send(0x70);\/\/GoHome\ndelay(8000);\n}\n\/\/ the loop routine runs over and over again forever:\nvoid loop()\n{\n}\nvoid L6470_send(unsigned char add_or_val){\ndigitalWrite(PIN_SPI_SS, LOW);\nSPI.transfer(add_or_val); \/\/ \u30a2\u30c9\u30ec\u30b9\u3082\u3057\u304f\u306f\u30c7\u30fc\u30bf\u9001\u4fe1\u3002\ndigitalWrite(PIN_SPI_SS, HIGH);\n}\nvoid L6470_setup(){\n\/\/\u6700\u5927\u56de\u8ee2\u30b9\u30d4\u30fc\u30c9\nL6470_send(0x07);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x00);\/\/\u5024(10bit),\u30c7\u30d5\u30a9\u30eb\u30c80x41\nL6470_send(0x30);\n\/\/\u30e2\u30fc\u30bf\u505c\u6b62\u4e2d\u306e\u96fb\u5727\u8a2d\u5b9a\nL6470_send(0x09);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x20);\/\/\u5024(8bit),\u30c7\u30d5\u30a9\u30eb\u30c80x29\n\/\/\u30e2\u30fc\u30bf\u5b9a\u901f\u56de\u8ee2\u6642\u306e\u96fb\u5727\u8a2d\u5b9a\nL6470_send(0x0a);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x40);\/\/\u5024(8bit),\u30c7\u30d5\u30a9\u30eb\u30c80x29\n\/\/\u52a0\u901f\u4e2d\u306e\u96fb\u5727\u8a2d\u5b9a\nL6470_send(0x0b);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x40);\/\/\u5024(8bit),\u30c7\u30d5\u30a9\u30eb\u30c80x29\n\/\/\u6e1b\u901f\u4e2d\u306e\u96fb\u5727\u8a2d\u5b9a\nL6470_send(0x0c);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x40);\/\/\u5024(8bit),\u30c7\u30d5\u30a9\u30eb\u30c80x29\n\/\/\u30d5 \u30eb \u30b9 \u30c6 \u30c3 \u30d7,\u30cf \u30fc \u30d5 \u30b9 \u30c6 \u30c3 \u30d7,1\/4, 1\/8,\u2026,1\/128 \u30b9\u30c6\u30c3\u30d7\u306e\u8a2d\u5b9a\nL6470_send(0x16);\/\/\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9\nL6470_send(0x00);\/\/\u5024(8bit)&lt;\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>\u305d\u306e\u4ed6\u3001Windows for IoT \u7528\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210\u624b\u9806\u3068\u304b\u3001\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u30db\u30b9\u30c8\u540d\u306e\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306f <a href=\"https:\/\/www.syuheiuda.com\/?p=3140\">Windows for IoT on Intel Galileo\u3067 L \u30c1\u30ab<\/a> \u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>VS \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30d5\u30a1\u30a4\u30eb\u3082\u5ff5\u306e\u305f\u3081\u304a\u3044\u3066\u304a\u304d\u307e\u3059\u3002<a href=\"https:\/\/blob.syuheiuda.com\/wp-content\/2015\/01\/Servo4IoT.zip\">Servo4IoT.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows for IoT \u3067 SPI \u901a\u4fe1 &amp; \u30b5\u30fc\u30dc \u30e2\u30fc\u30bf\u30fc\u3092&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.syuheiuda.com\/?p=3252\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_locale":"","_original_post":""},"categories":[2,4,8],"tags":[],"views":6517,"_links":{"self":[{"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=\/wp\/v2\/posts\/3252"}],"collection":[{"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3252"}],"version-history":[{"count":0,"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=\/wp\/v2\/posts\/3252\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.syuheiuda.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}