{"id":77429,"date":"2026-02-24T17:33:52","date_gmt":"2026-02-24T09:33:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/77429.html"},"modified":"2026-02-24T17:33:52","modified_gmt":"2026-02-24T09:33:52","slug":"%e3%80%90stm32%e3%80%91proteus%e4%bb%bf%e7%9c%9fstm32%e6%95%99%e7%a8%8b%ef%bc%88%e5%af%84%e5%ad%98%e5%99%a8%ef%bc%894-%e5%af%84%e5%ad%98%e5%99%a8%e7%89%88%e6%b5%81%e6%b0%b4%e7%81%af%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/77429.html","title":{"rendered":"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094--\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09"},"content":{"rendered":"<p>&#x1f4a1;\u5199\u5728\u524d\u9762<\/p>\n<p>\u5927\u5bb6\u597d&#xff01; \u6700\u8fd1\u5f88\u591a\u521a\u5165\u95e8\u7684\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211&#xff1a;\u4e0a\u8282\u8bfe\u5199\u7684\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f&#xff0c;\u6bcf\u6b21\u6539IO\u7535\u5e73\u90fd\u8981\u5199GPIOB-&gt;ODR |&#061; (1&lt;&lt;n)\u6216\u8005GPIOA-&gt;ODR &amp;&#061; ~(1&lt;&lt;n)&#xff0c;\u79fb\u4f4d\u5199\u591a\u4e86\u5bb9\u6613\u641e\u6df7\u4f4d\u6570&#xff0c;\u8fd8\u62c5\u5fc3\u5199\u9519\u63a9\u7801\u628a\u5176\u4ed6\u4f4d\u6539\u5d29\u4e86&#xff0c;\u6709\u6ca1\u6709\u50cf51\u5355\u7247\u673a\u90a3\u6837sbit LED &#061; P0^0\u76f4\u63a5\u64cd\u4f5c\u67d0\u4e00\u4f4d\u7684\u65b9\u6cd5&#xff1f;<\/p>\n<p>\u5f53\u7136\u6709&#xff01;\u4eca\u5929\u6211\u4eec\u5c31\u5b66\u4e60STM32\u4e13\u95e8\u4e3a\u7b80\u5316\u4f4d\u64cd\u4f5c\u8bbe\u8ba1\u7684\u4f4d\u5e26\u673a\u5236&#xff0c;\u518d\u4e5f\u4e0d\u7528\u8bb0\u590d\u6742\u7684\u4f4d\u4e0e\u3001\u4f4d\u6216\u903b\u8f91&#xff0c;\u65b0\u624b\u4e5f\u80fd\u5199\u51fa\u53ef\u8bfb\u6027\u62c9\u6ee1\u7684\u5bc4\u5b58\u5668\u4ee3\u7801~<\/p>\n<p>\u51c6\u5907\u597d\u4e86\u5417&#xff1f;\u5750\u7a33\u6276\u597d&#xff0c;\u6211\u4eec\u8981\u53d1\u8f66\u4e86&#xff01;&#x1f3ce;\ufe0f<\/p>\n<\/p>\n<h4>STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c<\/h4>\n<ul>\n<li>\u4e00\u3001\u5148\u641e\u61c2&#xff1a;\u4ec0\u4e48\u662f\u4f4d\u5e26\u64cd\u4f5c&#xff1f;\u4e3a\u4ec0\u4e48\u6211\u4eec\u9700\u8981\u5b83&#xff1f;<\/li>\n<li>\n<ul>\n<li>1.1 \u4f20\u7edf\u5bc4\u5b58\u5668\u4f4d\u64cd\u4f5c\u7684\u75db\u70b9<\/li>\n<li>1.2 \u4f4d\u5e26\u64cd\u4f5c\u7684\u901a\u4fd7\u89e3\u91ca<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u96f6\u57fa\u7840\u4e5f\u80fd\u7b97&#xff1a;\u4f4d\u5e26\u5730\u5740\u7684\u6362\u7b97\u516c\u5f0f<\/li>\n<li>\n<ul>\n<li>2.1 \u516c\u5f0f\u63a8\u5bfc\u8bf4\u660e<\/li>\n<li>2.2 \u4e3e\u4e2a\u5b9e\u9645\u4f8b\u5b50\u7b97\u4e00\u904d<\/li>\n<li>2.3 \u516c\u5f0f\u4f18\u5316&#xff08;\u5de5\u7a0b\u5b9e\u7528\u7248&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001\u4e00\u52b3\u6c38\u9038&#xff1a;\u628a\u4f4d\u5e26\u64cd\u4f5c\u5c01\u88c5\u6210\u901a\u7528\u5b8f<\/li>\n<li>\u56db\u3001\u5b9e\u64cd&#xff1a;\u7528\u4f4d\u5e26\u64cd\u4f5c\u6539\u5199\u6d41\u6c34\u706f\u7a0b\u5e8f<\/li>\n<li>\n<ul>\n<li>4.1 \u5b8c\u6574\u4ee3\u7801\u793a\u4f8b<\/li>\n<li>4.2 \u4ee3\u7801\u8bb2\u89e3<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001\u4f4d\u5e26\u64cd\u4f5c\u7684\u4f18\u70b9&#xff08;\u4e3a\u4ec0\u4e48\u63a8\u8350\u521d\u5b66\u8005\u5b66&#xff1f;&#xff09;<\/li>\n<li>\u516d\u3001 \u514d\u8d39\u83b7\u53d6\u8d44\u6599&#xff1a;<\/li>\n<\/ul>\n<h2>\u4e00\u3001\u5148\u641e\u61c2&#xff1a;\u4ec0\u4e48\u662f\u4f4d\u5e26\u64cd\u4f5c&#xff1f;\u4e3a\u4ec0\u4e48\u6211\u4eec\u9700\u8981\u5b83&#xff1f;<\/h2>\n<h3>1.1 \u4f20\u7edf\u5bc4\u5b58\u5668\u4f4d\u64cd\u4f5c\u7684\u75db\u70b9<\/h3>\n<p>\u6211\u4eec\u5148\u56de\u5fc6\u4e00\u4e0b\u4e0a\u8282\u8bfe\u64cd\u4f5cPB7\u5f15\u811a\u8f93\u51fa\u7535\u5e73\u7684\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7184\u706dPB7<\/span><br \/>\nGPIOB<span class=\"token operator\">-&gt;<\/span>ODR <span class=\"token operator\">&amp;&#061;<\/span> <span class=\"token operator\">~<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token number\">7<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u70b9\u4eaePB7<\/span><br \/>\nGPIOB<span class=\"token operator\">-&gt;<\/span>ODR <span class=\"token operator\">|&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span> <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token number\">7<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u79cd\u5199\u6cd5\u67093\u4e2a\u5f88\u4e0d\u53cb\u597d\u7684\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u274c \u5bb9\u6613\u5199\u9519\u79fb\u4f4d\u4f4d\u6570&#xff1a;\u6bd4\u5982\u628a7\u5199\u62105&#xff0c;\u64cd\u4f5c\u7684\u5f15\u811a\u76f4\u63a5\u9519\u4e86<\/li>\n<li>\u274c \u53ef\u8bfb\u6027\u5dee&#xff1a;\u65b0\u624b\u770b\u4ee3\u7801\u8981\u53cd\u5e94\u534a\u5929\u624d\u80fd\u77e5\u9053\u662f\u64cd\u4f5c\u7b2c7\u4f4d<\/li>\n<li>\u274c \u98ce\u9669\u9ad8&#xff1a;\u5982\u679c\u63a9\u7801\u5199\u9519&#xff08;\u6bd4\u5982\u6f0f\u5199~&#xff09;&#xff0c;\u4f1a\u628aODR\u5bc4\u5b58\u5668\u7684\u5176\u4ed6\u4f4d\u8986\u76d6&#xff0c;\u5bfc\u81f4\u540c\u7ec4\u5176\u4ed6IO\u7535\u5e73\u5f02\u5e38<\/li>\n<\/ul>\n<p>\u90a3\u6709\u6ca1\u6709\u529e\u6cd5\u76f4\u63a5\u7ed9\u67d0\u4e00\u4e2aIO\u5f15\u811a\u7684\u7535\u5e73\u8d4b\u503c&#xff0c;\u5b8c\u5168\u4e0d\u5f71\u54cd\u5176\u4ed6\u4f4d&#xff1f;\u5c31\u50cf\u8fd9\u6837&#xff1a;<\/p>\n<p>PB7 <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u76f4\u63a5\u70b9\u4eaePC13<\/span><br \/>\nPB7 <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u76f4\u63a5\u7184\u706dPC13<\/span><\/p>\n<p>STM32\u7684\u4f4d\u5e26\u64cd\u4f5c&#xff0c;\u5c31\u662f\u5e2e\u6211\u4eec\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u7684\u5e95\u5c42\u673a\u5236\u3002<\/p>\n<h3>1.2 \u4f4d\u5e26\u64cd\u4f5c\u7684\u901a\u4fd7\u89e3\u91ca<\/h3>\n<p>\u4f60\u53ef\u4ee5\u628aSTM32\u7684\u5bc4\u5b58\u5668\u5f53\u6210\u4e00\u4e2a\u670932\u4e2a\u683c\u5b50\u7684\u50a8\u7269\u67dc&#xff0c;\u6bcf\u4e2a\u683c\u5b50\u5bf9\u5e941\u4e2abit&#xff0c;\u4f20\u7edf\u64cd\u4f5c\u662f\u8981\u6539\u67d0\u4e00\u4e2a\u683c\u5b50\u7684\u4e1c\u897f&#xff0c;\u5f97\u628a\u6574\u4e2a\u67dc\u5b50\u642c\u51fa\u6765&#xff0c;\u627e\u5230\u5bf9\u5e94\u7684\u683c\u5b50\u6539\u4e86\u518d\u653e\u56de\u53bb&#xff1b;\u800c\u4f4d\u5e26\u64cd\u4f5c\u5c31\u662f\u7ed9\u6bcf\u4e2a\u683c\u5b50\u5355\u72ec\u88c5\u4e86\u4e00\u4e2a\u95e8&#xff0c;\u4f60\u76f4\u63a5\u5f00\u5bf9\u5e94\u683c\u5b50\u7684\u95e8\u5c31\u80fd\u6539\u5185\u5bb9&#xff0c;\u5b8c\u5168\u4e0d\u7528\u78b0\u5176\u4ed6\u683c\u5b50\u3002<\/p>\n<li>\u5b98\u65b9\u4e00\u70b9\u7684\u5b9a\u4e49&#xff1a;<\/li>\n<ul>\n<li>STM32\u7684Cortex-M3\u5185\u6838\u4e13\u95e8\u5212\u5206\u4e86\u4e24\u5757\u300c\u4f4d\u5e26\u533a\u300d&#xff0c;\u4f4d\u5e26\u533a\u7684\u6bcf\u4e00\u4e2abit&#xff0c;\u90fd\u4f1a\u6620\u5c04\u5230\u300c\u4f4d\u5e26\u522b\u540d\u533a\u300d\u7684\u4e00\u4e2a\u72ec\u7acb\u768432\u4f4d\u5730\u5740\u3002\u6211\u4eec\u64cd\u4f5c\u8fd9\u4e2a\u4f4d\u5e26\u522b\u540d\u5730\u5740\u7684\u6700\u4f4e\u4f4d&#xff0c;\u5c31\u7b49\u4ef7\u4e8e\u76f4\u63a5\u64cd\u4f5c\u539f\u5730\u5740\u5bf9\u5e94\u7684\u90a3\u4e2abit&#xff0c;\u786c\u4ef6\u4fdd\u8bc1\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u4f4d\u3002<\/li>\n<\/ul>\n<p>STM32\u6709\u4e24\u4e2a\u4f4d\u5e26\u533a&#xff0c;\u6211\u4eec\u65b0\u624b\u53ea\u9700\u8981\u91cd\u70b9\u5173\u6ce8\u5916\u8bbe\u4f4d\u5e26\u533a\u5c31\u884c&#xff1a;<\/p>\n<table>\n<tr>\u4f4d\u5e26\u533a\u7c7b\u578b\u4f4d\u5e26\u533a\u5730\u5740\u8303\u56f4\u5bf9\u5e94\u7684\u4f4d\u5e26\u522b\u540d\u533a\u5730\u5740\u8303\u56f4\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>\u5916\u8bbe\u4f4d\u5e26\u533a<\/td>\n<td>0x40000000 ~ 0x400FFFFF<\/td>\n<td>0x42000000 ~ 0x43FFFFFF<\/td>\n<td>\u64cd\u4f5cGPIO\u3001\u4e32\u53e3\u3001SPI\u7b49\u5916\u8bbe\u5bc4\u5b58\u5668\u7684\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>SRAM\u4f4d\u5e26\u533a<\/td>\n<td>0x20000000 ~ 0x200FFFFF<\/td>\n<td>0x22000000 ~ 0x23FFFFFF<\/td>\n<td>\u64cd\u4f5cSRAM\u53d8\u91cf\u7684\u67d0\u4e00\u4f4d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li>\u5173\u952e\u6982\u5ff5&#xff1a;\u4f4d\u5e26\u522b\u540d\u533a<\/li>\n<ul>\n<li>\u4f4d\u5e26\u533a\u7684\u6bcf1\u4e2a\u6bd4\u7279&#xff0c;\u90fd\u4f1a\u88ab\u201c\u81a8\u80c0\u201d\u62101\u4e2a32\u4f4d\u7684\u5b57&#xff08;\u53604\u5b57\u8282&#xff09;&#xff0c;\u8fd9\u4e9b\u81a8\u80c0\u51fa\u6765\u7684\u5730\u5740\u96c6\u5408\u5c31\u662f\u300c\u4f4d\u5e26\u522b\u540d\u533a\u300d\u3002<\/li>\n<li>\u6bd4\u5982\u5916\u8bbe\u4f4d\u5e26\u533a\u7684\u67d0\u4e00\u4f4d&#xff0c;\u5bf9\u5e94\u5230\u522b\u540d\u533a\u5c31\u662f\u4e00\u4e2a4\u5b57\u8282\u7684\u5730\u5740&#xff0c;\u4f60\u7ed9\u8fd9\u4e2a\u5730\u5740&#xff08;4\u5b57\u8282&#xff09;\u51991\/0&#xff0c;\u5c31\u7b49\u4e8e\u7ed9 \u539f\u4f4d(1\u4e2a\u6bd4\u7279)\u7f6e1\/0&#xff0c;\u5b8c\u5168\u4e0d\u7528\u5173\u5fc3\u6574\u4e2a\u5bc4\u5b58\u5668\u7684\u5176\u4ed6\u4f4d\u3002<\/li>\n<\/ul>\n<h2>\u4e8c\u3001\u96f6\u57fa\u7840\u4e5f\u80fd\u7b97&#xff1a;\u4f4d\u5e26\u5730\u5740\u7684\u6362\u7b97\u516c\u5f0f<\/h2>\n<p>\u6211\u4eec\u4e0d\u7528\u6b7b\u8bb0\u786c\u80cc\u516c\u5f0f&#xff0c;\u53ea\u8981\u7406\u89e3\u903b\u8f91\u5c31\u80fd\u81ea\u5df1\u63a8\u51fa\u6765&#xff1a;<\/p>\n<p>\u6211\u4eec\u8981\u64cd\u4f5c\u7684\u5bc4\u5b58\u5668\u5730\u5740\u4e3aADDR&#xff0c;\u8981\u64cd\u4f5c\u7684\u662f\u7b2cn\u4f4d&#xff0c;\u90a3\u4e48\u5bf9\u5e94\u7684\u522b\u540d\u5730\u5740\u8ba1\u7b97\u516c\u5f0f\u4e3a&#xff1a;<\/p>\n<ul>\n<li>\u522b\u540d\u5730\u5740 &#061; \u4f4d\u5e26\u522b\u540d\u533a\u57fa\u5730\u5740 &#043; (ADDR &#8211; \u4f4d\u5e26\u533a\u57fa\u5730\u5740) * 32 &#043; n * 4<\/li>\n<\/ul>\n<h3>2.1 \u516c\u5f0f\u63a8\u5bfc\u8bf4\u660e<\/h3>\n<p>\u7ed9\u5927\u5bb6\u62c6\u89e3\u4e00\u4e0b\u6bcf\u4e2a\u90e8\u5206\u7684\u542b\u4e49&#xff0c;\u4fdd\u8bc1\u770b\u4e00\u904d\u5c31\u61c2&#xff1a;<\/p>\n<li>ADDR &#8211; \u4f4d\u5e26\u533a\u57fa\u5730\u5740&#xff1a;\u8ba1\u7b97\u4f60\u8981\u64cd\u4f5c\u7684\u5bc4\u5b58\u5668&#xff0c;\u5728\u6574\u4e2a\u4f4d\u5e26\u533a\u7684\u504f\u79fb\u5b57\u8282\u6570<\/li>\n<li>\u4e5832&#xff1a;\u56e0\u4e3a1\u4e2a\u5b57\u8282\u67098\u4e2abit&#xff0c;\u6bcf\u4e2abit\u5bf9\u5e94\u522b\u540d\u533a4\u4e2a\u5b57\u8282&#xff0c;\u6240\u4ee58 * 4 &#061; 32<\/li>\n<li>n * 4&#xff1a;\u4f60\u8981\u64cd\u4f5c\u7684\u662f\u7b2cn\u4f4d&#xff0c;\u6bcf\u4e2a\u4f4d\u5bf9\u5e94\u522b\u540d\u533a4\u4e2a\u5b57\u8282&#xff0c;\u6240\u4ee5\u4e584\u627e\u5bf9\u5e94\u4f4d\u7f6e<\/li>\n<h3>2.2 \u4e3e\u4e2a\u5b9e\u9645\u4f8b\u5b50\u7b97\u4e00\u904d<\/h3>\n<p>\u6bd4\u5982\u6211\u4eec\u8981\u64cd\u4f5cGPIOB\u7684ODR\u5bc4\u5b58\u5668\u7684\u7b2c7\u4f4d&#xff1a;<\/p>\n<li>\n<p>\u5148\u67e5\u624b\u518c&#xff1a;GPIOB\u57fa\u5730\u5740\u662f0x40010C00&#xff0c;ODR\u5bc4\u5b58\u5668\u7684\u504f\u79fb\u662f0x0C&#xff0c;\u6240\u4ee5ODR\u7684\u5730\u5740ADDR &#061; 0x40010C00 &#043; 0x0C &#061; 0x40010C0C<\/p>\n<\/li>\n<li>\n<p>\u5916\u8bbe\u4f4d\u5e26\u533a\u57fa\u5730\u5740\u662f0x40000000&#xff0c;\u522b\u540d\u533a\u57fa\u5730\u5740\u662f0x42000000<\/p>\n<\/li>\n<li>\n<p>\u4ee3\u5165\u516c\u5f0f&#xff1a;<\/p>\n<p>\u522b\u540d\u5730\u5740 &#061; 0x42000000 &#043; (0x40010C0C &#8211; 0x40000000) * 32 &#043; 7*4 &#061; 0x4221819C<\/p>\n<\/li>\n<li>\n<p>\u6211\u4eec\u53ea\u8981\u5f800x4221819C\u8fd9\u4e2a\u5730\u5740\u51991&#xff0c;PB7\u5c31\u4f1a\u8f93\u51fa\u9ad8\u7535\u5e73&#xff1b;\u51990\u5c31\u8f93\u51fa\u4f4e\u7535\u5e73&#xff0c;\u5b8c\u5168\u4e0d\u5f71\u54cdGPIO\u7684\u5176\u4ed6\u5f15\u811a\u3002<\/p>\n<\/li>\n<h3>2.3 \u516c\u5f0f\u4f18\u5316&#xff08;\u5de5\u7a0b\u5b9e\u7528\u7248&#xff09;<\/h3>\n<p>\u6211\u4eec\u8981\u64cd\u4f5c\u7684\u5bc4\u5b58\u5668\u5730\u5740\u4e3aADDR&#xff0c;\u8981\u64cd\u4f5c\u7684\u662f\u7b2cn\u4f4d&#xff0c;\u90a3\u4e48\u5bf9\u5e94\u7684\u522b\u540d\u5730\u5740\u8ba1\u7b97\u516c\u5f0f\u4e3a&#xff1a;<\/p>\n<ul>\n<li>\u522b\u540d\u5730\u5740 &#061;((ADDR &amp; 0xF0000000)&#043;0x02000000&#043;((ADDR &amp; 0x000FFFFF)&lt;&lt;5)&#043;(n&lt;&lt;2)<\/li>\n<\/ul>\n<p>\u4e3a\u4ec0\u4e48\u5b9e\u9645\u5de5\u7a0b\u91c7\u7528\u4f18\u5316\u7248&#xff1f;<\/p>\n<ul>\n<li>\u56e0\u4e3a\u4f18\u5316\u540e\u7684\u7248\u672c\u80fd\u4e00\u4e2a\u516c\u5f0f\u901a\u5403\u5916\u8bbe\/SRAM&#xff0c;\u91c7\u7528\u903b\u8f91\u8fd0\u7b97\u7b26&#xff0c;\u8fd0\u7b97\u901f\u5ea6\u5feb&#xff0c;\u8fb9\u754c\u517c\u5bb9\u6027\u597d<\/li>\n<\/ul>\n<p>\u516c\u5f0f\u4f18\u5316\u8bf4\u660e&#xff1a;<\/p>\n<li>&#x1f539; \u7b2c\u4e00\u6bb5&#xff1a;(ADDR &amp; 0xF0000000) &#043; 0x02000000 &#061; \u5bf9\u5e94\u4f4d\u5e26\u533a\u7684\u522b\u540d\u533a\u57fa\u5730\u5740<\/li>\n<ul>\n<li>ADDR &amp; 0xF0000000\u662f\u53d6\u5730\u5740\u7684\u6700\u9ad84\u4f4d&#xff0c;\u533a\u5206\u5f53\u524d\u662fSRAM\u8fd8\u662f\u5916\u8bbe\u5730\u5740&#xff1a;\u5982\u679c\u662f\u5916\u8bbe\u5730\u5740&#xff0c;\u7ed3\u679c\u5c31\u662f0x40000000&#xff1b;\u5982\u679c\u662fSRAM\u5730\u5740&#xff0c;\u7ed3\u679c\u5c31\u662f0x20000000&#xff0c;\u521a\u597d\u662f\u4f4d\u5e26\u533a\u7684\u57fa\u5730\u5740<\/li>\n<li>\u4e24\u4e2a\u4f4d\u5e26\u533a\u7684\u522b\u540d\u533a\u548c\u539f\u533a\u5dee\u503c\u56fa\u5b9a\u662f0x02000000&#xff0c;\u52a0\u5b8c\u76f4\u63a5\u5f97\u5230\u5bf9\u5e94\u7684\u522b\u540d\u533a\u57fa\u5730\u5740&#xff0c;\u4e0d\u7528\u624b\u52a8\u5224\u65ad\u662f\u5916\u8bbe\u8fd8\u662fSRAM<\/li>\n<li>\u5916\u8bbe&#xff1a;0x40000000 &#043; 0x02000000 &#061; 0x42000000&#xff08;\u5916\u8bbe\u522b\u540d\u533a\u8d77\u59cb\u5730\u5740&#xff09; SRAM&#xff1a;0x20000000 &#043; 0x02000000 &#061; 0x22000000&#xff08;SRAM\u522b\u540d\u533a\u8d77\u59cb\u5730\u5740&#xff09;<\/li>\n<\/ul>\n<li>&#x1f539; \u7b2c\u4e8c\u6bb5&#xff1a;(ADDR &amp; 0x000FFFFF) &lt;&lt;5 &#061; (ADDR &#8211; \u4f4d\u5e26\u533a\u57fa\u5730\u5740)*32<\/li>\n<ul>\n<li>\u4e24\u4e2a\u4f4d\u5e26\u533a\u90fd\u53ea\u67091MB\u5927\u5c0f&#xff0c;\u533a\u5185\u504f\u79fb\u53ea\u9700\u8981\u4f4e20\u4f4d\u5c31\u80fd\u8868\u793a&#xff0c;ADDR &amp; 0x000FFFFF\u76f4\u63a5\u62b9\u6389\u9ad8\u4f4d\u524d\u7f00&#xff0c;\u5f97\u5230\u7684\u7ed3\u679c\u5b8c\u5168\u7b49\u4ef7\u4e8eADDR &#8211; \u4f4d\u5e26\u533a\u57fa\u5730\u5740<\/li>\n<li>\u5de6\u79fb5\u4f4d\u7b49\u4ef7\u4e8e\u4e5832&#xff0c;\u548c\u901a\u7528\u516c\u5f0f\u7684\u8fd0\u7b97\u5b8c\u5168\u4e00\u81f4&#xff0c;\u4f4d\u8fd0\u7b97\u6bd4\u51cf\u6cd5\u901f\u5ea6\u66f4\u5feb&#xff0c;\u4e5f\u907f\u514d\u4e86\u51cf\u6cd5\u53ef\u80fd\u51fa\u73b0\u7684\u8fb9\u754c\u9519\u8bef<\/li>\n<\/ul>\n<li>&#x1f539; \u7b2c\u4e09\u6bb5&#xff1a;n &lt;&lt;2 &#061; n *4<\/li>\n<ul>\n<li>\u6bcf\u4e2a\u4f4d\u5bf9\u5e94\u522b\u540d\u533a4\u4e2a\u5b57\u8282\u7684\u5730\u5740&#xff0c;\u5de6\u79fb2\u4f4d\u7b49\u4ef7\u4e8e\u4e584&#xff0c;\u5b8c\u5168\u7b49\u4ef7<\/li>\n<\/ul>\n<h2>\u4e09\u3001\u4e00\u52b3\u6c38\u9038&#xff1a;\u628a\u4f4d\u5e26\u64cd\u4f5c\u5c01\u88c5\u6210\u901a\u7528\u5b8f<\/h2>\n<p>\u4e0d\u53ef\u80fd\u6bcf\u6b21\u64cd\u4f5c\u4f4d\u90fd\u81ea\u5df1\u7b97\u5730\u5740\u5bf9\u5427&#xff1f;\u6211\u4eec\u53ef\u4ee5\u628a\u6362\u7b97\u903b\u8f91\u5199\u6210\u5b8f&#xff0c;\u4ee5\u540e\u76f4\u63a5\u8c03\u7528\u5c31\u884c&#xff0c;\u65b0\u624b\u76f4\u63a5\u6284\u4e0b\u9762\u7684\u4ee3\u7801&#xff0c;\u4e0d\u7528\u6539\u5c31\u80fd\u7528\u3002<\/p>\n<p><span class=\"token comment\">\/\/ \u6838\u5fc3&#xff1a;\u4f4d\u5e26\u522b\u540d\u5730\u5740\u6362\u7b97\u5b8f<\/span><br \/>\n<span class=\"token comment\">\/\/ addr: \u8981\u64cd\u4f5c\u7684\u5bc4\u5b58\u5668\u5730\u5740 bitnum:\u8981\u64cd\u4f5c\u7684\u4f4d\u53f7&#xff08;0~31&#xff09;<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">BITBAND<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span>    <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>addr <span class=\"token operator\">&amp;<\/span> <span class=\"token number\">0xF0000000<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#043;<\/span>\\\\ <\/span><\/span><br \/>\n                                 <span class=\"token number\">0x02000000<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>addr <span class=\"token operator\">&amp;<\/span> <span class=\"token number\">0x00FFFFFF<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&lt;&lt;<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token punctuation\">(<\/span>bitnum<span class=\"token operator\">&lt;&lt;<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <\/p>\n<p><span class=\"token comment\">\/\/ \u628a\u522b\u540d\u5730\u5740\u8f6c\u6210\u53ef\u64cd\u4f5c\u7684\u6307\u9488&#xff0c;\u5b9e\u73b0\u8bfb\u5199 <\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">BITADDR<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span>    <span class=\"token operator\">*<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">volatile<\/span> uint32t <span class=\"token operator\">*<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">BITBAND<\/span><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <\/span><\/span><\/p>\n<li>\n<p>BITBAND\u5b8f&#xff1a; \u8fd9\u4e2a\u5b8f\u7684\u4f5c\u7528\u662f&#xff1a;\u8f93\u5165\u5bc4\u5b58\u5668\u7684\u5730\u5740\u548c\u8981\u64cd\u4f5c\u7684\u4f4d\u5e8f\u53f7&#xff0c;\u8f93\u51fa\u5bf9\u5e94\u7684\u4f4d\u5e26\u522b\u540d\u533a\u5730\u5740\u3002\u6bcf\u4e2a\u90e8\u5206\u529f\u80fd\u4e0a\u6587\u5df2\u7ecf\u62c6\u89e3\u3002<\/p>\n<\/li>\n<li>\n<p>BIT_ADDR\u5b8f&#xff1a;\u600e\u4e48\u64cd\u4f5c\u522b\u540d\u5730\u5740&#xff1f; *(volatile uint32_t )(BITBAND(addr, bitnum)) \u505a\u4e86\u4e24\u4ef6\u4e8b&#xff1a;<\/p>\n<\/li>\n<ul>\n<li>\u628aBITBAND\u7b97\u51fa\u7684\u522b\u540d\u5730\u5740&#xff0c;\u5f3a\u5236\u8f6c\u6362\u6210uint32_t*\u7c7b\u578b\u7684\u6307\u9488&#xff08;\u56e0\u4e3aSTM32\u662f32\u4f4d\u5904\u7406\u5668&#xff0c;\u64cd\u4f5c32\u4f4d\u5730\u5740\u66f4\u9ad8\u6548&#xff09;<\/li>\n<li>\u7528*\u5bf9\u6307\u9488\u505a\u8bfb\u5199\u64cd\u4f5c&#xff0c;\u672c\u8d28\u5c31\u662f\u7ed9\u8fd9\u4e2a\u522b\u540d\u5730\u5740\u8d4b\u503c\/\u53d6\u503c&#xff0c;\u7b49\u6548\u4e8e\u64cd\u4f5c\u539f\u5bc4\u5b58\u5668\u7684\u5bf9\u5e94\u4f4d\n<ul>\n<li>volatile\u5173\u952e\u5b57\u4f5c\u7528\u662f\u544a\u8bc9\u7f16\u8bd1\u5668\u4e0d\u8981\u4f18\u5316\u8fd9\u4e2a\u5730\u5740\u7684\u64cd\u4f5c&#xff0c;\u6bcf\u6b21\u8bfb\u5199\u90fd\u8981\u76f4\u63a5\u8bbf\u95ee\u5185\u5b58&#xff0c;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u56db\u3001\u5b9e\u64cd&#xff1a;\u7528\u4f4d\u5e26\u64cd\u4f5c\u6539\u5199\u6d41\u6c34\u706f\u7a0b\u5e8f<\/h2>\n<h3>4.1 \u5b8c\u6574\u4ee3\u7801\u793a\u4f8b<\/h3>\n<p><span class=\"token keyword\">typedef<\/span> <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">int<\/span>  <span class=\"token class-name\">uint32_t<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">typedef<\/span> <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token class-name\">uint8_t<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5916\u8bbe\u4f4d\u5e26\u533a\u5b8f\u5b9a\u4e49<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">BITBAND<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span>    <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>addr <span class=\"token operator\">&amp;<\/span> <span class=\"token number\">0xF0000000<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#043;<\/span><\/span><span class=\"token punctuation\">\\\\<\/span><br \/>\n                                 <span class=\"token expression\"><span class=\"token number\">0x02000000<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>addr <span class=\"token operator\">&amp;<\/span> <span class=\"token number\">0x000FFFFF<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&lt;&lt;<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token punctuation\">(<\/span>bitnum<span class=\"token operator\">&lt;&lt;<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <\/span><\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u628a\u4f4d\u5e26\u522b\u540d\u533a\u5730\u5740\u8f6c\u6362\u6210\u6307\u9488<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">BIT_ADDR<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span>    <span class=\"token operator\">*<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">volatile<\/span> <span class=\"token class-name\">uint32_t<\/span> <span class=\"token operator\">*<\/span><span class=\"token punctuation\">)<\/span><\/span><span class=\"token punctuation\">\\\\<\/span><br \/>\n                                 <span class=\"token expression\"><span class=\"token punctuation\">(<\/span><span class=\"token function\">BITBAND<\/span><span class=\"token punctuation\">(<\/span>addr<span class=\"token punctuation\">,<\/span> bitnum<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <\/span><\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u65f6\u949f\u5bc4\u5b58\u5668\u5730\u5740\u5b9a\u4e49<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">AHB_RCC_BASE<\/span> <span class=\"token expression\"><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">uint32_t<\/span><span class=\"token punctuation\">)<\/span><span class=\"token number\">0x40021000<\/span><\/span><\/span><\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_CR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x00<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_CFGR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x04<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_CIR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x08<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_APB2RSTR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x0C<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_APB1RSTR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x10<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_AHBENR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x14<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_APB2ENR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x18<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_APB1ENR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x1C<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_BDCR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x20<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">RCC_CSR<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>AHB_RCC_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x24<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><\/p>\n<p><span class=\"token comment\">\/\/ GPIOB\u5bc4\u5b58\u5668\u5730\u5740\u5b9a\u4e49<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_BASE<\/span>   <span class=\"token expression\"><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">uint32_t<\/span><span class=\"token punctuation\">)<\/span><span class=\"token number\">0x40010c00<\/span><\/span><\/span><\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_CRL<\/span>  <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x00<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_CRH<\/span>  <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x04<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_IDR<\/span>  <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x08<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_ODR<\/span>  <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x0C<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_BSRR<\/span> <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x10<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_BRR<\/span>  <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x14<\/span><span class=\"token punctuation\">)<\/span><\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name\">GPIOB_LCKR<\/span> <span class=\"token expression\"><span class=\"token punctuation\">(<\/span>GPIOB_BASE<span class=\"token operator\">&#043;<\/span><span class=\"token number\">0x18<\/span><span class=\"token punctuation\">)<\/span>           <\/span><\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5b9a\u4e49PB\u7684\u4f4d\u5e26\u64cd\u4f5c\u5b8f<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">PB_OUT<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>n<span class=\"token punctuation\">)<\/span>              <span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_ODR<span class=\"token punctuation\">,<\/span>n<span class=\"token punctuation\">)<\/span><\/span><\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5ef6\u65f6\u51fd\u6570&#xff08;\u7a7a\u5faa\u73af&#xff0c;\u65b0\u624b\u4e0d\u7528\u6df1\u7a76&#xff0c;\u6539\u6570\u503c\u53ef\u8c03\u6574\u6d41\u6c34\u901f\u5ea6&#xff09;<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">Delay<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">uint32_t<\/span> time<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">uint32_t<\/span> i<span class=\"token punctuation\">,<\/span>j<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&lt;<\/span>time<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>j<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> j<span class=\"token operator\">&lt;<\/span><span class=\"token number\">1000<\/span><span class=\"token punctuation\">;<\/span> j<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token class-name\">uint8_t<\/span> i<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u5f00\u542fGPIOB\u53e3\u65f6\u949f<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>RCC_APB2ENR<span class=\"token punctuation\">,<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/GPIOB_0~7 \u914d\u7f6e\u63a8\u633d\u8f93\u51fa 50mhz<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&lt;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token comment\">\/\/GPIOB_0~7 led off<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&lt;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">PB_OUT<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">while<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><\/p>\n<p>      <span class=\"token comment\">\/\/ \u4f9d\u6b21\u70b9\u4eaePB0-PB7<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&lt;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">PB_OUT<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">Delay<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">200<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">PB_OUT<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">SystemInit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><\/p>\n<p><span class=\"token punctuation\">}<\/span><\/p>\n<h3>4.2 \u4ee3\u7801\u8bb2\u89e3<\/h3>\n<p>\u4ee3\u7801\u91cc\u6709\u51e0\u4e2a\u5178\u578b\u573a\u666f\u7528\u5230\u4e86\u4f4d\u5e26\u64cd\u4f5c&#xff0c;\u6211\u4eec\u9010\u4e00\u89e3\u91ca&#xff1a;<\/p>\n<li>PB\u53e3\u7684\u4f4d\u5e26\u64cd\u4f5c\u5b8f<\/li>\n<p><span class=\"token comment\">\/\/ \u5b9a\u4e49PB\u7684\u4f4d\u5e26\u64cd\u4f5c\u5b8f<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">define<\/span> <span class=\"token macro-name function\">PB_OUT<\/span><span class=\"token expression\"><span class=\"token punctuation\">(<\/span>n<span class=\"token punctuation\">)<\/span>              <span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_ODR<span class=\"token punctuation\">,<\/span>n<span class=\"token punctuation\">)<\/span><\/span><\/span><\/p>\n<ul>\n<li>PB_OUT(n)\u5b8c\u7f8e\u590d\u523b51\u5355\u7247\u673asbit\u7684\u64cd\u4f5c\u903b\u8f91&#xff0c;\u65b0\u624b\u76f4\u63a5\u7528PB_OUT(0)&#061;1\u5c31\u80fd\u63a7\u5236PB0\u8f93\u51fa\u9ad8\u7535\u5e73&#xff0c;\u4e0d\u7528\u8bb0\u4efb\u4f55\u79fb\u4f4d\u903b\u8f91<\/li>\n<\/ul>\n<li>\u65f6\u949f\u5f00\u542f\u7528\u4f4d\u5e26\u64cd\u4f5c<\/li>\n<p><span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>RCC_APB2ENR<span class=\"token punctuation\">,<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<ul>\n<li>\u67e5\u624b\u518c\u53ef\u77e5RCC_APB2ENR\u5bc4\u5b58\u5668\u7684\u4f4d3\u5bf9\u5e94GPIOB\u7684\u65f6\u949f\u4f7f\u80fd\u4f4d&#xff0c;\u76f4\u63a5\u7ed9\u8be5\u4f4d\u51991\u5373\u53ef&#xff0c;\u4e0d\u9700\u8981\u5199RCC_APB2ENR |&#061; (1&lt;&lt;3)&#xff0c;\u5b8c\u5168\u4e0d\u4f1a\u8bef\u6539\u5176\u4ed6\u5916\u8bbe\u7684\u65f6\u949f\u5f00\u5173<\/li>\n<\/ul>\n<li>\u914d\u7f6eGPIO\u53e3\u6a21\u5f0f&#xff08;\u64cd\u4f5cGPIOB_CRL\u5bc4\u5b58\u5668&#xff09;<\/li>\n<p><span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&lt;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">BIT_ADDR<\/span><span class=\"token punctuation\">(<\/span>GPIOB_CRL<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">4<\/span><span class=\"token operator\">*<\/span>i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>GPIOB_CRL\u662fGPIOB\u7aef\u53e3\u4f4e8\u4f4d\u7684\u914d\u7f6e\u5bc4\u5b58\u5668&#xff0c;\u6bcf4\u4f4d\u63a7\u52361\u4e2aIO\u53e3&#xff08;\u6bd4\u5982\u7b2c0-3\u4f4d\u63a7\u5236PB0&#xff0c;\u7b2c4-7\u4f4d\u63a7\u5236PB1&#xff0c;\u4ee5\u6b64\u7c7b\u63a8&#xff09; \u3002\u8981\u914d\u7f6ePB0-PB7\u4e3a50MHz\u63a8\u633d\u8f93\u51fa&#xff0c;\u5bf9\u5e94\u7684\u4f4d\u503c\u662f0011 \u3002<\/li>\n<li>\u7528BIT_ADDR\u76f4\u63a5\u64cd\u4f5c\u5bc4\u5b58\u5668\u7684\u7b2c0&#043;4*i\u7b49\u4f4d&#xff0c;\u76f4\u63a5\u8d4b\u503c1\u62160&#xff0c;\u4e0d\u7528\u5148\u8bfb\u6574\u4e2a\u5bc4\u5b58\u5668\u3001\u4fee\u6539\u3001\u518d\u5199\u56de&#xff0c;\u4ee3\u7801\u66f4\u7b80\u6d01\u3001\u4e0d\u5bb9\u6613\u51fa\u9519<\/li>\n<\/ul>\n<li>\u6d41\u6c34\u706f\u63a7\u5236<\/li>\n<p><span class=\"token comment\">\/\/ \u4f9d\u6b21\u70b9\u4eaePB0-PB7<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&lt;<\/span><span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span>i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">PB_OUT<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">Delay<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">200<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">PB_OUT<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>\u6d41\u6c34\u706f\u903b\u8f91\u5b8c\u5168\u6ca1\u6709\u590d\u6742\u7684\u4f4d\u8fd0\u7b97&#xff0c;\u54ea\u6015\u662f\u7b2c\u4e00\u6b21\u5b66STM32\u7684\u65b0\u624b\u4e5f\u80fd\u4e00\u773c\u770b\u61c2&#xff1a;\u9010\u4e2a\u70b9\u4eae\u3001\u5ef6\u65f6\u3001\u9010\u4e2a\u7184\u706d\u3002\u548c51\u7684LED&#061;1\u5199\u6cd5\u51e0\u4e4e\u4e00\u6837&#xff0c;\u975e\u5e38\u76f4\u89c2 \u3002<\/li>\n<\/ul>\n<h2>\u4e94\u3001\u4f4d\u5e26\u64cd\u4f5c\u7684\u4f18\u70b9&#xff08;\u4e3a\u4ec0\u4e48\u63a8\u8350\u521d\u5b66\u8005\u5b66&#xff1f;&#xff09;<\/h2>\n<li>\u4ee3\u7801\u6781\u7b80\u76f4\u89c2&#xff1a;\u4e0d\u7528\u5199\u590d\u6742\u7684\u4f4d\u8fd0\u7b97&#xff08;\u6bd4\u5982GPIOB_ODR |&#061; (1&lt;&lt;0)\u3001GPIOB_ODR &amp;&#061; ~(1&lt;&lt;7)&#xff09;&#xff0c;\u76f4\u63a5\u50cf\u64cd\u4f5c\u53d8\u91cf\u4e00\u6837\u64cd\u4f5c\u5bc4\u5b58\u5668\u7684\u67d0\u4e00\u4f4d<\/li>\n<li>\u907f\u514d\u201c\u8bfb-\u6539-\u5199\u201d\u98ce\u9669&#xff1a;\u666e\u901a\u4f4d\u64cd\u4f5c\u9700\u8981\u5148\u8bfb\u53d6\u5bc4\u5b58\u5668\u503c\u3001\u4fee\u6539\u5bf9\u5e94\u4f4d\u3001\u518d\u5199\u56de&#xff0c;\u591a\u7ebf\u7a0b\/\u4e2d\u65ad\u573a\u666f\u4e0b\u53ef\u80fd\u51fa\u9519&#xff1b;\u4f4d\u5e26\u64cd\u4f5c\u76f4\u63a5\u4fee\u6539\u76ee\u6807\u4f4d&#xff0c;\u4e00\u6b65\u5230\u4f4d<\/li>\n<li>51\u5165\u95e8\u53cb\u597d&#xff1a;\u670951\u57fa\u7840\u7684\u8bdd&#xff0c;\u80fd\u5feb\u901f\u4e0a\u624bSTM32\u7684IO\u4f4d\u64cd\u4f5c&#xff0c;\u964d\u4f4e\u5b66\u4e60\u95e8\u69db<\/li>\n<h2>\u516d\u3001 \u514d\u8d39\u83b7\u53d6\u8d44\u6599&#xff1a;<\/h2>\n<p>\u5173\u6ce8\u4e0b\u9762\u7684 \u82a6\u82c7\u7535\u5b50 \u5fae\u4fe1\u516c\u4f17\u53f7,<\/p>\n<p>\u5728\u516c\u4f17\u53f7\u5185 \u79c1\u4fe1\u56de\u590d<\/p>\n<p>032<\/p>\n<p>\u6536\u5230\u540e\u81ea\u52a8\u53d1\u9001\u8be5\u4eff\u771f\u8d44\u6599<\/p>\n<hr \/>\n<p>\u5982\u679c\u4f60\u80fd\u575a\u6301\u770b\u5230\u8fd9\u91cc&#xff0c;\u8bf4\u660e\u4f60\u5df2\u7ecf\u5177\u5907\u4e86\u6210\u4e3a\u5d4c\u5165\u5f0f\u5927\u795e\u7684\u6f5c\u8d28&#xff01;&#x1f4aa; \u522b\u5149\u770b&#xff0c;\u8d76\u7d27\u6253\u5f00\u4f60\u7684 Keil&#xff0c;\u65b0\u5efa\u4e00\u4e2a\u5de5\u7a0b&#xff0c;\u628a\u8fd9\u6bb5\u4ee3\u7801\u8dd1\u8d77\u6765\u8bd5\u8bd5\u5427&#xff01;<\/p>\n<p>\u5982\u679c\u89c9\u5f97\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u6b22\u8fce\u70b9\u8d5e\u3001\u6536\u85cf\u3001\u8f6c\u53d1&#xff01;\u2014\u2014\u4f60\u7684\u8ba4\u53ef&#xff0c;\u662f\u6211\u6301\u7eed\u8f93\u51fa\u5d4c\u5165\u5f0f\u786c\u6838\u5e72\u8d27\u7684\u6700\u5927\u52a8\u529b&#xff01;\u6211\u4eec\u4e0b\u671f\u518d\u89c1&#xff01; &#x1f31f;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f4a1;\u5199\u5728\u524d\u9762<br \/>\n\u5927\u5bb6\u597d&#xff01; \u6700\u8fd1\u5f88\u591a\u521a\u5165\u95e8\u7684\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211&#xff1a;\u4e0a\u8282\u8bfe\u5199\u7684\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f&#xff0c;\u6bcf\u6b21\u6539IO\u7535\u5e73\u90fd\u8981\u5199GPIOB-&gt;ODR | (1&lt;ODR &amp; ~(1&lt;&lt;n)&#xff0c;\u79fb\u4f4d\u5199\u591a\u4e86\u5bb9\u6613\u641e\u6df7\u4f4d\u6570&#xff0c;\u8fd8\u62c5\u5fc3\u5199\u9519\u63a9\u7801\u628a\u5176\u4ed6\u4f4d\u6539\u5d29\u4e86&#xff0c;\u6709\u6ca1\u6709\u50cf51\u5355\u7247\u673a\u90a3\u6837sbit LED  P0^0\u76f4\u63a5\u64cd\u4f5c\u67d0\u4e00\u4f4d\u7684\u65b9\u6cd5&#xff1f;<br \/>\n\u5f53\u7136\u6709&#xff01;\u4eca\u5929\u6211\u4eec\u5c31\u5b66\u4e60STM32\u4e13\u95e8\u4e3a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5084,217,269],"topic":[],"class_list":["post-77429","post","type-post","status-publish","format-standard","hentry","category-server","tag-proteus","tag-stm32","tag-269"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/77429.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f4a1;\u5199\u5728\u524d\u9762 \u5927\u5bb6\u597d&#xff01; \u6700\u8fd1\u5f88\u591a\u521a\u5165\u95e8\u7684\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211&#xff1a;\u4e0a\u8282\u8bfe\u5199\u7684\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f&#xff0c;\u6bcf\u6b21\u6539IO\u7535\u5e73\u90fd\u8981\u5199GPIOB-&gt;ODR | (1&lt;ODR &amp; ~(1&lt;&lt;n)&#xff0c;\u79fb\u4f4d\u5199\u591a\u4e86\u5bb9\u6613\u641e\u6df7\u4f4d\u6570&#xff0c;\u8fd8\u62c5\u5fc3\u5199\u9519\u63a9\u7801\u628a\u5176\u4ed6\u4f4d\u6539\u5d29\u4e86&#xff0c;\u6709\u6ca1\u6709\u50cf51\u5355\u7247\u673a\u90a3\u6837sbit LED P0^0\u76f4\u63a5\u64cd\u4f5c\u67d0\u4e00\u4f4d\u7684\u65b9\u6cd5&#xff1f; \u5f53\u7136\u6709&#xff01;\u4eca\u5929\u6211\u4eec\u5c31\u5b66\u4e60STM32\u4e13\u95e8\u4e3a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/77429.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-24T09:33:52+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77429.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/77429.html\",\"name\":\"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-24T09:33:52+00:00\",\"dateModified\":\"2026-02-24T09:33:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/77429.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/77429.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77429.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094--\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/77429.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f4a1;\u5199\u5728\u524d\u9762 \u5927\u5bb6\u597d&#xff01; \u6700\u8fd1\u5f88\u591a\u521a\u5165\u95e8\u7684\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211&#xff1a;\u4e0a\u8282\u8bfe\u5199\u7684\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f&#xff0c;\u6bcf\u6b21\u6539IO\u7535\u5e73\u90fd\u8981\u5199GPIOB-&gt;ODR | (1&lt;ODR &amp; ~(1&lt;&lt;n)&#xff0c;\u79fb\u4f4d\u5199\u591a\u4e86\u5bb9\u6613\u641e\u6df7\u4f4d\u6570&#xff0c;\u8fd8\u62c5\u5fc3\u5199\u9519\u63a9\u7801\u628a\u5176\u4ed6\u4f4d\u6539\u5d29\u4e86&#xff0c;\u6709\u6ca1\u6709\u50cf51\u5355\u7247\u673a\u90a3\u6837sbit LED P0^0\u76f4\u63a5\u64cd\u4f5c\u67d0\u4e00\u4f4d\u7684\u65b9\u6cd5&#xff1f; \u5f53\u7136\u6709&#xff01;\u4eca\u5929\u6211\u4eec\u5c31\u5b66\u4e60STM32\u4e13\u95e8\u4e3a","og_url":"https:\/\/www.wsisp.com\/helps\/77429.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-24T09:33:52+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/77429.html","url":"https:\/\/www.wsisp.com\/helps\/77429.html","name":"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094-\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-24T09:33:52+00:00","dateModified":"2026-02-24T09:33:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/77429.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/77429.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/77429.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010STM32\u3011Proteus\u4eff\u771fSTM32\u6559\u7a0b\uff08\u5bc4\u5b58\u5668\uff094--\u5bc4\u5b58\u5668\u7248\u6d41\u6c34\u706f\u7a0b\u5e8f\u4f18\u5316\uff08STM32\u4f4d\u5e26\u533a&amp;\u4f4d\u5e26\u64cd\u4f5c\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=77429"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77429\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=77429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=77429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=77429"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=77429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}