{"id":45411,"date":"2023-10-03T13:54:51","date_gmt":"2023-10-03T05:54:51","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=45411"},"modified":"2023-10-03T13:54:51","modified_gmt":"2023-10-03T05:54:51","slug":"rhsysdll","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/45411.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528STM32\u70b9\u4eaeLED"},"content":{"rendered":"
STM32\u662f\u4e00\u6b3e\u9ad8\u6027\u80fd\u768432\u4f4d\u5fae\u63a7\u5236\u5668\uff0c\u5177\u6709\u9ad8\u6027\u80fd\u3001\u4f4e\u529f\u8017\u3001\u6613\u7528\u6027\u7b49\u4f18\u70b9\uff0c\u5728\u5de5\u4e1a\u63a7\u5236\u3001\u667a\u80fd\u5bb6\u5c45\u3001\u6c7d\u8f66\u7535\u5b50\u7b49\u9886\u57df\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528STM32\u70b9\u4eaeLED\uff0c\u4ee5\u53ca\u5982\u4f55\u7f16\u5199\u7a0b\u5e8f\u6765\u5b9e\u73b0\u706f\u7684\u95ea\u70c1\u6548\u679c\u3002<\/p>\n
\u8981\u4f7f\u7528STM32\u70b9\u4eaeLED\uff0c\u9996\u5148\u9700\u8981\u5c06LED\u8fde\u63a5\u5230STM32\u677f\u4e0a\u3002STM32\u5f00\u53d1\u677f\u4e0a\u6709\u591a\u4e2a\u53ef\u4ee5\u63a7\u5236LED\u7684\u5f15\u811a\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u4efb\u610f\u4e00\u4e2a\u5f15\u811a\u6765\u8fdb\u884c\u8fde\u63a5\uff0c\u6bd4\u5982\uff1aPA1\u3001PA2\u3001PA3\u7b49\u3002\u5c06LED\u7684\u6b63\u6781\u63a5\u5230\u6307\u5b9a\u7684\u5f15\u811a\uff0c\u5c06LED\u7684\u8d1f\u6781\u63a5\u5230GND\u5f15\u811a\u3002<\/p>\n
\u786c\u4ef6\u8fde\u63a5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u7f16\u5199\u7a0b\u5e8f\u4e86\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528STM32CubeIDE\u6216IAR\u7b49\u7f16\u8bd1\u5668\u6765\u7f16\u5199\u7a0b\u5e8f\u3002\u5728\u7f16\u5199\u7a0b\u5e8f\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u4e86\u89e3STM32\u7684GPIO\u6a21\u5f0f\uff0c\u8fd9\u662f\u7a0b\u5e8f\u7684\u5173\u952e\u3002STM32\u7684GPIO\u6a21\u5f0f\u6709\u8f93\u5165\u6a21\u5f0f\u548c\u8f93\u51fa\u6a21\u5f0f\uff0c\u6211\u4eec\u9700\u8981\u5c06GPIO\u8bbe\u7f6e\u4e3a\u8f93\u51fa\u6a21\u5f0f\uff0c\u624d\u80fd\u63a7\u5236LED\u7684\u4eae\u706d\u3002<\/p>\n
\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528GPIO_Mode_OUT\u51fd\u6570\u6765\u8bbe\u7f6eGPIO\u7684\u6a21\u5f0f\uff0c\u8be5\u51fd\u6570\u7528\u4e8e\u5c06GPIO\u8bbe\u7f6e\u4e3a\u8f93\u51fa\u6a21\u5f0f\u3002\u51fd\u6570\u7684\u53c2\u6570\u4e3aGPIO\u7684\u5730\u5740\u548c\u6a21\u5f0f\uff0c\u6a21\u5f0f\u6709\u4e24\u79cd\uff1aGPIO_Mode_OUT\u548cGPIO_Mode_IN\u3002\u6211\u4eec\u9700\u8981\u5c06GPIO\u8bbe\u7f6e\u4e3a\u8f93\u51fa\u6a21\u5f0f\uff0c\u56e0\u6b64\u53c2\u6570\u4e2d\u7684\u6a21\u5f0f\u5e94\u8be5\u8bbe\u7f6e\u4e3aGPIO_Mode_OUT\u3002<\/p>\n
\u4f7f\u7528GPIO_WriteBit\u51fd\u6570\u53ef\u4ee5\u63a7\u5236GPIO\u7684\u72b6\u6001\uff0c\u8be5\u51fd\u6570\u7528\u4e8e\u5c06GPIO\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\u6216\u4f4e\u7535\u5e73\u3002\u51fd\u6570\u7684\u53c2\u6570\u4e3aGPIO\u7684\u5730\u5740\u548c\u72b6\u6001\uff0c\u72b6\u6001\u6709\u4e24\u79cd\uff1aGPIO_Pin_SET\u548cGPIO_Pin_RESET\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u4e0d\u540c\u7684\u72b6\u6001\u6765\u63a7\u5236LED\u7684\u4eae\u706d\u3002<\/p>\n
\u4e3a\u4e86\u5b9e\u73b0LED\u7684\u95ea\u70c1\u6548\u679c\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u5ef6\u65f6\u51fd\u6570\uff0c\u5c06GPIO\u7684\u72b6\u6001\u5728\u4e00\u5b9a\u65f6\u95f4\u95f4\u9694\u5185\u53cd\u590d\u5207\u6362\uff0c\u4ece\u800c\u5b9e\u73b0LED\u7684\u95ea\u70c1\u6548\u679c\u3002STM32\u63d0\u4f9b\u4e86\u591a\u79cd\u5ef6\u65f6\u51fd\u6570\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u9009\u62e9\u5408\u9002\u7684\u5ef6\u65f6\u51fd\u6570\u6765\u5b9e\u73b0LED\u95ea\u70c1\u6548\u679c\u3002<\/p>\n
\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528STM32\u70b9\u4eaeLED\u7684\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5982\u4f55\u7f16\u5199\u7a0b\u5e8f\u6765\u5b9e\u73b0LED\u7684\u95ea\u70c1\u6548\u679c\u3002<\/strong>\u6211\u4eec\u9700\u8981\u5148\u5c06LED\u8fde\u63a5\u5230STM32\u677f\u4e0a\uff0c\u7136\u540e\u4f7f\u7528\u7f16\u8bd1\u5668\u6765\u7f16\u5199\u7a0b\u5e8f\uff0c\u8bbe\u7f6eGPIO\u6a21\u5f0f\u548c\u72b6\u6001\uff0c\u6700\u540e\u4f7f\u7528\u5ef6\u65f6\u51fd\u6570\u6765\u5b9e\u73b0LED\u7684\u95ea\u70c1\u6548\u679c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" STM32\u662f\u4e00\u6b3e\u9ad8\u6027\u80fd\u768432\u4f4d\u5fae\u63a7\u5236\u5668\uff0c\u5177\u6709\u9ad8\u6027\u80fd\u3001\u4f4e\u529f\u8017\u3001\u6613\u7528\u6027\u7b49\u4f18\u70b9\uff0c\u5728\u5de5\u4e1a\u63a7\u5236\u3001\u667a\u80fd\u5bb6\u5c45\u3001\u6c7d\u8f66\u7535\u5b50\u7b49\u9886\u57df\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528STM32\u70b9\u4eaeLED\uff0c\u4ee5\u53ca\u5982<\/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":[287],"class_list":["post-45411","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-stm32"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45411","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=45411"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/45411\/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=45411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=45411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=45411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}