{"id":2195,"date":"2019-03-09T02:37:19","date_gmt":"2019-03-09T02:37:19","guid":{"rendered":""},"modified":"2019-03-09T10:37:34","modified_gmt":"2019-03-09T02:37:34","slug":"%e5%8d%95%e7%89%87%e6%9c%bai2c%e6%80%bb%e7%ba%bf%e7%9a%84%e5%ba%94%e7%94%a8%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2195","title":{"rendered":"\u5355\u7247\u673aI2C\u603b\u7ebf\u7684\u5e94\u7528\u539f\u7406"},"content":{"rendered":"
\n\t\u5728\u786c\u4ef6\u4e0a\uff0cI2C<\/u>\u603b\u7ebf\u662f\u7531\u65f6\u949f<\/u>\u603b\u7ebfSCL\u548c\u6570\u636e\u603b\u7ebfSDA\u4e24\u6761\u7ebf\u6784\u6210\uff0c\u8fde\u63a5\u5230\u603b\u7ebf\u4e0a\u7684\u6240\u6709\u5668\u4ef6\u7684SCL\u90fd\u8fde\u5230\u4e00\u8d77\uff0c\u6240\u6709SDA\u90fd\u8fde\u5230\u4e00\u8d77\u3002I2C\u603b\u7ebf\u662f\u5f00\u6f0f\u5f15\u811a\u5e76\u8054\u7684\u7ed3\u6784\uff0c\u56e0\u6b64\u6211\u4eec\u5916\u90e8\u8981\u6dfb\u52a0\u4e0a\u62c9\u7535\u963b<\/u>\u3002\u5bf9\u4e8e\u5f00\u6f0f\u7535\u8def<\/u>\u5916\u90e8\u52a0\u4e0a\u62c9\u7535\u963b\uff0c\u5c31\u7ec4\u6210\u4e86\u7ebf“\u4e0e”\u7684\u5173\u7cfb\u3002\u603b\u7ebf\u4e0a\u7ebf“\u4e0e”\u7684\u5173\u7cfb\u5c31\u662f\u8bf4\uff0c\u6240\u6709\u63a5\u5165\u7684\u5668\u4ef6\u4fdd\u6301\u9ad8\u7535\u5e73\uff0c\u8fd9\u6761\u7ebf\u624d\u662f\u9ad8\u7535\u5e73\uff0c\u800c\u4efb\u4f55\u4e00\u4e2a\u5668\u4ef6\u8f93\u51fa\u4e00\u4e2a\u4f4e\u7535\u5e73\uff0c\u90a3\u8fd9\u6761\u7ebf\u5c31\u4f1a\u4fdd\u6301\u4f4e\u7535\u5e73\uff0c\u56e0\u6b64\u53ef\u4ee5\u505a\u5230\u4efb\u4f55\u4e00\u4e2a\u5668\u4ef6\u90fd\u53ef\u4ee5\u62c9\u4f4e\u7535\u5e73\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u4e00\u4e2a\u5668\u4ef6\u90fd\u53ef\u4ee5\u4f5c\u4e3a\u4e3b\u673a\uff0c\u5982\u56fe14-1\u6240\u793a\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86 R63 \u548c R64 \u4e24\u4e2a\u4e0a\u62c9\u7535\u963b\u3002<\/p>\n
\n\t<\/p>\n
\n\t\u56fe14-1 I2C \u603b\u7ebf\u7684\u4e0a\u62c9\u7535\u963b<\/p>\n
\n\t\u867d\u7136\u8bf4\u4efb\u4f55\u4e00\u4e2a\u8bbe\u5907\u90fd\u53ef\u4ee5\u4f5c\u4e3a\u4e3b\u673a\uff0c\u4f46\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u6211\u4eec\u90fd\u662f\u7528\u5355\u7247\u673a<\/u>\u6765\u505a\u4e3b\u673a\uff0c\u800c\u603b\u7ebf\u4e0a\u6302\u7684\u591a\u4e2a\u5668\u4ef6\uff0c\u6bcf\u4e00\u4e2a\u90fd\u50cf\u7535\u8bdd\u673a\u4e00\u6837\u6709\u81ea\u5df1\u552f\u4e00\u7684\u5730\u5740\uff0c\u5728\u4fe1\u606f\u4f20\u8f93\u7684\u8fc7\u7a0b\u4e2d\uff0c\u901a\u8fc7\u8fd9\u552f\u4e00\u7684\u5730\u5740\u5c31\u53ef\u4ee5\u6b63\u5e38\u8bc6\u522b\u5230\u5c5e\u4e8e\u81ea\u5df1\u7684\u4fe1\u606f\uff0c\u5728 KST-51 \u5f00\u53d1\u677f\u4e0a\uff0c\u5c31\u6302\u63a5\u4e862\u4e2a I2C \u8bbe\u5907\uff0c\u4e00\u4e2a\u662f 24C02\uff0c\u4e00\u4e2a\u662f PCF8591\u3002<\/p>\n
\n\t\u6211\u4eec\u5728\u5b66\u4e60 UART<\/u> \u4e32\u884c\u901a\u4fe1\u7684\u65f6\u5019\uff0c\u77e5\u9053\u4e86\u901a\u4fe1\u6d41\u7a0b\u5206\u4e3a\u8d77\u59cb\u4f4d\u3001\u6570\u636e\u4f4d\u3001\u505c\u6b62\u4f4d\u8fd9\u4e09\u90e8\u5206\uff0c\u540c\u7406\u5728 I2C \u4e2d\u4e5f\u6709\u8d77\u59cb\u4fe1\u53f7\u3001\u6570\u636e\u4f20\u8f93\u548c\u505c\u6b62\u4fe1\u53f7\uff0c\u5982\u56fe14-2\u6240\u793a\u3002<\/p>\n
\n\t<\/p>\n
\n\t\u56fe14-2 I2C \u65f6\u5e8f\u6d41\u7a0b\u56fe<\/p>\n
\n\t\u4ece\u56fe\u4e0a\u53ef\u4ee5\u770b\u51fa\u6765\uff0cI2C \u548c UART \u65f6\u5e8f\u6d41\u7a0b\u6709\u76f8\u4f3c\u6027\uff0c\u4e5f\u6709\u4e00\u5b9a\u7684\u533a\u522b\u3002UART \u6bcf\u4e2a\u5b57\u8282\u4e2d\uff0c\u90fd\u6709\u4e00\u4e2a\u8d77\u59cb\u4f4d\u30018\u4e2a\u6570\u636e\u4f4d\u30011\u4f4d\u505c\u6b62\u4f4d\u3002\u800c I2C \u5206\u4e3a\u8d77\u59cb\u4fe1\u53f7\u3001\u6570\u636e\u4f20\u8f93\u90e8\u5206\u3001\u505c\u6b62\u4fe1\u53f7\u3002\u5176\u4e2d\u6570\u636e\u4f20\u8f93\u90e8\u5206\uff0c\u53ef\u4ee5\u4e00\u6b21\u901a\u4fe1\u8fc7\u7a0b\u4f20\u8f93\u5f88\u591a\u4e2a\u5b57\u8282\uff0c\u5b57\u8282\u6570\u662f\u4e0d\u53d7\u9650\u5236\u7684\uff0c\u800c\u6bcf\u4e2a\u5b57\u8282\u7684\u6570\u636e\u6700\u540e\u4e5f\u8ddf\u4e86\u4e00\u4f4d\uff0c\u8fd9\u4e00\u4f4d\u53eb\u505a\u5e94\u7b54\u4f4d\uff0c\u901a\u5e38\u7528 ACK \u8868\u793a\uff0c\u6709\u70b9\u7c7b\u4f3c\u4e8e UART \u7684\u505c\u6b62\u4f4d\u3002<\/p>\n
\n\t\u4e0b\u9762\u6211\u4eec\u4e00\u90e8\u5206\u4e00\u90e8\u5206\u7684\u628a I2C \u901a\u4fe1\u65f6\u5e8f\u8fdb\u884c\u5256\u6790\u3002\u4e4b\u524d\u6211\u4eec\u5df2\u7ecf\u5b66\u8fc7\u4e86 UART\uff0c\u6240\u4ee5\u5b66\u4e60 I2C \u7684\u8fc7\u7a0b\u6211\u5c3d\u91cf\u62ff UART \u6765\u4f5c\u4e3a\u5bf9\u6bd4\uff0c\u8fd9\u6837\u6709\u52a9\u4e8e\u66f4\u597d\u7684\u7406\u89e3\u3002\u4f46\u662f\u6709\u4e00\u70b9\u5927\u5bb6\u8981\u7406\u89e3\u6e05\u695a\uff0c\u5c31\u662f UART \u901a\u4fe1\u867d\u7136\u7528\u4e86 TXD \u548c RXD \u4e24\u6839\u7ebf\uff0c\u4f46\u662f\u5b9e\u9645\u4e00\u6b21\u901a\u4fe1\u4e2d\uff0c1\u6761\u7ebf\u5c31\u53ef\u4ee5\u5b8c\u6210\uff0c2\u6761\u7ebf\u662f\u628a\u53d1\u9001\u548c\u63a5\u6536\u5206\u5f00\u800c\u5df2\uff0c\u800c I2C \u6bcf\u6b21\u901a\u4fe1\uff0c\u4e0d\u7ba1\u662f\u53d1\u9001\u8fd8\u662f\u63a5\u6536\uff0c\u5fc5\u987b2\u6761\u7ebf\u90fd\u53c2\u4e0e\u5de5\u4f5c\u624d\u80fd\u5b8c\u6210\uff0c\u4e3a\u4e86\u66f4\u65b9\u4fbf\u7684\u770b\u51fa\u6765\u6bcf\u4e00\u4f4d\u7684\u4f20\u8f93\u6d41\u7a0b\uff0c\u6211\u4eec\u628a\u56fe14-2\u6539\u8fdb\u6210\u56fe14-3\u3002<\/p>\n
\n\t<\/p>\n
\n\t\u56fe14-3 I2C \u901a\u4fe1\u6d41\u7a0b\u89e3\u6790<\/p>\n
\n\t\u8d77\u59cb\u4fe1\u53f7\uff1aUART \u901a\u4fe1\u662f\u4ece\u4e00\u76f4\u6301\u7eed\u7684\u9ad8\u7535\u5e73\u51fa\u73b0\u4e00\u4e2a\u4f4e\u7535\u5e73\u6807\u5fd7\u8d77\u59cb\u4f4d\uff1b\u800c I2C \u901a\u4fe1\u7684\u8d77\u59cb\u4fe1\u53f7\u7684\u5b9a\u4e49\u662f SCL \u4e3a\u9ad8\u7535\u5e73\u671f\u95f4\uff0cSDA \u7531\u9ad8\u7535\u5e73\u5411\u4f4e\u7535\u5e73\u53d8\u5316\u4ea7\u751f\u4e00\u4e2a\u4e0b\u964d\u6cbf\uff0c\u8868\u793a\u8d77\u59cb\u4fe1\u53f7\uff0c\u5982\u56fe14-3\u4e2d\u7684 Start \u90e8\u5206\u6240\u793a\u3002<\/p>\n
\n\t\u6570\u636e\u4f20\u8f93\uff1a\u9996\u5148\uff0cUART \u662f\u4f4e\u4f4d\u5728\u524d\uff0c\u9ad8\u4f4d\u5728\u540e\uff1b\u800c I2C \u901a\u4fe1\u662f\u9ad8\u4f4d\u5728\u524d\uff0c\u4f4e\u4f4d\u5728\u540e\u3002\u5176\u6b21\uff0cUART \u901a\u4fe1\u6570\u636e\u4f4d\u662f\u56fa\u5b9a\u957f\u5ea6\uff0c\u6ce2\u7279\u7387\u5206\u4e4b\u4e00\uff0c\u4e00\u4f4d\u4e00\u4f4d\u56fa\u5b9a\u65f6\u95f4\u53d1\u9001\u5b8c\u6bd5\u5c31\u53ef\u4ee5\u4e86\u3002\u800c I2C \u6ca1\u6709\u56fa\u5b9a\u6ce2\u7279\u7387\uff0c\u4f46\u662f\u6709\u65f6\u5e8f\u7684\u8981\u6c42\uff0c\u8981\u6c42\u5f53 SCL \u5728\u4f4e\u7535\u5e73\u7684\u65f6\u5019\uff0cSDA \u5141\u8bb8\u53d8\u5316\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u53d1\u9001\u65b9\u5fc5\u987b\u5148\u4fdd\u6301 SCL \u662f\u4f4e\u7535\u5e73\uff0c\u624d\u53ef\u4ee5\u6539\u53d8\u6570\u636e\u7ebf SDA\uff0c\u8f93\u51fa\u8981\u53d1\u9001\u7684\u5f53\u524d\u6570\u636e\u7684\u4e00\u4f4d\uff1b\u800c\u5f53 SCL \u5728\u9ad8\u7535\u5e73\u7684\u65f6\u5019\uff0cSDA \u7edd\u5bf9\u4e0d\u53ef\u4ee5\u53d8\u5316\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u65f6\u5019\uff0c\u63a5\u6536\u65b9\u8981\u6765\u8bfb\u53d6\u5f53\u524d SDA \u7684\u7535\u5e73\u4fe1\u53f7\u662f0\u8fd8\u662f1\uff0c\u56e0\u6b64\u8981\u4fdd\u8bc1 SDA \u7684\u7a33\u5b9a\uff0c\u5982\u56fe14-3\u4e2d\u7684\u6bcf\u4e00\u4f4d\u6570\u636e\u7684\u53d8\u5316\uff0c\u90fd\u662f\u5728 SCL \u7684\u4f4e\u7535\u5e73\u4f4d\u7f6e\u30028\u4f4d\u6570\u636e\u4f4d\u540e\u8fb9\u8ddf\u7740\u7684\u662f\u4e00\u4f4d\u5e94\u7b54\u4f4d\uff0c\u5e94\u7b54\u4f4d\u6211\u4eec\u540e\u8fb9\u8fd8\u8981\u5177\u4f53\u4ecb\u7ecd\u3002<\/p>\n
\n\t\u505c\u6b62\u4fe1\u53f7\uff1aUART \u901a\u4fe1\u7684\u505c\u6b62\u4f4d\u662f\u4e00\u4f4d\u56fa\u5b9a\u7684\u9ad8\u7535\u5e73\u4fe1\u53f7\uff1b\u800c I2C \u901a\u4fe1\u505c\u6b62\u4fe1\u53f7\u7684\u5b9a\u4e49\u662f SCL \u4e3a\u9ad8\u7535\u5e73\u671f\u95f4\uff0cSDA \u7531\u4f4e\u7535\u5e73\u5411\u9ad8\u7535\u5e73\u53d8\u5316\u4ea7\u751f\u4e00\u4e2a\u4e0a\u5347\u6cbf\uff0c\u8868\u793a\u7ed3\u675f\u4fe1\u53f7\uff0c\u5982\u56fe14-3\u4e2d\u7684 Stop \u90e8\u5206\u6240\u793a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5728\u786c\u4ef6\u4e0a\uff0c I2C \u603b\u7ebf\u662f\u7531 \u65f6\u949f \u603b\u7ebfSCL\u548c\u6570\u636e\u603b\u7ebfSDA\u4e24\u6761\u7ebf\u6784\u6210\uff0c\u8fde\u63a5\u5230\u603b\u7ebf\u4e0a\u7684\u6240\u6709\u5668\u4ef6\u7684SCL\u90fd\u8fde\u5230\u4e00\u8d77\uff0c\u6240\u6709SDA\u90fd\u8fde\u5230\u4e00\u8d77\u3002I2C\u603b\u7ebf\u662f\u5f00\u6f0f\u5f15\u811a\u5e76\u8054\u7684\u7ed3\u6784\uff0c\u56e0\u6b64\u6211\u4eec\u5916\u90e8\u8981\u6dfb\u52a0\u4e0a\u62c9<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2195"}],"collection":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2195"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2195\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2195"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}