{"id":104171,"date":"2026-09-11T22:57:17","date_gmt":"2026-09-11T14:57:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/104171.html"},"modified":"2026-09-11T22:57:17","modified_gmt":"2026-09-11T14:57:17","slug":"tim%e7%bc%96%e7%a0%81%e5%99%a8%e6%8e%a5%e5%8f%a3%ef%bc%88stm32%e6%a0%87%e5%87%86%e5%ba%93%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/104171.html","title":{"rendered":"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\uff09"},"content":{"rendered":"<p style=\"margin-left:0.0001pt;text-align:justify\">\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u300aTIM\u8f93\u5165\u6355\u83b7&#xff08;STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0&#xff09;\u300b\u4e2d&#xff0c;\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5229\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u6355\u83b7\u529f\u80fd\u6d4b\u91cf\u8f93\u5165\u4fe1\u53f7\u7684\u9891\u7387\u3001\u5468\u671f\u548c\u8109\u5bbd\u3002\u8f93\u5165\u6355\u83b7\u672c\u8d28\u4e0a\u662f\u5bf9\u5916\u90e8\u4fe1\u53f7\u8fb9\u6cbf\u7684\u6355\u6349\u4e0e\u8ba1\u65f6&#xff0c;\u5b83\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u7cbe\u786e\u6d4b\u91cf\u5916\u90e8\u8109\u51b2\u7684\u65f6\u95f4\u4fe1\u606f\u3002\u7136\u800c&#xff0c;\u5728\u5b9e\u9645\u7684\u7535\u673a\u63a7\u5236\u3001\u4f4d\u7f6e\u68c0\u6d4b\u7b49\u573a\u666f\u4e2d&#xff0c;\u6211\u4eec\u5f80\u5f80\u4e0d\u4ec5\u9700\u8981\u6d4b\u91cf\u8109\u51b2\u7684\u65f6\u95f4&#xff0c;\u66f4\u9700\u8981\u5b9e\u65f6\u83b7\u53d6\u65cb\u8f6c\u673a\u6784\u7684\u4f4d\u7f6e\u3001\u65b9\u5411\u548c\u901f\u5ea6&#xff0c;\u8fd9\u65f6\u4ec5\u4ec5\u4f9d\u9760\u8f93\u5165\u6355\u83b7\u5c31\u663e\u5f97\u529b\u4e0d\u4ece\u5fc3\u4e86\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898&#xff0c;STM32 \u7684\u5b9a\u65f6\u5668\u5728\u8f93\u5165\u6355\u83b7\u7684\u57fa\u7840\u4e0a&#xff0c;\u8fdb\u4e00\u6b65\u63d0\u4f9b\u4e86\u7f16\u7801\u5668\u63a5\u53e3&#xff08;Encoder Interface&#xff09;\u529f\u80fd\u3002\u7f16\u7801\u5668\u63a5\u53e3\u53ef\u4ee5\u63a5\u6536\u589e\u91cf&#xff08;\u6b63\u4ea4&#xff09;\u7f16\u7801\u5668\u8f93\u51fa\u7684\u4e24\u8def\u6b63\u4ea4\u4fe1\u53f7&#xff0c;\u7531\u786c\u4ef6\u81ea\u52a8\u5b8c\u6210\u4fe1\u53f7\u7684\u89e3\u7801\u4e0e\u8ba1\u6570&#xff0c;\u4ece\u800c\u76f4\u63a5\u5f97\u5230\u65cb\u8f6c\u7684\u4f4d\u7f6e\u3001\u65b9\u5411\u548c\u901f\u5ea6\u4fe1\u606f&#xff0c;\u65e0\u9700 CPU \u53c2\u4e0e\u7e41\u7410\u7684\u4fe1\u53f7\u5904\u7406\u3002\u53ef\u4ee5\u8bf4&#xff0c;\u7f16\u7801\u5668\u63a5\u53e3\u662f\u8f93\u5165\u6355\u83b7\u529f\u80fd\u5728\u5de5\u7a0b\u5e94\u7528\u4e2d\u7684\u4e00\u6b21\u91cd\u8981\u5ef6\u4f38\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u6587\u4f5c\u4e3a\u300aSTM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\u300b\u7cfb\u5217\u7684\u5ef6\u7eed&#xff0c;\u5c06\u7cfb\u7edf\u8bb2\u89e3 TIM \u7f16\u7801\u5668\u63a5\u53e3\u7684\u539f\u7406\u3001\u57fa\u672c\u7ed3\u6784\u3001\u5de5\u4f5c\u6a21\u5f0f\u3001\u914d\u7f6e\u6d41\u7a0b&#xff0c;\u5e76\u901a\u8fc7\u4e00\u4e2a\u7f16\u7801\u5668\u6d4b\u901f\u5b9e\u4f8b&#xff0c;\u5e2e\u52a9\u5927\u5bb6\u628a\u7406\u8bba\u77e5\u8bc6\u843d\u5b9e\u5230\u5b9e\u9645\u4ee3\u7801\u4e2d\u3002\u4e0b\u9762\u6211\u4eec\u5c31\u6b63\u5f0f\u5f00\u59cb\u5b66\u4e60\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u679c\u89c9\u5f97\u6709\u6536\u83b7\u53ef\u4ee5\u4e3a\u6211\u7684\u6587\u7ae0\u70b9\u70b9\u5c0f\u8d5e&#xff0c;\u8fd9\u5c06\u6fc0\u52b1\u6211\u521b\u4f5c\u66f4\u597d\u7684\u5185\u5bb9&#xff01;\u8c22\u8c22&#xff01;<\/p>\n<h2 style=\"margin-left:0.0001pt;text-align:justify\">\u4e00\u3001TIM\u7f16\u7801\u5668\u63a5\u53e3<\/h2>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.1 \u7f16\u7801\u5668\u63a5\u53e3\u7b80\u4ecb<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">Encoder Interface \u7f16\u7801\u5668\u63a5\u53e3<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f16\u7801\u5668\u63a5\u53e3\u53ef\u63a5\u6536\u589e\u91cf&#xff08;\u6b63\u4ea4&#xff09;\u7f16\u7801\u5668\u7684\u4fe1\u53f7&#xff0c;\u6839\u636e\u7f16\u7801\u5668\u65cb\u8f6c\u4ea7\u751f\u7684\u6b63\u4ea4\u4fe1\u53f7\u8109\u51b2&#xff0c;\u81ea\u52a8\u63a7\u5236CNT\u81ea\u589e\u6216\u81ea\u51cf&#xff0c;\u4ece\u800c\u6307\u793a\u7f16\u7801\u5668\u7684\u4f4d\u7f6e\u3001\u65cb\u8f6c\u65b9\u5411\u548c\u65cb\u8f6c\u901f\u5ea6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6bcf\u4e2a\u9ad8\u7ea7\u5b9a\u65f6\u5668\u548c\u901a\u7528\u5b9a\u65f6\u5668\u90fd\u62e5\u67091\u4e2a\u7f16\u7801\u5668\u63a5\u53e3<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e24\u4e2a\u8f93\u5165\u5f15\u811a\u501f\u7528\u4e86\u8f93\u5165\u6355\u83b7\u7684\u901a\u90531\u548c\u901a\u90532<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145714-6aa416ca5b9c6.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.2 \u6b63\u4ea4\u7f16\u7801\u5668<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145714-6aa416cad491c.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.3 \u7f16\u7801\u5668\u63a5\u53e3\u57fa\u672c\u7ed3\u6784<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145715-6aa416cb196a0.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.4 \u5de5\u4f5c\u6a21\u5f0f<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145715-6aa416cb55e7b.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.5 \u5b9e\u4f8b&#xff08;\u5747\u4e0d\u53cd\u76f8&#xff09;<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145715-6aa416cb8be3e.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.6 \u5b9e\u4f8b&#xff08;TI1\u53cd\u76f8&#xff09;<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6781\u6027\u9009\u62e9&#8211;&gt;\u53cd\u76f8<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145715-6aa416cba57ce.png\" \/><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145715-6aa416cbeada6.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.7 \u7f16\u7801\u5668\u63a5\u53e3\u7684\u914d\u7f6e\u6d41\u7a0b<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b2c\u4e00\u6b65&#xff0c;RCC\u5f00\u542f\u65f6\u949f&#xff0c;\u5f00\u542fGPIO\u548c\u5b9a\u65f6\u5668\u7684\u65f6\u949f&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b2c\u4e8c\u6b65&#xff0c;\u914d\u7f6eGPIO&#xff0c;\u8fd9\u91cc\u9700\u8981\u628aPA6\u548cPA7\u914d\u7f6e\u6210\u8f93\u5165\u6a21\u5f0f&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b2c\u4e09\u6b65&#xff0c;\u914d\u7f6e\u65f6\u57fa\u5355\u5143&#xff0c;\u8fd9\u91cc\u9884\u5206\u9891\u5668\u6211\u4eec\u4e00\u822c\u9009\u62e9\u4e0d\u5206\u9891&#xff0c;\u81ea\u52a8\u91cd\u88c5&#xff0c;\u4e00\u822c\u7ed9\u6700\u592765535,\u53ea\u9700\u8981\u4e2aCNT\u6267\u884c\u8ba1\u6570\u5c31\u884c\u4e86&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b2c\u56db\u6b65&#xff0c;\u914d\u7f6e\u8f93\u5165\u6355\u83b7\u5355\u5143&#xff0c;\u8fd9\u91cc\u8f93\u5165\u6355\u83b7\u5355\u5143\u53ea\u6709\u6ee4\u6ce2\u5668\u548c\u6781\u6027\u8fd9\u4e24\u4e2a\u53c2\u6570\u6709\u6548&#xff0c;\u5176\u4ed6\u5dee\u6570\u4e0e\u7f16\u7801\u5668\u65e0\u5173&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b2c\u4e94\u6b65&#xff0c;\u914d\u7f6e\u7f16\u7801\u5668\u63a5\u53e3\u6a21\u5f0f&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6700\u540e&#xff0c;\u8c03\u7528TIM_Cmd&#xff0c;\u542f\u52a8\u5b9a\u65f6\u5668\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.8 GPIO\u53e3\u8f93\u5165\u6a21\u5f0f\u7684\u9009\u62e9<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#7030a0\">\u770b\u5916\u90e8\u6a21\u5757\u5f15\u811a\u8f93\u51fa\u7684\u9ed8\u8ba4\u7535\u5e73\u9009\u62e9GPIO\u53e3\u7684\u8f93\u5165\u6a21\u5f0f<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#7030a0\">\u4e0a\u62c9\u8f93\u5165&#xff1a;\u5982\u679c\u5916\u90e8\u6a21\u5757\u7a7a\u95f2\u9ed8\u8ba4\u8f93\u51fa\u9ad8\u7535\u5e73&#xff0c;\u6211\u4eec\u5c31\u9009\u62e9\u4e0a\u62c9\u8f93\u5165&#xff0c;\u9ed8\u8ba4\u8f93\u5165\u9ad8\u7535<\/span>    <span style=\"color:#7030a0\">\u5e73&#xff1b;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#7030a0\">\u4e0b\u62c9\u8f93\u5165&#xff1a;\u5982\u679c\u5916\u90e8\u6a21\u5757\u7a7a\u95f2\u9ed8\u8ba4\u8f93\u51fa\u4f4e\u7535\u5e73&#xff0c;\u6211\u4eec\u5c31\u9009\u62e9\u4e0b\u62c9\u8f93\u5165&#xff0c;\u9ed8\u8ba4\u8f93\u5165\u4f4e\u7535<\/span>    <span style=\"color:#7030a0\">\u5e73&#xff0c;<\/span><span style=\"color:#7030a0\">\u548c\u5916\u90e8\u6a21\u5757\u4fdd\u6301\u9ed8\u8ba4\u72b6\u6001\u4e00\u81f4&#xff0c;\u9632\u6b62\u9ed8\u8ba4\u7535\u5e73\u6253\u67b6<\/span><span style=\"color:#7030a0\">&#xff1b;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#7030a0\">\u6d6e\u7a7a\u8f93\u5165&#xff1a;\u5982\u679c\u4e0d\u786e\u5b9a\u5916\u90e8\u6a21\u5757\u7a7a\u95f2\u9ed8\u8ba4\u8f93\u51fa\u72b6\u6001&#xff0c;\u6216\u8005\u5916\u90e8\u4fe1\u53f7\u8f93\u51fa\u529f\u7387\u975e\u5e38\u5c0f&#xff0c;<\/span>    <span style=\"color:#7030a0\">\u8fd9\u65f6\u5c3d\u91cf\u9009\u62e9\u6d6e\u7a7a\u8f93\u5165&#xff0c;\u6d6e\u7a7a\u8f93\u5165&#xff0c;\u6ca1\u6709\u4e0a\u62c9\u7535\u963b\u548c\u4e0b\u62c9\u7535\u963b\u53bb\u5f71\u54cd\u5916\u90e8\u4fe1<\/span>    <span style=\"color:#7030a0\">\u53f7&#xff0c;\u4f46\u662f\u7f3a\u70b9\u5c31\u662f\u5f53\u5f15\u811a\u60ac\u7a7a\u65f6&#xff0c;\u6ca1\u6709\u9ed8\u8ba4\u7684\u7535\u5e73\u4e86&#xff0c;\u8f93\u5165\u5c31\u4f1a\u53d7\u566a\u58f0\u5e72\u6270&#xff0c;<\/span>    <span style=\"color:#7030a0\">\u6765\u56de\u4e0d\u65ad\u5730\u8df3\u53d8&#xff1b;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.9 \u5b9e\u4f8b\u4e00 6.8.1 \u7f16\u7801\u5668\u63a5\u53e3\u6d4b\u901f<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">Timer<\/span><span style=\"color:#ff0000\">.c<\/span><span style=\"color:#ff0000\">\u2193<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p>#include &#034;stm32f10x.h&#034;                  \/\/ Device header<br \/>\n\/**<br \/>\n\u51fd    \u6570&#xff1a;\u5b9a\u65f6\u4e2d\u65ad\u521d\u59cb\u5316<br \/>\n\u53c2    \u6570&#xff1a;\u65e0<br \/>\n\u8fd4 \u56de \u503c&#xff1a;\u65e0<br \/>\n*\/<br \/>\nvoid Timer_Init(void)<br \/>\n{<br \/>\n\/\u5f00\u542f\u65f6\u949f\/<br \/>\nRCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2,ENABLE);\/\/\u5f00\u542fTIM2\u7684\u65f6\u949f<br \/>\n\/\u914d\u7f6e\u65f6\u949f\u6e90\/<br \/>\nTIM_InternalClockConfig(TIM2);\/\/\u9009\u62e9TIM2\u4e3a\u5185\u90e8\u65f6\u949f&#xff0c;\u82e5\u4e0d\u8c03\u7528\u6b64\u51fd\u6570&#xff0c;TIM\u9ed8\u8ba4\u4e5f\u4e3a\u5185\u90e8\u65f6\u949f<br \/>\n\/\u65f6\u57fa\u5355\u5143\u521d\u59cb\u5316\/<br \/>\nTIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;\/\/\u5b9a\u4e49\u7ed3\u6784\u4f53\u53d8\u91cf<br \/>\nTIM_TimeBaseInitStructure.TIM_ClockDivision &#061; TIM_CKD_DIV1;\/\/\u65f6\u949f\u5206\u9891&#xff0c;\u9009\u62e9\u4e0d\u5206\u9891&#xff0c;\u6b64\u53c2\u6570\u7528\u4e8e\u914d\u7f6e\u6ee4\u6ce2\u5668\u65f6\u949f&#xff0c;\u4e0d\u5f71\u54cd\u65f6\u57fa\u5355\u5143\u529f\u80fd<br \/>\nTIM_TimeBaseInitStructure.TIM_CounterMode &#061; TIM_CounterMode_Up;\/\/\u8ba1\u6570\u5668\u6a21\u5f0f&#xff0c;\u9009\u62e9\u5411\u4e0a\u8ba1\u6570<br \/>\nTIM_TimeBaseInitStructure.TIM_Period &#061; 10000 &#8211; 1;\/\/\u91cd\u88c5\u503c&#xff08;\u8bb0\u591a\u5c11\u6b21\u6570\u6ea2\u51fa\u4e00\u6b21&#xff09;&#xff0c;\u8ba1\u6570\u5468\u671f&#xff0c;\u5373ARR\u7684\u503c<br \/>\nTIM_TimeBaseInitStructure.TIM_Prescaler &#061; 7200 &#8211; 1;\/\/\u9884\u5206\u9891\u503c&#xff08;\u5185\u90e8\u65f6\u949f\u7535\u5e73\u4e00\u4e0a\u4e00\u4e0b\u591a\u5c11\u6b21\u8ba1\u4e00\u4e2a\u6570&#xff09;&#xff0c;\u9884\u5206\u9891\u5668&#xff0c;\u5373PSC\u7684\u503c<br \/>\nTIM_TimeBaseInitStructure.TIM_RepetitionCounter &#061; 0;\/\/\u91cd\u590d\u8ba1\u6570\u5668&#xff0c;\u9ad8\u7ea7\u5b9a\u65f6\u5668\u624d\u4f1a\u7528\u5230<br \/>\nTIM_TimeBaseInit(TIM2,&amp;TIM_TimeBaseInitStructure);\/\/\u5c06\u7ed3\u6784\u4f53\u53d8\u91cf\u4ea4\u7ed9TIM_TimeBaseInit&#xff0c;\u914d\u7f6eTIM2\u7684\u65f6\u57fa\u5355\u5143<br \/>\n\/\u4e2d\u65ad\u8f93\u51fa\u914d\u7f6e\/<br \/>\nTIM_ClearFlag(TIM2,TIM_FLAG_Update);\/\/\u6e05\u9664\u5b9a\u65f6\u5668\u66f4\u65b0\u6807\u5fd7\u4f4d<br \/>\n\/\/TIM_TimeBaseInit\u51fd\u6570\u672b\u5c3e&#xff0c;\u624b\u52a8\u4ea7\u751f\u4e86\u66f4\u65b0\u4e8b\u4ef6<br \/>\n\/\/\u82e5\u4e0d\u6e05\u9664\u6b64\u6807\u5fd7\u4f4d&#xff0c;\u5219\u5f00\u542f\u4e2d\u65ad\u540e&#xff0c;\u4f1a\u7acb\u523b\u8fdb\u5165\u4e00\u6b21\u4e2d\u65ad<br \/>\n\/\/\u5982\u679c\u4e0d\u4ecb\u610f\u6b64\u95ee\u9898&#xff0c;\u5219\u4e0d\u6e05\u9664\u6b64\u6807\u5fd7\u4f4d\u4e5f\u53ef<br \/>\nTIM_ITConfig(TIM2,TIM_IT_Update,ENABLE);\/\/\u5f00\u542fTIM2\u7684\u66f4\u65b0\u4e2d\u65ad<br \/>\n\/NVIC\u4e2d\u65ad\u5206\u7ec4\/<br \/>\nNVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);<br \/>\nNVIC_InitTypeDef NVIC_InitStructure;<br \/>\nNVIC_InitStructure.NVIC_IRQChannel &#061; TIM2_IRQn;<br \/>\nNVIC_InitStructure.NVIC_IRQChannelCmd &#061; ENABLE;<br \/>\nNVIC_InitStructure.NVIC_IRQChannelPreemptionPriority &#061; 2;<br \/>\nNVIC_InitStructure.NVIC_IRQChannelSubPriority &#061; 1;<br \/>\nNVIC_Init(&amp;NVIC_InitStructure);<br \/>\nTIM_Cmd(TIM2,ENABLE);<br \/>\n}<br \/>\n\/*<br \/>\nvoid TIM2_IRQHandler(void)<br \/>\n{<br \/>\nif( TIM_GetITStatus(TIM2,TIM_IT_Update)&#061;&#061;SET )<br \/>\n{<br \/>\nTIM_ClearITPendingBit(TIM2,TIM_IT_Update);<br \/>\n}<br \/>\n}<br \/>\n*\/<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">Encoder<\/span><span style=\"color:#ff0000\">.c<\/span><span style=\"color:#ff0000\">\u2193<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p>#include &#034;stm32f10x.h&#034;                  \/\/ Device header<br \/>\nvoid Encoder_Init(void)<br \/>\n{<br \/>\n\/\u5f00\u542f\u65f6\u949f\/<br \/>\nRCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE);\/\/\u5f00\u542fTIM3\u7684\u65f6\u949f<br \/>\nRCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);<br \/>\n\/*GPIO\u521d\u59cb\u5316*\/<br \/>\nGPIO_InitTypeDef GPIO_InitStructure;<br \/>\nGPIO_InitStructure.GPIO_Mode &#061; GPIO_Mode_IPU;<br \/>\nGPIO_InitStructure.GPIO_Pin &#061; GPIO_Pin_6 | GPIO_Pin_7;\/\/GPIO_Pin_6<br \/>\nGPIO_InitStructure.GPIO_Speed &#061; GPIO_Speed_50MHz;<br \/>\nGPIO_Init(GPIOA,&amp;amp;GPIO_InitStructure);<\/p>\n<p>\/*\u65f6\u57fa\u5355\u5143\u521d\u59cb\u5316*\/<br \/>\nTIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;<br \/>\nTIM_TimeBaseInitStructure.TIM_ClockDivision &#061; TIM_CKD_DIV1;\/\/\u65f6\u949f\u5206\u9891&#xff0c;\u9009\u62e9\u4e0d\u5206\u9891&#xff0c;\u6b64\u53c2\u6570\u7528\u4e8e\u914d\u7f6e\u6ee4\u6ce2\u5668\u65f6\u949f&#xff0c;\u4e0d\u5f71\u54cd\u65f6\u57fa\u5355\u5143\u529f\u80fd<br \/>\nTIM_TimeBaseInitStructure.TIM_CounterMode &#061; TIM_CounterMode_Up;\/\/\u8ba1\u6570\u5668\u6a21\u5f0f&#xff0c;\u9009\u62e9\u5411\u4e0a\u8ba1\u6570<br \/>\nTIM_TimeBaseInitStructure.TIM_Period &#061; 65536 &#8211; 1;\/\/\u91cd\u88c5\u503c&#xff08;\u5468\u671fARR&#xff09;&#xff08;\u8bb0\u591a\u5c11\u6b21\u6570\u6ea2\u51fa\u4e00\u6b21&#xff09;<br \/>\nTIM_TimeBaseInitStructure.TIM_Prescaler &#061; 1 &#8211; 1;\/\/\u9884\u5206\u9891\u503cPSC&#xff08;\u5185\u90e8\u65f6\u949f\u7535\u5e73\u4e00\u4e0a\u4e00\u4e0b\u591a\u5c11\u6b21\u8ba1\u4e00\u4e2a\u6570&#xff09;<br \/>\nTIM_TimeBaseInitStructure.TIM_RepetitionCounter &#061; 0;  \/\/\u91cd\u590d\u8ba1\u6570\u5668&#xff0c;\u9ad8\u7ea7\u5b9a\u65f6\u5668\u624d\u4f1a\u7528\u5230<br \/>\nTIM_TimeBaseInit(TIM3,&amp;amp;TIM_TimeBaseInitStructure);<\/p>\n<p>\/*\u8f93\u5165\u6355\u83b7\u521d\u59cb\u5316*\/<br \/>\nTIM_ICInitTypeDef TIM_ICInitStructure;<br \/>\nTIM_ICStructInit(&amp;amp;TIM_ICInitStructure);<br \/>\nTIM_ICInitStructure.TIM_Channel &#061; TIM_Channel_1;\/\/\u9009\u62e9\u914d\u7f6e\u5b9a\u65f6\u5668\u901a\u90531<br \/>\nTIM_ICInitStructure.TIM_ICFilter &#061; 0xF;\/\/\u8f93\u5165\u6ee4\u6ce2\u5668\u53c2\u6570&#xff0c;\u53ef\u4ee5\u8fc7\u6ee4\u4fe1\u53f7\u6296\u52a8<br \/>\nTIM_ICInit(TIM3,&amp;amp;TIM_ICInitStructure);<br \/>\nTIM_ICStructInit(&amp;amp;TIM_ICInitStructure);<br \/>\nTIM_ICInitStructure.TIM_Channel &#061; TIM_Channel_2;\/\/\u9009\u62e9\u914d\u7f6e\u5b9a\u65f6\u5668\u901a\u90532<br \/>\nTIM_ICInitStructure.TIM_ICFilter &#061; 0xF;\/\/\u8f93\u5165\u6ee4\u6ce2\u5668\u53c2\u6570&#xff0c;\u53ef\u4ee5\u8fc7\u6ee4\u4fe1\u53f7\u6296\u52a8<br \/>\nTIM_ICInit(TIM3,&amp;amp;TIM_ICInitStructure);<\/p>\n<p>TIM_EncoderInterfaceConfig(TIM3,TIM_EncoderMode_TI12,TIM_ICPolarity_Falling,TIM_ICPolarity_Rising);<\/p>\n<p>TIM_Cmd(TIM3,ENABLE);<br \/>\n}<br \/>\nint16_t Encoder_Get(void)<br \/>\n{<br \/>\nint16_t Temp;<br \/>\nTemp &#061; TIM_GetCounter(TIM3);<br \/>\nTIM_SetCounter(TIM3,0);<br \/>\nreturn Temp;<br \/>\n}<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">main.c\u2193<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>#include &#034;stm32f10x.h&#034;                  \/\/ Device header<br \/>\n#include &#034;Delay.h&#034;<br \/>\n#include &#034;OLED.h&#034;<br \/>\n#include &#034;Timer.h&#034;<br \/>\n#include &#034;Encoder2.h&#034;<br \/>\nint16_t Speed;<br \/>\nint main(void)<br \/>\n{<br \/>\nOLED_Init();<br \/>\nTimer_Init();<br \/>\nEncoder_Init();<br \/>\nOLED_ShowString(1,1,&#034;Speed:&#034;);<br \/>\n\/\/OLED_ShowString(2,1,&#034;CNT:&#034;);<br \/>\nwhile(1)<br \/>\n{<br \/>\nOLED_ShowSignedNum(1,7,Speed,5);<br \/>\n\/\/OLED_ShowNum(2,5,TIM_GetCounter(TIM2),5);<br \/>\n}<br \/>\n}<br \/>\nvoid TIM2_IRQHandler(void)<br \/>\n{<br \/>\nif( TIM_GetITStatus(TIM2,TIM_IT_Update)&#061;&#061;SET )<br \/>\n{<br \/>\nSpeed &#061; Encoder_Get();<br \/>\nTIM_ClearITPendingBit(TIM2,TIM_IT_Update);<br \/>\n}<br \/>\n}<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p style=\"margin-left:0.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145716-6aa416cc108d5.jpg\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"margin-left:0.0001pt;text-align:justify\">1.10 \u95ee\u9898<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">\u53d1\u73b0\u663e\u793a\u5c4f\u7684\u8ba1\u6570\u6ca1\u6709\u8d1f\u6570&#xff0c;\u8bb0\u5f55\u4e86&#043;65532&#xff1f;<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u95ee\u9898\u4ea7\u751f\u539f\u56e0&#xff1a;\u663e\u793a\u5c4f\u663e\u793a\u7684\u53d8\u91cf\u201cSpeed\u201d\u5b9a\u4e49\u65f6\u7c7b\u578b\u9519\u5b9a\u4e49\u4e3a\u65e0\u7b26\u53f716\u4f4d\u6574\u578b&#xff0c;0\u518d\u51cf\u6570\u503c\u6ea2\u51fa\u621065535\u4e86<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u89e3\u51b3\u65b9\u6848&#xff1a;\u4fee\u6539\u53d8\u91cf\u201cSpeed\u201d\u7c7b\u578b\u4e3a\u6709\u7b26\u53f716\u4f4d\u6574\u578b\u5373\u53ef<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h2 style=\"background-color:transparent;margin-left:0.0001pt;text-align:justify\">\u4e8c\u3001\u603b\u7ed3<\/h2>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u6587\u56f4\u7ed5 STM32 \u7684 TIM \u7f16\u7801\u5668\u63a5\u53e3\u5c55\u5f00&#xff0c;\u7cfb\u7edf\u68b3\u7406\u4e86\u7f16\u7801\u5668\u63a5\u53e3\u7684\u5de5\u4f5c\u539f\u7406\u3001\u57fa\u672c\u7ed3\u6784\u3001\u5de5\u4f5c\u6a21\u5f0f\u4ee5\u53ca\u5b8c\u6574\u7684\u914d\u7f6e\u6d41\u7a0b&#xff0c;\u5e76\u901a\u8fc7\u4e00\u4e2a\u7f16\u7801\u5668\u6d4b\u901f\u5b9e\u4f8b&#xff0c;\u5c06\u7406\u8bba\u77e5\u8bc6\u843d\u5b9e\u5230\u5b9e\u9645\u4ee3\u7801\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f16\u7801\u5668\u63a5\u53e3\u7684\u6838\u5fc3\u4ef7\u503c\u5728\u4e8e&#xff1a;\u5b83\u80fd\u591f\u76f4\u63a5\u63a5\u6536\u589e\u91cf&#xff08;\u6b63\u4ea4&#xff09;\u7f16\u7801\u5668\u7684\u4e24\u8def\u6b63\u4ea4\u4fe1\u53f7&#xff0c;\u7531\u786c\u4ef6\u81ea\u52a8\u63a7\u5236\u8ba1\u6570\u5668 CNT \u7684\u81ea\u589e\u6216\u81ea\u51cf&#xff0c;\u4ece\u800c\u65e0\u9700 CPU \u5e72\u9884\u5373\u53ef\u5b9e\u65f6\u83b7\u53d6\u7f16\u7801\u5668\u7684\u4f4d\u7f6e\u3001\u65cb\u8f6c\u65b9\u5411\u548c\u65cb\u8f6c\u901f\u5ea6\u3002\u6bcf\u4e2a\u9ad8\u7ea7\u5b9a\u65f6\u5668\u548c\u901a\u7528\u5b9a\u65f6\u5668\u90fd\u5185\u7f6e\u4e00\u4e2a\u7f16\u7801\u5668\u63a5\u53e3&#xff0c;\u4e24\u4e2a\u8f93\u5165\u5f15\u811a\u590d\u7528\u8f93\u5165\u6355\u83b7\u7684\u901a\u9053 1 \u548c\u901a\u9053 2&#xff0c;\u4f7f\u7528\u8d77\u6765\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u914d\u7f6e\u6d41\u7a0b\u4e0a&#xff0c;\u4e3b\u8981\u5206\u4e3a\u4ee5\u4e0b\u51e0\u6b65&#xff1a;\u5148\u901a\u8fc7 RCC \u5f00\u542f GPIO \u548c\u5b9a\u65f6\u5668\u7684\u65f6\u949f&#xff1b;\u518d\u5c06 PA6\u3001PA7 \u914d\u7f6e\u4e3a\u8f93\u5165\u6a21\u5f0f&#xff1b;\u968f\u540e\u914d\u7f6e\u65f6\u57fa\u5355\u5143&#xff0c;\u9884\u5206\u9891\u5668\u4e00\u822c\u4e0d\u5206\u9891&#xff0c;\u81ea\u52a8\u91cd\u88c5\u503c\u8bbe\u4e3a\u6700\u5927 65535&#xff0c;\u4ec5\u8ba9 CNT \u6267\u884c\u8ba1\u6570&#xff1b;\u63a5\u7740\u914d\u7f6e\u8f93\u5165\u6355\u83b7\u5355\u5143&#xff0c;\u5176\u4e2d\u53ea\u6709\u6ee4\u6ce2\u5668\u548c\u6781\u6027\u4e24\u4e2a\u53c2\u6570\u6709\u6548&#xff1b;\u7136\u540e\u914d\u7f6e\u7f16\u7801\u5668\u63a5\u53e3\u6a21\u5f0f&#xff1b;\u6700\u540e\u8c03\u7528 TIM_Cmd \u542f\u52a8\u5b9a\u65f6\u5668\u3002\u6574\u4e2a\u6d41\u7a0b\u6e05\u6670&#xff0c;\u6309\u90e8\u5c31\u73ed\u5373\u53ef\u5b8c\u6210\u521d\u59cb\u5316\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">GPIO \u8f93\u5165\u6a21\u5f0f\u7684\u9009\u62e9\u9700\u8981\u7ed3\u5408\u5916\u90e8\u6a21\u5757\u7684\u9ed8\u8ba4\u7535\u5e73&#xff1a;\u5916\u90e8\u7a7a\u95f2\u9ed8\u8ba4\u8f93\u51fa\u9ad8\u7535\u5e73\u65f6\u9009\u62e9\u4e0a\u62c9\u8f93\u5165&#xff0c;\u9ed8\u8ba4\u8f93\u51fa\u4f4e\u7535\u5e73\u65f6\u9009\u62e9\u4e0b\u62c9\u8f93\u5165&#xff0c;\u82e5\u4e0d\u786e\u5b9a\u9ed8\u8ba4\u72b6\u6001\u6216\u4fe1\u53f7\u529f\u7387\u8f83\u5c0f\u65f6\u5219\u9009\u62e9\u6d6e\u7a7a\u8f93\u5165\u3002\u6b63\u786e\u9009\u62e9\u8f93\u5165\u6a21\u5f0f&#xff0c;\u53ef\u4ee5\u907f\u514d\u9ed8\u8ba4\u7535\u5e73\u51b2\u7a81&#xff0c;\u4fdd\u8bc1\u4fe1\u53f7\u7a33\u5b9a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u5b9e\u4f8b\u73af\u8282&#xff0c;\u901a\u8fc7 Timer.c\u3001Encoder.c \u548c main.c \u4e09\u4e2a\u6587\u4ef6\u7684\u914d\u5408&#xff0c;\u5b9e\u73b0\u4e86\u7f16\u7801\u5668\u6d4b\u901f\u529f\u80fd\u3002\u5176\u4e2d Encoder.c \u5b8c\u6210\u4e86 GPIO\u3001\u65f6\u57fa\u5355\u5143\u3001\u8f93\u5165\u6355\u83b7\u548c\u7f16\u7801\u5668\u63a5\u53e3\u6a21\u5f0f\u7684\u521d\u59cb\u5316&#xff0c;main.c \u5728\u5b9a\u65f6\u4e2d\u65ad\u4e2d\u5468\u671f\u6027\u8bfb\u53d6\u7f16\u7801\u5668\u8ba1\u6570\u5e76\u6362\u7b97\u4e3a\u901f\u5ea6\u663e\u793a\u5728 OLED \u4e0a\u3002\u9488\u5bf9\u6d4b\u901f\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684\u8ba1\u6570\u65e0\u8d1f\u6570\u3001\u663e\u793a &#043;65532 \u7684\u95ee\u9898&#xff0c;\u5b9a\u4f4d\u4e3a\u53d8\u91cf Speed \u88ab\u9519\u8bef\u5b9a\u4e49\u4e3a\u65e0\u7b26\u53f7 16 \u4f4d\u6574\u578b&#xff0c;\u5bfc\u81f4 0 \u51cf\u6570\u503c\u6ea2\u51fa\u4e3a 65535&#xff0c;\u5c06\u5176\u6539\u4e3a\u6709\u7b26\u53f7 16 \u4f4d\u6574\u578b\u540e\u95ee\u9898\u5373\u5f97\u5230\u89e3\u51b3\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u603b\u7684\u6765\u8bf4&#xff0c;TIM \u7f16\u7801\u5668\u63a5\u53e3\u5c06\u590d\u6742\u7684\u6b63\u4ea4\u4fe1\u53f7\u89e3\u7801\u5de5\u4f5c\u4ea4\u7531\u786c\u4ef6\u5b8c\u6210&#xff0c;\u5927\u5927\u7b80\u5316\u4e86\u7f16\u7801\u5668\u5e94\u7528\u7684\u5f00\u53d1\u96be\u5ea6\u3002\u638c\u63e1\u5176\u5de5\u4f5c\u539f\u7406\u548c\u914d\u7f6e\u6d41\u7a0b\u540e&#xff0c;\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u5176\u5e94\u7528\u5230\u7535\u673a\u6d4b\u901f\u3001\u4f4d\u7f6e\u68c0\u6d4b\u3001\u65cb\u8f6c\u65b9\u5411\u5224\u65ad\u7b49\u5b9e\u9645\u9879\u76ee\u4e2d\u3002\u540e\u7eed\u82e5\u9700\u8fdb\u4e00\u6b65\u63d0\u9ad8\u6d4b\u91cf\u7cbe\u5ea6&#xff0c;\u8fd8\u53ef\u4ee5\u7ed3\u5408\u5b9a\u65f6\u5668\u4e2d\u65ad\u3001\u6ee4\u6ce2\u53c2\u6570\u8c03\u6574\u4ee5\u53ca\u66f4\u7cbe\u7ec6\u7684\u8ba1\u6570\u5468\u671f\u8bbe\u8ba1\u6765\u4f18\u5316\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u90fd\u770b\u5230\u8fd9\u4e86\u70b9\u70b9\u8d5e\u5427&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u300aTIM\u8f93\u5165\u6355\u83b7&#xff08;STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0&#xff09;\u300b\u4e2d&#xff0c;\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5229\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u6355\u83b7\u529f\u80fd\u6d4b\u91cf\u8f93\u5165\u4fe1\u53f7\u7684\u9891\u7387\u3001\u5468\u671f\u548c\u8109\u5bbd\u3002\u8f93\u5165\u6355\u83b7\u672c\u8d28\u4e0a\u662f\u5bf9\u5916\u90e8\u4fe1\u53f7\u8fb9\u6cbf\u7684\u6355\u6349\u4e0e\u8ba1\u65f6&#xff0c;\u5b83\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u7cbe\u786e\u6d4b\u91cf\u5916\u90e8\u8109\u51b2\u7684\u65f6\u95f4\u4fe1\u606f\u3002\u7136\u800c&#xff0c;\u5728\u5b9e\u9645\u7684\u7535\u673a\u63a7\u5236\u3001\u4f4d\u7f6e\u68c0\u6d4b\u7b49\u573a\u666f\u4e2d&#xff0c;\u6211\u4eec\u5f80\u5f80\u4e0d\u4ec5\u9700\u8981\u6d4b\u91cf\u8109\u51b2\u7684\u65f6\u95f4&#xff0c;\u66f4\u9700\u8981\u5b9e\u65f6\u83b7\u53d6\u65cb\u8f6c\u673a\u6784\u7684\u4f4d\u7f6e\u3001\u65b9\u5411\u548c\u901f\u5ea6&#xff0c;\u8fd9\u65f6\u4ec5\u4ec5\u4f9d\u9760\u8f93\u5165\u6355\u83b7\u5c31\u663e\u5f97\u529b\u4e0d\u4ece\u5fc3<\/p>\n","protected":false},"author":2,"featured_media":104163,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11815,217,270,371,269,124],"topic":[],"class_list":["post-104171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-11815","tag-stm32","tag-270","tag-371","tag-269","tag-124"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\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\/104171.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u300aTIM\u8f93\u5165\u6355\u83b7&#xff08;STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0&#xff09;\u300b\u4e2d&#xff0c;\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5229\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u6355\u83b7\u529f\u80fd\u6d4b\u91cf\u8f93\u5165\u4fe1\u53f7\u7684\u9891\u7387\u3001\u5468\u671f\u548c\u8109\u5bbd\u3002\u8f93\u5165\u6355\u83b7\u672c\u8d28\u4e0a\u662f\u5bf9\u5916\u90e8\u4fe1\u53f7\u8fb9\u6cbf\u7684\u6355\u6349\u4e0e\u8ba1\u65f6&#xff0c;\u5b83\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u7cbe\u786e\u6d4b\u91cf\u5916\u90e8\u8109\u51b2\u7684\u65f6\u95f4\u4fe1\u606f\u3002\u7136\u800c&#xff0c;\u5728\u5b9e\u9645\u7684\u7535\u673a\u63a7\u5236\u3001\u4f4d\u7f6e\u68c0\u6d4b\u7b49\u573a\u666f\u4e2d&#xff0c;\u6211\u4eec\u5f80\u5f80\u4e0d\u4ec5\u9700\u8981\u6d4b\u91cf\u8109\u51b2\u7684\u65f6\u95f4&#xff0c;\u66f4\u9700\u8981\u5b9e\u65f6\u83b7\u53d6\u65cb\u8f6c\u673a\u6784\u7684\u4f4d\u7f6e\u3001\u65b9\u5411\u548c\u901f\u5ea6&#xff0c;\u8fd9\u65f6\u4ec5\u4ec5\u4f9d\u9760\u8f93\u5165\u6355\u83b7\u5c31\u663e\u5f97\u529b\u4e0d\u4ece\u5fc3\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/104171.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-11T14:57:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145714-6aa416ca5b9c6.png\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104171.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/104171.html\",\"name\":\"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-11T14:57:17+00:00\",\"dateModified\":\"2026-09-11T14:57:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/104171.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/104171.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104171.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\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":"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\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\/104171.html","og_locale":"zh_CN","og_type":"article","og_title":"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728\u4e0a\u4e00\u7bc7\u6587\u7ae0\u300aTIM\u8f93\u5165\u6355\u83b7&#xff08;STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0&#xff09;\u300b\u4e2d&#xff0c;\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5229\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u6355\u83b7\u529f\u80fd\u6d4b\u91cf\u8f93\u5165\u4fe1\u53f7\u7684\u9891\u7387\u3001\u5468\u671f\u548c\u8109\u5bbd\u3002\u8f93\u5165\u6355\u83b7\u672c\u8d28\u4e0a\u662f\u5bf9\u5916\u90e8\u4fe1\u53f7\u8fb9\u6cbf\u7684\u6355\u6349\u4e0e\u8ba1\u65f6&#xff0c;\u5b83\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u7cbe\u786e\u6d4b\u91cf\u5916\u90e8\u8109\u51b2\u7684\u65f6\u95f4\u4fe1\u606f\u3002\u7136\u800c&#xff0c;\u5728\u5b9e\u9645\u7684\u7535\u673a\u63a7\u5236\u3001\u4f4d\u7f6e\u68c0\u6d4b\u7b49\u573a\u666f\u4e2d&#xff0c;\u6211\u4eec\u5f80\u5f80\u4e0d\u4ec5\u9700\u8981\u6d4b\u91cf\u8109\u51b2\u7684\u65f6\u95f4&#xff0c;\u66f4\u9700\u8981\u5b9e\u65f6\u83b7\u53d6\u65cb\u8f6c\u673a\u6784\u7684\u4f4d\u7f6e\u3001\u65b9\u5411\u548c\u901f\u5ea6&#xff0c;\u8fd9\u65f6\u4ec5\u4ec5\u4f9d\u9760\u8f93\u5165\u6355\u83b7\u5c31\u663e\u5f97\u529b\u4e0d\u4ece\u5fc3","og_url":"https:\/\/www.wsisp.com\/helps\/104171.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-11T14:57:17+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260911145714-6aa416ca5b9c6.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/104171.html","url":"https:\/\/www.wsisp.com\/helps\/104171.html","name":"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-11T14:57:17+00:00","dateModified":"2026-09-11T14:57:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/104171.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/104171.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/104171.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"TIM\u7f16\u7801\u5668\u63a5\u53e3\uff08STM32\u6807\u51c6\u5e93\u5b66\u4e60\u7b14\u8bb0\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\/104171","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=104171"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/104163"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=104171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=104171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=104171"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=104171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}