{"id":4139,"date":"2013-04-12T23:04:38","date_gmt":"2013-04-12T15:04:38","guid":{"rendered":"http:\/\/blog.dword1511.info\/?p=4139"},"modified":"2013-04-12T23:33:15","modified_gmt":"2013-04-12T15:33:15","slug":"pc-%e4%b8%8a%e8%af%bb%e5%86%99-dallas-1-wire-%e6%80%bb%e7%ba%bf%e7%ae%80%e5%8d%95%e6%98%93%e8%a1%8c%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/blog.dword1511.info\/?p=4139","title":{"rendered":"PC \u4e0a\u8bfb\u5199 Dallas 1-Wire \u603b\u7ebf\u7b80\u5355\u6613\u884c\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>Dallas \uff08\u73b0\u5df2\u88ab\u7f8e\u4fe1\u6536\u8d2d\uff09\u7684 One Wire \u603b\u7ebf\u662f\u4e2a\u5f88\u6709\u610f\u601d\u7684\u4e1c\u897f\u3002\u5b83\u63d0\u4f9b\u8f83\u4f4e\u7684\u6570\u636e\u901f\u7387\u548c\u7b80\u5355\u7684\u8fde\u63a5\uff0c\u5728\u4f20\u611f\u5668\u3001\u552f\u4e00 ID \u5b58\u50a8\u7b49\u9886\u57df\u6709\u7740\u4e0d\u5bb9\u5ffd\u89c6\u7684\u5f71\u54cd\u529b\u3002\u5982\u679c\u8981\u5f00\u53d1 1-Wire \u5668\u4ef6\u7684\u8bdd\uff0c\u80fd\u76f4\u63a5\u5728 PC \u4e0a\u64cd\u4f5c\u662f\u518d\u597d\u4e0d\u8fc7\u7684\u4e86\uff0c\u8fd9\u6837\u8c03\u8bd5\u5c06\u4f1a\u975e\u5e38\u65b9\u4fbf\u3002\u4e3a\u6b64 MAXIM \u8fd8\u66fe\u5f00\u53d1\u8fc7\u4e00\u7968 USB \u8f6c 1-Wire \u7684\u63a7\u5236\u5668\uff08\u5982\u00a0DS2490 \u7b49\uff09\uff0c\u4f46\u662f\u4ef7\u683c\u90fd\u5f88\u4e0d\u83f2\uff0c\u800c\u4e14\u6709\u4e9b\u82af\u7247\u90fd\u5df2\u7ecf\u505c\u4ea7\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u82b1\u4e86\u4e00\u767e\u591a\u5927\u6d0b\u4e70\u4e86\u4e13\u7528\u8f6c\u63a5\u5668\u7684\u8bdd\uff0c\u5efa\u8bae\u4f60\u7acb\u5373\u5173\u6389\u6b64\u9875\u9762\u7701\u5f97\u5fc3\u60c5\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5f00\u9500\uff0c\u6211\u4eec\u53ef\u4ee5\u7528 AVR \u6216\u8005 STM32 \u7b49\u5355\u7247\u673a\u5b9e\u73b0 USB \u5230 1-Wire \u7684\u6865\u63a5\u3002\u4f46\u662f\u8fd9\u6837\u505a\u8fd8\u662f\u6709\u4e00\u5b9a\u7684\u6210\u672c\uff0c\u5e76\u4e14\u8fd8\u9700\u8981\u5236\u5b9a\u534f\u8bae\uff0c\u540c\u65f6\u5f00\u53d1\u5355\u7247\u673a\u56fa\u4ef6\u548c\u4e0a\u4f4d\u673a\u7a0b\u5e8f\uff0c\u9887\u4e3a\u9ebb\u70e6\u3002\u56e0\u6b64\uff0c\u6211\u867d\u7136\u66fe\u6709\u8fc7\u8fd9\u79cd\u60f3\u6cd5\uff0c\u4f46\u662f\u4e00\u76f4\u6401\u7f6e\u7740\u6ca1\u6709\u5b9e\u65bd\u3002<\/p>\n<p>\u76f4\u5230\u6211\u770b\u5230\u4e86\u7f8e\u4fe1\u7684\u8fd9\u7bc7\u5e94\u7528\u6587\u6863\uff1a<a href=\"http:\/\/www.maximintegrated.com\/app-notes\/index.mvp\/id\/214\" target=\"_blank\">Using a UART to Implement a 1-Wire Bus Master<\/a><\/p>\n<p>\u8fd9\u7bc7\u6587\u6863\u7684\u521d\u8877\u662f\u8ba9\u5f00\u53d1\u8005\u4f7f\u7528\u5355\u7247\u673a\u4e0a\u7684 UART engine \u64cd\u4f5c 1-Wire bus \u6765\u8282\u7701\u673a\u65f6\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a PC \u673a\u4e0a\u4e5f\u6709 RS232 \u7535\u5e73\u7684 UART \u63a5\u53e3\uff0c\u6216\u8005\u81f3\u5c11\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u822c\u4e0d\u8d85\u8fc7 10 \u5757\u5927\u6d0b\u7684 USB to UART \u8f6c\u63a5\u5668\u6765\u83b7\u5f97\u4e00\u4e2a CMOS\/TTL \u7535\u5e73\u7684 UART \u63a5\u53e3\u3002\u5b9e\u9645\u4e0a\uff0c\u540e\u8005\u548c 1-Wire \u4e4b\u95f4\u7684\u63a5\u53e3\u76f8\u5bf9\u7b80\u5355\uff0c\u6240\u4ee5\u8fd9\u91cc\u4ee5\u540e\u8005\u4e3a\u4f8b\uff0c\u8bb2\u8bb2\u8fd9\u79cd\u66f2\u7ebf\u6551\u56fd\u7684 PC \u8bfb\u5199 One Wire \u7684\u65b9\u6848\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5148\u7ffb\u51fa\u6765\u4e24\u4e2a NPN BJT \u6216\u8005\u662f N-MOSFET \u3002\u9274\u4e8e\u624b\u4e0a S9014 \u591a\u5f97\u53d1\u70e7\uff0c\u6240\u4ee5\u5c31\u7528\u5b83\u4e86\u3002\u5269\u4e0b\u8fd8\u9700\u8981\u4e09\u4e2a\u7535\u963b\uff0c\u4e00\u822c\u7528 4.7k\u03a9 \u7684\uff0c\u5b9e\u9645\u4e0a 200\u03a9 &#8211; 20k\u03a9 \u57fa\u672c\u4e0a\u90fd\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u6309\u4e0b\u56fe\u4e2d\u7684\u7535\u8def\u710a\u597d\uff0c\u5b83\u5c06\u8d1f\u8d23 UART \u548c 1-Wire \u5355\u7ebf\u603b\u7ebf\u7684\u8f6c\u63a5\uff1a<\/p>\n<p><a href=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/pp2od.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4141\" alt=\"pp2od\" src=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/pp2od-400x300.png\" width=\"400\" height=\"300\" srcset=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/pp2od-400x300.png 400w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/pp2od.png 800w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u50cf\u6211\u4e00\u6837\u6dfb\u52a0\u4e00\u4e9b\u53bb\u8026\u7535\u5bb9\u4ec0\u4e48\u7684\uff0c\u751a\u81f3\u662f\u7535\u6e90\u6216\u8005\u603b\u7ebf\u72b6\u6001 LED \u3002\u8fd9\u5757\u677f\u5b50\u7684\u4e3b\u8981\u76ee\u7684\u662f\u628a UART \u7684 TX \u7ebf\u4e0a\u7684\u63a8\u633d\u5f0f\u8f93\u51fa\u53d8\u6362\u6210\u6f0f\u6781\u5f00\u8def\u8f93\u51fa\u5e76\u4e0a\u62c9\u3002\u5982\u679c TX \u672c\u8eab\u662f OD \u7684\uff08\u5355\u7247\u673a\u4e0a\u53ef\u4ee5\u5982\u6b64\u914d\u7f6e\uff0c\u4f46\u662f USB to UART \u8f6c\u63a5\u5668\u4e0a\u8fd9\u79cd\u60c5\u51b5\u4e0d\u591a\u89c1\uff09\uff0c\u90a3\u4e48\u76f4\u63a5\u628a TX \u548c RX \u8fde\u8d77\u6765\u5e76\u4e0a\u62c9\u5c31\u53ef\u4ee5\u4f5c\u4e3a 1-Wire \u7684 DQ \u4f7f\u7528\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u8fde\u63a5\u4f60\u7684 USB to UART \u8f6c\u6362\u5668\u5230 PC \u4e0a\uff0c\u628a UART \u8fde\u63a5\u5230 PP to OD \u8f6c\u63a5\u7535\u8def\u4e0a\uff0c\u7136\u540e\u628a One Wire \u7684\u4ece\u673a\uff08\u5982 DS18B20 \u4f20\u611f\u5668\uff09\u63a5\u5230 PP to OD \u4e0a\uff0c\u786c\u4ef6\u65b9\u9762\u7684\u8fde\u63a5\u5c31\u5b8c\u6210\u4e86\u3002\u6548\u679c\u5982\u4e0b\uff0c\u4e0a\u4e3a SiLabs \u7684 CP2102 \u4e32\u53e3\u8f6c\u6362\u5668\uff0c\u4e0b\u4e3a\u6309\u4e0a\u56fe\u81ea\u5df1\u710a\u7684 PP to OD \u8f6c\u63a5\u677f\uff1a<\/p>\n<p><a href=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1491.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4143\" alt=\"IMG_1491\" src=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1491-400x300.jpg\" width=\"400\" height=\"300\" srcset=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1491-400x300.jpg 400w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1491-1024x768.jpg 1024w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u53bb\u00a0<a href=\"https:\/\/github.com\/dword1511\/onewire-over-uart\" target=\"_blank\">https:\/\/github.com\/dword1511\/onewire-over-uart<\/a>\u00a0\u4e0b\u8f7d\u5e76\u7f16\u8bd1\u6709\u5173\u7a0b\u5e8f\u7684\u6e90\u7801\u3002\u7136\u540e\u6267\u884c\u201c .\/lsow \/dev\/ttyUSB0 \u201d\u5c31\u5e94\u8be5\u53ef\u4ee5\u770b\u5230 One-Wire bus \u4e0a\u7684\u8bbe\u5907\uff08\u624b\u5934\u53ea\u6709\u4e00\u4e2a DS18B20 \u6e29\u5ea6\u4f20\u611f\u5668\uff0c\u8fd8\u662f\u9632\u6c34\u4e0d\u9508\u94a2\u5c01\u7684\uff0c\u770b\u4e0d\u5230\u771f\u8eab\uff09\u3002\u5176\u4e2d\uff0cttyUSB0 \u662f\u4f60\u4f7f\u7528\u7684 USB \u8f6c\u4e32\u53e3\u8bbe\u5907\u3002<\/p>\n<p><a href=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/lsow.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4146\" alt=\"lsow\" src=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/lsow-400x187.png\" width=\"400\" height=\"187\" srcset=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/lsow-400x187.png 400w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/lsow-1024x480.png 1024w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/lsow.png 1366w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>digitemp_evil \u5219\u662f\u4e3a DS18x20\/DS1822 \u6e29\u5ea6\u4f20\u611f\u5668\u8bbe\u8ba1\u7684\uff0c\u7528\u6cd5\u540c lsow \uff0c\u5176\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><a href=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1489.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4142\" alt=\"IMG_1489\" src=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1489-400x300.jpg\" width=\"400\" height=\"300\" srcset=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1489-400x300.jpg 400w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1489-1024x768.jpg 1024w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/IMG_1489.jpg 2024w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>\u6ce8\u610f DS18B20 \u7b2c\u4e00\u6b21\u590d\u4f4d\u540e\u53ef\u80fd\u663e\u793a\u6e29\u5ea6\u4e3a 85\u00b0C \uff0c\u518d\u8bd5\u4e00\u6b21\u5373\u53ef\u83b7\u5f97\u6b63\u786e\u6e29\u5ea6\u3002<\/p>\n<p>\u7a0d\u4f5c\u4fee\u6539\u52a0\u4e86\u70b9\u4fe1\u606f\uff0c\u622a\u5c4f\uff1a<\/p>\n<p><a href=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/owuart.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4144\" alt=\"owuart\" src=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/owuart-400x187.png\" width=\"400\" height=\"187\" srcset=\"http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/owuart-400x187.png 400w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/owuart-1024x480.png 1024w, http:\/\/blog.dword1511.info\/wp-uploads\/2013\/04\/owuart.png 1366w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>\u662f\u4e0d\u662f\u5f88\u6709\u610f\u601d\u800c\u4e14\u5f88\u5b9e\u7528\u5462\uff1f\u5982\u679c\u6709\u591a\u4e2a\u4f20\u611f\u5668\uff0c\u76f4\u63a5\u5e76\u63a5\u5c31\u53ef\u4ee5\u4e86\uff0c\u8fd9\u4e5f\u662f One Wire \u7684\u4e00\u5927\u4f18\u52bf\u3002<\/p>\n<p>\u8f6f\u4ef6 + \u786c\u4ef6\u4ece\u8bbe\u8ba1\u3001\u5f00\u53d1\u5230\u8c03\u8bd5\u5b8c\u6bd5\u4e5f\u5c31\u4e00\u5929\u4e0d\u5230\u7684\u65f6\u95f4\uff0c\u6548\u7387\u9ad8\u554a\u3002<\/p>\n<p>\u8bdd\u8bf4\u770b\u5230\u8fd9\u91cc\uff0c\u4e0d\u77e5\u9053\u90a3\u4e9b\u4e70\u4e86\u4e13\u7528\u8f6c\u63a5\u5668\u7684\u4f5c\u548c\u611f\u60f3\u554a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dallas \uff08\u73b0\u5df2\u88ab\u7f8e\u4fe1\u6536\u8d2d\uff09\u7684 One Wire \u603b\u7ebf\u662f\u4e2a\u5f88\u6709\u610f\u601d\u7684\u4e1c\u897f\u3002\u5b83\u63d0\u4f9b\u8f83\u4f4e\u7684\u6570\u636e\u901f\u7387\u548c\u7b80\u5355\u7684\u8fde\u63a5 &hellip; <a href=\"http:\/\/blog.dword1511.info\/?p=4139\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">PC \u4e0a\u8bfb\u5199 Dallas 1-Wire \u603b\u7ebf\u7b80\u5355\u6613\u884c\u7684\u65b9\u6cd5<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[14,8,9],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/posts\/4139"}],"collection":[{"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4139"}],"version-history":[{"count":4,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/posts\/4139\/revisions"}],"predecessor-version":[{"id":4149,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=\/wp\/v2\/posts\/4139\/revisions\/4149"}],"wp:attachment":[{"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4139"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.dword1511.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}