{"id":40717,"date":"2023-09-30T07:00:15","date_gmt":"2023-09-29T23:00:15","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=40717"},"modified":"2023-09-30T07:00:15","modified_gmt":"2023-09-29T23:00:15","slug":"sbtljs","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/40717.html","title":{"rendered":"SPI\u6ce2\u7279\u7387\u8ba1\u7b97"},"content":{"rendered":"
SPI\uff08Serial Peripheral Interface\uff09\u6ce2\u7279\u7387\u8ba1\u7b97\u662f\u4e00\u79cd\u5e94\u7528\u4e8e\u4e32\u884c\u5916\u56f4\u8bbe\u5907\u7684\u901a\u4fe1\u6280\u672f\uff0c\u5b83\u662f\u4e00\u79cd\u5168\u53cc\u5de5\u7684\u5f02\u6b65\u901a\u4fe1\u534f\u8bae\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u8bbe\u5907\u4e4b\u95f4\u8fdb\u884c\u9ad8\u901f\u6570\u636e\u4f20\u8f93\u3002SPI\u6ce2\u7279\u7387\u8ba1\u7b97\u7684\u91cd\u8981\u6027\u5728\u4e8e\u5b83\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u4f18\u5316\u6570\u636e\u4f20\u8f93\u901f\u7387\uff0c\u4ece\u800c\u63d0\u9ad8\u6570\u636e\u4f20\u8f93\u7684\u6548\u7387\u3002\u672c\u6587\u5c06\u4ecb\u7ecdSPI\u6ce2\u7279\u7387\u8ba1\u7b97\u7684\u57fa\u672c\u539f\u7406\uff0c\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7\u8ba1\u7b97\u6765\u4f18\u5316\u6570\u636e\u4f20\u8f93\u901f\u7387\u3002<\/p>\n
SPI\u6ce2\u7279\u7387\u8ba1\u7b97\u7684\u57fa\u672c\u539f\u7406\u662f\uff0c\u5f53\u5916\u56f4\u8bbe\u5907\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u8d85\u8fc7\u5b83\u7684\u6700\u5927\u5904\u7406\u80fd\u529b\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u6570\u636e\u4f20\u8f93\u5931\u8d25\u7684\u60c5\u51b5\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u6548\u6027\uff0c\u6211\u4eec\u5fc5\u987b\u6839\u636e\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\uff0c\u6b63\u786e\u8ba1\u7b97\u51fa\u5408\u9002\u7684\u6ce2\u7279\u7387\u3002<\/p>\n
SPI\u6ce2\u7279\u7387\u8ba1\u7b97\u7684\u516c\u5f0f\u4e3a\uff1aBaud rate = Clock speed \/ (2 * (SPCR + 1))\uff0c\u5176\u4e2d\uff0cClock speed\u8868\u793aSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\uff0cSPCR\u8868\u793aSPI\u603b\u7ebf\u7684\u6570\u636e\u4f4d\u5bbd\u3002<\/p>\n
\u5047\u8bbe\u6211\u4eec\u8981\u8ba1\u7b97\u4e00\u4e2aSPI\u603b\u7ebf\u7684\u6ce2\u7279\u7387\uff0c\u5b83\u7684\u65f6\u949f\u9891\u7387\u4e3a16MHz\uff0c\u6570\u636e\u4f4d\u5bbd\u4e3a8\u4f4d\uff0c\u5219\u6839\u636e\u4e0a\u9762\u7684\u516c\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u51fa\u5b83\u7684\u6ce2\u7279\u7387\u4e3a\uff1aBaud rate = 16MHz \/ (2 * (8 + 1)) = 1MHz\u3002<\/p>\n
\u5f53\u5916\u56f4\u8bbe\u5907\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u8d85\u8fc7\u5b83\u7684\u6700\u5927\u5904\u7406\u80fd\u529b\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u6570\u636e\u4f20\u8f93\u5931\u8d25\u7684\u60c5\u51b5\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u6548\u6027\uff0c\u6211\u4eec\u5fc5\u987b\u6839\u636e\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\uff0c\u6b63\u786e\u8ba1\u7b97\u51fa\u5408\u9002\u7684\u6ce2\u7279\u7387\u3002<\/p>\n
\u4e3a\u4e86\u786e\u4fddSPI\u603b\u7ebf\u7684\u6ce2\u7279\u7387\u80fd\u591f\u6ee1\u8db3\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\u8981\u6c42\uff0c\u6211\u4eec\u9996\u5148\u8981\u6839\u636e\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\uff0c\u6b63\u786e\u8ba1\u7b97\u51fa\u5408\u9002\u7684\u6ce2\u7279\u7387\u3002<\/p>\n
\u6839\u636eSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\u548c\u6570\u636e\u4f4d\u5bbd\uff0c\u6211\u4eec\u53ef\u4ee5\u8c03\u6574SPI\u603b\u7ebf\u7684\u6ce2\u7279\u7387\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u6548\u6027\u3002<\/p>\n
\u6839\u636eSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\u548c\u6570\u636e\u4f4d\u5bbd\uff0c\u6211\u4eec\u53ef\u4ee5\u8c03\u8282\u6570\u636e\u4f20\u8f93\u901f\u7387\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u6548\u6027\u3002<\/p>\n
\u672c\u6587\u4ecb\u7ecd\u4e86SPI\u6ce2\u7279\u7387\u8ba1\u7b97\u7684\u57fa\u672c\u539f\u7406\uff0c\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7\u8ba1\u7b97\u6765\u4f18\u5316\u6570\u636e\u4f20\u8f93\u901f\u7387\u3002<\/strong>SPI\u6ce2\u7279\u7387\u7684\u8ba1\u7b97\u516c\u5f0f\u4e3a\uff1aBaud rate = Clock speed \/ (2 * (SPCR + 1))\uff0c\u5176\u4e2d\uff0cClock speed\u8868\u793aSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\uff0cSPCR\u8868\u793aSPI\u603b\u7ebf\u7684\u6570\u636e\u4f4d\u5bbd\u3002\u4e3a\u4e86\u786e\u4fddSPI\u603b\u7ebf\u7684\u6ce2\u7279\u7387\u80fd\u591f\u6ee1\u8db3\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\u8981\u6c42\uff0c\u6211\u4eec\u9996\u5148\u8981\u6839\u636e\u5916\u56f4\u8bbe\u5907\u7684\u6027\u80fd\uff0c\u6b63\u786e\u8ba1\u7b97\u51fa\u5408\u9002\u7684\u6ce2\u7279\u7387\uff0c\u7136\u540e\u6839\u636eSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\u548c\u6570\u636e\u4f4d\u5bbd\u8c03\u6574\u6ce2\u7279\u7387\uff0c\u6700\u540e\u6839\u636eSPI\u603b\u7ebf\u7684\u65f6\u949f\u9891\u7387\u548c\u6570\u636e\u4f4d\u5bbd\u8c03\u8282\u6570\u636e\u4f20\u8f93\u901f\u7387\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u6548\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" SPI\uff08SerialPeripheralInterface\uff09\u6ce2\u7279\u7387\u8ba1\u7b97\u662f\u4e00\u79cd\u5e94\u7528\u4e8e\u4e32\u884c\u5916\u56f4\u8bbe\u5907\u7684\u901a\u4fe1\u6280\u672f\uff0c\u5b83\u662f\u4e00\u79cd\u5168\u53cc\u5de5\u7684\u5f02\u6b65\u901a\u4fe1\u534f\u8bae\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u8bbe\u5907\u4e4b\u95f4\u8fdb\u884c\u9ad8\u901f\u6570<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[175],"class_list":["post-40717","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-btl"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/40717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=40717"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/40717\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=40717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=40717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=40717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}