{"id":43197,"date":"2025-06-11T08:56:36","date_gmt":"2025-06-11T00:56:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/43197.html"},"modified":"2025-06-11T08:56:36","modified_gmt":"2025-06-11T00:56:36","slug":"stm32%e4%b9%8btim%e5%ae%9a%e6%97%b6%e4%b8%ad%e6%96%ad%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/43197.html","title":{"rendered":"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3"},"content":{"rendered":"<\/p>\n<h4>\u76ee\u5f55<\/h4>\n<ul>\n<li>1.\u5f15\u5165<\/li>\n<li>\n<ul>\n<li>1.1 \u7b80\u4ecb<\/li>\n<li>1.2 \u7c7b\u578b<\/li>\n<li>\n<ul>\n<li>1.2.1 \u57fa\u672c\u5b9a\u65f6\u5668<\/li>\n<li>1.2.2 \u901a\u7528\u5b9a\u65f6\u5668<\/li>\n<li>\n<ul>\n<li>1. \u89e6\u53d1\u63a7\u5236\u5355\u5143 (Trigger Control Unit)<\/li>\n<li>2. \u8f93\u5165\u6355\u83b7\u5355\u5143 (Input Capture Unit)<\/li>\n<li>3. \u8f93\u51fa\u6bd4\u8f83\u5355\u5143 (Output Compare Unit)<\/li>\n<li>4. CNT \u8ba1\u6570\u5668<\/li>\n<li>5. \u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668 (ARR)<\/li>\n<li>6. \u9884\u5206\u9891\u5668 (PSC)<\/li>\n<li>7. \u4e2d\u65ad\u4e0e DMA \u4e8b\u4ef6<\/li>\n<li>8. \u5239\u8f66\u529f\u80fd (Break Input, BRK)<\/li>\n<\/ul>\n<\/li>\n<li>1.2.3 \u9ad8\u7ea7\u5b9a\u65f6\u5668<\/li>\n<li>\n<ul>\n<li>1. \u89e6\u53d1\u63a7\u5236\u5355\u5143 (Trigger Control Unit)<\/li>\n<li>2. \u65f6\u57fa\u5355\u5143 (Counter and ARR)<\/li>\n<li>3. \u8f93\u5165\u6355\u83b7\u5355\u5143 (Input Capture Unit)<\/li>\n<li>4. \u8f93\u51fa\u6bd4\u8f83\u5355\u5143 (Output Compare Unit)<\/li>\n<li>5. \u5239\u8f66\u8f93\u5165\u5355\u5143 (Break Input)<\/li>\n<li>6. \u6b7b\u533a\u65f6\u95f4\u63a7\u5236\u5355\u5143 (Dead-Time Generator, DTG)<\/li>\n<li>7. \u4e3b\u4ece\u6a21\u5f0f\u63a7\u5236 (Master-Slave Mode Control)<\/li>\n<li>8. \u4e8b\u4ef6\u751f\u6210\u4e0e\u4e2d\u65ad<\/li>\n<li>9.\u91cd\u590d\u8ba1\u6570\u5668 (Repetition Counter, REP)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>1.3 \u5b9a\u65f6\u4e2d\u65ad\u57fa\u672c\u7ed3\u6784\u56fe<\/li>\n<li>1.4 \u65f6\u5e8f<\/li>\n<li>\n<ul>\n<li>1.4.1 PSC\u9884\u5206\u9891\u5668<\/li>\n<li>1.4.2 \u8ba1\u65f6\u5668\u65f6\u5e8f<\/li>\n<li>1.4.3 \u8ba1\u6570\u5668\u65e0\u9884\u88c5\u65f6\u5e8f<\/li>\n<li>1.4.4 \u8ba1\u6570\u5668\u6709\u9884\u88c5\u65f6\u5e8f<\/li>\n<\/ul>\n<\/li>\n<li>1.5 RCC\u65f6\u949f\u6811<\/li>\n<\/ul>\n<\/li>\n<li>2.\u57fa\u672c\u4f7f\u7528<\/li>\n<li>\n<ul>\n<li>2.1 \u6b65\u9aa4<\/li>\n<li>2.2 \u76f8\u5173\u51fd\u6570<\/li>\n<li>2.3 \u7ed3\u6784\u4f53<\/li>\n<li>2.4 \u7f16\u5199<\/li>\n<li>\n<ul>\n<li>2.4.1 \u5b9a\u65f6\u5668\u5185\u90e8\u4e2d\u65ad<\/li>\n<li>2.4.2 \u5b9a\u65f6\u5668\u5916\u90e8\u4e2d\u65ad<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005625-6848d4399abd0.gif\" alt=\"img\" \/><\/p>\n<h2>1.\u5f15\u5165<\/h2>\n<h3>1.1 \u7b80\u4ecb<\/h3>\n<p>TIM&#xff08;Timer&#xff09;\u5b9a\u65f6\u5668<\/p>\n<p>\u5b9a\u65f6\u5668\u53ef\u4ee5\u5bf9\u8f93\u5165\u7684\u65f6\u949f\u8fdb\u884c\u8ba1\u6570&#xff0c;\u5e76\u5728\u8ba1\u6570\u503c\u8fbe\u5230\u8bbe\u5b9a\u503c\u65f6\u89e6\u53d1\u4e2d\u65ad<\/p>\n<p>16\u4f4d\u8ba1\u6570\u5668\u3001\u9884\u5206\u9891\u5668\u3001\u81ea\u52a8\u91cd\u88c5\u5bc4\u5b58\u5668\u7684\u65f6\u57fa\u5355\u5143&#xff0c;\u572872MHz\u8ba1\u6570\u65f6\u949f\u4e0b\u53ef\u4ee5\u5b9e\u73b0\u6700\u592759.65s\u7684\u5b9a\u65f6<\/p>\n<p>\u4e0d\u4ec5\u5177\u5907\u57fa\u672c\u7684\u5b9a\u65f6\u4e2d\u65ad\u529f\u80fd&#xff0c;\u800c\u4e14\u8fd8\u5305\u542b\u5185\u5916\u65f6\u949f\u6e90\u9009\u62e9\u3001\u8f93\u5165\u6355\u83b7\u3001\u8f93\u51fa\u6bd4\u8f83\u3001\u7f16\u7801\u5668\u63a5\u53e3\u3001\u4e3b\u4ece\u89e6\u53d1\u6a21\u5f0f\u7b49\u591a\u79cd\u529f\u80fd<\/p>\n<p>\u6839\u636e\u590d\u6742\u5ea6\u548c\u5e94\u7528\u573a\u666f\u5206\u4e3a\u4e86\u9ad8\u7ea7\u5b9a\u65f6\u5668\u3001\u901a\u7528\u5b9a\u65f6\u5668\u3001\u57fa\u672c\u5b9a\u65f6\u5668\u4e09\u79cd\u7c7b\u578b<\/p>\n<p>\u6240\u8c13\u5b9a\u65f6\u5668&#xff0c;\u5c31\u662f\u95f9\u949f&#xff0c;\u65f6\u95f4\u5230\u540e\u4f60\u5c31\u8981\u505a\u67d0\u4e9b\u4e8b\u3002\u6709 2 \u4e2a\u8981\u7d20&#xff1a;\u65f6\u95f4\u3001\u505a\u4e8b&#xff0c;\u6362\u6210\u7a0b\u5e8f\u5458\u7684\u8bdd\u5c31\u662f&#xff1a;\u8d85\u65f6\u65f6\u95f4\u3001\u51fd\u6570\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005625-6848d439a67b3.jpg\" alt=\"img\" \/><\/p>\n<p>\u6bd4\u5982\u4ee5\u6309\u952e\u4e3a\u4f8b&#xff0c;\u4f7f\u7528\u5b9a\u65f6\u5668\u53ef\u4ee5\u89e3\u51b3\u6296\u52a8\u73b0\u8c61&#xff0c;\u672a\u8d85\u65f6\u5c31\u53d1\u751f\u4e2d\u65ad&#xff0c;\u5c31\u91cd\u65b0\u8ba1\u65f6&#xff0c;\u5f53\u6296\u52a8\u505c\u6b62\u4e86&#xff0c;\u8d85\u8fc7\u5b9a\u65f6\u7684\u65f6\u95f4&#xff0c;\u5c31\u53ef\u4ee5\u53d6\u8c03\u7528\u4e2d\u65ad\u51fd\u6570\u53bb\u5904\u7406\u7a33\u5b9a\u540e\u7684\u6309\u952e\u4e2d\u65ad\u4e8b\u4ef6\u3002&#xff08;\u6ce8&#xff1a;\u4e0a\u56fe\u7684\u63d0\u5230\u7684\u51fd\u6570\u662flinux\u5f00\u53d1\u677f\u7684&#xff0c;\u4f46\u662f\u539f\u7406\u5176\u5b9e\u662f\u5dee\u4e0d\u591a\u7684&#xff09;<\/p>\n<h3>1.2 \u7c7b\u578b<\/h3>\n<table>\n<tr>\u7c7b\u578b\u7f16\u53f7\u603b\u7ebf\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>\u9ad8\u7ea7\u5b9a\u65f6\u5668<\/td>\n<td>TIM1\u3001TIM8<\/td>\n<td>APB2<\/td>\n<td>\u62e5\u6709\u901a\u7528\u5b9a\u65f6\u5668\u5168\u90e8\u529f\u80fd&#xff0c;\u5e76\u989d\u5916\u5177\u6709\u91cd\u590d\u8ba1\u6570\u5668\u3001\u6b7b\u533a\u751f\u6210\u3001\u4e92\u8865\u8f93\u51fa\u3001\u5239\u8f66\u8f93\u5165\u7b49\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td>\u901a\u7528\u5b9a\u65f6\u5668<\/td>\n<td>TIM2\u3001TIM3\u3001TIM4\u3001TIM5<\/td>\n<td>APB1<\/td>\n<td>\u62e5\u6709\u57fa\u672c\u5b9a\u65f6\u5668\u5168\u90e8\u529f\u80fd&#xff0c;\u5e76\u989d\u5916\u5177\u6709\u5185\u5916\u65f6\u949f\u6e90\u9009\u62e9\u3001\u8f93\u5165\u6355\u83b7\u3001\u8f93\u51fa\u6bd4\u8f83\u3001\u7f16\u7801\u5668\u63a5\u53e3\u3001\u4e3b\u4ece\u89e6\u53d1\u6a21\u5f0f\u7b49\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td>\u57fa\u672c\u5b9a\u65f6\u5668<\/td>\n<td>TIM6\u3001TIM7<\/td>\n<td>APB1<\/td>\n<td>\u62e5\u6709\u5b9a\u65f6\u4e2d\u65ad\u3001\u4e3b\u6a21\u5f0f\u89e6\u53d1DAC\u7684\u529f\u80fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>STM32F103C8T6\u5b9a\u65f6\u5668\u8d44\u6e90&#xff1a;TIM1\u3001TIM2\u3001TIM3\u3001TIM4<\/p>\n<h4>1.2.1 \u57fa\u672c\u5b9a\u65f6\u5668<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005626-6848d43a37582.jpg\" alt=\"img\" \/><\/p>\n<p>\u9884\u5206\u9891\u5668&#xff1a;<\/p>\n<ul>\n<li>\u8fde\u63a5\u7684\u662f\u57fa\u51c6\u8ba1\u6570\u65f6\u949f\u7684\u8f93\u5165&#xff0c;\u5176\u4e00\u822c\u6765\u81eaRCC\u7684TIMxCLK&#xff0c;\u4e00\u822c\u662f\u7cfb\u7edf\u7684\u4e3b\u989172MHz\u3002<\/li>\n<li>\u800c\u9884\u5206\u9891\u5668\u5219\u662f\u5bf9\u8f93\u5165\u7684\u57fa\u51c6\u65f6\u949f72MHz\u8fdb\u884c\u9884\u5206\u914d&#xff0c;\u6bd4\u5982\u4e3a0\u65f6&#xff0c;72\/1&#061;72MHz&#xff1b;\u4e3a1\u65f6&#xff0c;72\/2&#061;36MHz<\/li>\n<li>\u8fd9\u4e2a\u5206\u914d\u5668\u662f16\u4f4d\u7684&#xff0c;\u4e5f\u5c31\u662f\u6700\u591a\u53ef\u4ee5\u5206\u98912\u768416\u6b21\u65b9<\/li>\n<\/ul>\n<p>CNT\u8ba1\u6570\u5668&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u9884\u5206\u5c4f\u540e\u7684\u8ba1\u6570\u65f6\u949f\u8fdb\u884c\u8ba1\u6570&#xff0c;\u8ba1\u6570\u65f6\u949f\u6bcf\u6765\u4e00\u4e2a\u4e0a\u5347\u6cbf&#xff0c;\u5219&#043;1<\/li>\n<\/ul>\n<p>\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668&#xff1a;<\/p>\n<ul>\n<li>\u5b58\u50a8\u76ee\u6807\u65f6\u949f\u8ba1\u6570&#xff0c;CNT\u8ba1\u6570\u5668\u8ba1\u7684\u65f6\u949f\u6570\u548c\u5176\u5b58\u50a8\u7684\u76ee\u6807\u65f6\u949f\u8ba1\u6570\u76f8\u540c\u65f6&#xff0c;\u5c31\u53d1\u9001\u4e2d\u65ad\u4fe1\u53f7(UI)\u6216\u66f4\u65b0\u4e8b\u4ef6&#xff08;U&#xff09;\u3002<\/li>\n<li>\u540c\u65f6CNT\u8ba1\u6570\u5668\u4f1a\u6e050<\/li>\n<\/ul>\n<p>\u4e09\u8005\u6784\u6210\u4e86\u65f6\u57fa\u5355\u5143\u3002<\/p>\n<p>\u540c\u65f6\u8fd8\u63d0\u5230\u4e86\u4e3b\u6a21\u5f0f\u89e6\u53d1DAC\u7684\u529f\u80fd&#xff0c;\u4e3b\u4ece\u89e6\u53d1\u6a21\u5f0f\u662fstm32\u7684\u4e00\u5927\u7279\u8272&#xff0c;\u5b83\u80fd\u8ba9\u5185\u90e8\u7684\u786c\u4ef6\u5728\u4e0d\u53d7\u7a0b\u5e8f\u7684\u63a7\u5236\u4e0b\u5b9e\u73b0\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<p>\u5728\u6846\u56fe\u4e2d\u6709\u4e2a\u90e8\u5206\u5199\u7740\u81f3DAC&#xff0c;\u5728\u6211\u4eec\u4f7f\u7528DAC\u7684\u65f6\u5019&#xff0c;\u53ef\u80fd\u4f1a\u7528DAC&#xff08;\u6570\u5b57\u6a21\u62df\u4fe1\u53f7\u8f6c\u6362\u5668&#xff09;\u8f93\u51fa\u4e00\u6bb5\u6ce2\u5f62&#xff0c;\u90a3\u4e48\u5c31\u9700\u8981\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u6765\u89e6\u53d1\u4e00\u6b21DAC&#xff0c;\u8ba9\u5b83\u8f93\u51fa\u4e0b\u4e00\u4e2a\u7535\u538b\u70b9\u3002<\/p>\n<p>\u77e5\u9053\u4e86\u5b9a\u65f6\u5668\u540e\u6211\u4eec\u53ef\u80fd\u4f1a\u60f3\u5230\u5148\u8bbe\u7f6e\u4e00\u4e2a\u5b9a\u65f6\u5668&#xff0c;\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u4ea7\u751f\u4e2d\u65ad&#xff0c;\u5728\u4e2d\u65ad\u51fd\u6570\u4e2d\u53bb\u8ba9DAC\u8fdb\u884c\u8f6c\u6362\u3001\u8f93\u51fa\u3002\u867d\u7136\u8fd9\u6837\u6ca1\u95ee\u9898&#xff0c;\u4f46\u662f\u4f1a\u9020\u6210CPU\u8d1f\u62c5&#xff0c;\u56e0\u4e3a\u9700\u8981\u4e2d\u65ad\u7684\u6b21\u6570\u4e0d\u5c11&#xff0c;\u4e3b\u7a0b\u5e8f\u4e5f\u8001\u662f\u5904\u4e8e\u88ab\u9891\u6bb5\u4e2d\u65ad\u7684\u72b6\u6001\u3002\u8fd9\u65f6\u5019\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e3b\u6a21\u5f0f\u89e6\u53d1DAC<\/p>\n<p>\u4e5f\u5c31\u662f\u5c06\u66f4\u65b0\u4e8b\u4ef6(U)\u6620\u5c04\u5230TRGC&#xff08;Trogger Out&#xff09;\u7684\u4f4d\u7f6e&#xff0c;\u7136\u540e\u63a5\u5230DAC\u8f6c\u6362\u5668\u4e0a&#xff0c;\u8fd9\u6837\u5c31\u53ef\u4ee5\u91c7\u7528\u4e8b\u4ef6\u89e6\u53d1\u7684\u65b9\u5f0f\u53bb\u901a\u77e5DAC\u8fdb\u884c\u8f6c\u6362\u3002<\/p>\n<p>\u5176\u5b9e\u5c31\u662f\u548cLinux\u5f00\u53d1\u677f\u4e2d\u7684MSI\u6216MSI-X\u7684\u6d88\u606f\u4e2d\u65ad\u65b9\u5f0f\u662f\u6709\u70b9\u76f8\u4f3c\u7684&#xff0c;\u4e0d\u662f\u91c7\u7528\u4f20\u7edf\u7684INTx\u5f15\u811a\u4e2d\u65ad\u89e6\u53d1\u65b9\u5f0f&#xff0c;\u800c\u662fevent\u6d88\u606f\u6765\u89e6\u53d1\u4e2d\u65ad\u3002\u867d\u7136stm32\u8fd9\u79cd\u4e0d\u7b97\u662f\u4e2d\u65ad&#xff0c;\u4f46\u5176\u5b9e\u4e5f\u662f\u7528event\u4e8b\u4ef6\u6765\u8ba9\u67d0\u4e9b\u8bbe\u5907\u5f00\u59cb\u5de5\u4f5c\u3002<\/p>\n<h4>1.2.2 \u901a\u7528\u5b9a\u65f6\u5668<\/h4>\n<p>\u62e5\u6709\u57fa\u672c\u5b9a\u65f6\u5668\u5168\u90e8\u529f\u80fd&#xff0c;\u5e76\u989d\u5916\u5177\u6709\u5185\u5916\u65f6\u949f\u6e90\u9009\u62e9\u3001\u8f93\u5165\u6355\u83b7\u3001\u8f93\u51fa\u6bd4\u8f83\u3001\u7f16\u7801\u5668\u63a5\u53e3\u3001\u4e3b\u4ece\u89e6\u53d1\u6a21\u5f0f\u7b49\u529f\u80fd<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005626-6848d43aa48ca.jpg\" alt=\"img\" \/><\/p>\n<p>\u4e2d\u95f4\u7684\u8fd8\u662f\u65f6\u57fa\u5355\u5143&#xff0c;\u548c\u57fa\u672c\u5b9a\u65f6\u5668\u662f\u4e00\u6837\u7684\u529f\u80fd\u3002\u4e0d\u8fc7\u5bf9\u4e8eCNT\u8ba1\u6570\u5668&#xff0c;\u5728\u8fd9\u91cc\u4e0d\u662f\u53ea\u6709\u5411\u4e0a\u8ba1\u6570\u7684\u6a21\u5f0f\u4e86&#xff08;\u81ea\u589e&#xff09;&#xff0c;\u5728\u8fd9\u91cc\u8fd8\u652f\u6301&#xff1a;<\/p>\n<ul>\n<li>\u5411\u4e0b\u8ba1\u6570&#xff1a;\u81ea\u51cf\u5230\u91cd\u88c5\u503c&#xff0c;\u4ea7\u751f\u4e2d\u65ad&#xff0c;\u6e050<\/li>\n<li>\u4e2d\u592e\u5bf9\u9f50\u8ba1\u6570&#xff1a;\u5148\u5148\u4e0a\u81ea\u589e\u5230\u91cd\u88c5\u503c&#xff0c;\u4ea7\u751f\u4e2d\u65ad&#xff0c;\u7136\u540e\u518d\u5411\u4e0b\u81ea\u51cf\u52300&#xff0c;\u4ea7\u751f\u4e2d\u65ad<\/li>\n<\/ul>\n<h5>1. \u89e6\u53d1\u63a7\u5236\u5355\u5143 (Trigger Control Unit)<\/h5>\n<p>\u8fd9\u4e2a\u6a21\u5757\u7528\u4e8e\u751f\u6210\u548c\u9009\u62e9\u4e0d\u540c\u7684\u89e6\u53d1\u4fe1\u53f7&#xff0c;\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u5185\u90e8\u89e6\u53d1\u8f93\u5165 (ITR)&#xff1a;\u53ef\u4ee5\u4ece\u5176\u4ed6\u5b9a\u65f6\u5668\u6216\u6a21\u5757\u83b7\u53d6\u89e6\u53d1\u4fe1\u53f7&#xff08;\u4f8b\u5982 ITR0\u3001ITR1\u3001ITR2\u3001ITR3&#xff09;\u3002\u53ef\u4ee5\u5b9e\u73b0\u5b9a\u65f6\u5668\u7ea7\u8054\u3002\u6bd4\u5982\u521d\u59cb\u5316\u597dTIM3&#xff0c;\u5c06\u8ba1\u6570\u5668\u5904\u7684\u4e8b\u4ef6\u66f4\u65b0\u89e6\u53d1&#xff08;U&#xff09;\u6620\u5c04\u5230TRGO&#xff0c;\u7136\u540eTRGO\u518d\u53bb\u8fde\u63a5\u5230TIM2\u7684ITR2&#xff0c;\u5b9e\u73b0\u8ba1\u65f6\u5668\u7684\u7ea7\u8054&#xff0c;\u8fd9\u6837TIM3\u7684\u66f4\u65b0\u4e8b\u4ef6\u5c31\u80fd\u53bb\u9a71\u52a8TIM2\u7684\u8ba1\u6570\u5355\u5143\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005627-6848d43b642d6.png\" alt=\"img\" \/><\/p>\n<ul>\n<li>\n<p>\u5916\u90e8\u89e6\u53d1\u8f93\u5165 (ETR)&#xff1a;\u53ef\u4ee5\u4ece\u5916\u90e8\u5f15\u811a\u83b7\u53d6\u89e6\u53d1\u4fe1\u53f7&#xff0c;\u901a\u8fc7 ETRP \u63a7\u5236\u8f93\u5165\u6781\u6027&#xff0c;\u7ecf\u8fc7\u8f93\u5165\u6ee4\u6ce2\u5668\u540e&#xff0c;\u5f97\u5230\u89e6\u53d1\u4fe1\u53f7 ETRF\u3002<\/p>\n<\/li>\n<li>\n<ul>\n<li>\u5c31\u662f\u53ef\u4ee5\u5728\u4e00\u4e9b\u652f\u6301TIM\u529f\u80fd\u7684\u5f15\u811a\u4e0a\u63a5\u4e00\u4e2a\u5916\u90e8\u65f6\u949f&#xff08;ETR&#xff09;&#xff0c;\u8fd9\u6837\u5c31\u4e0d\u662f\u50cf\u57fa\u672c\u901a\u7528\u5b9a\u65f6\u5668\u90a3\u6837\u901a\u8fc7CK_INT\u6765\u63a5\u5165\u7cfb\u7edf\u5185\u90e8\u7684\u6765\u81eaRCC\u7684CK_TIM18\u5185\u90e8\u65f6\u949f\u3002<\/li>\n<li>\u53ef\u4ee5\u9009\u62e9\u901a\u8fc7ETRF\u89e6\u53d1\u4fe1\u53f7\u5230\u89e6\u53d1\u63a7\u5236\u5668&#xff0c;\u518d\u5230PSC\u5206\u9891\u5668\u3002<\/li>\n<li>\u4e5f\u53ef\u4ee5\u901a\u8fc7TRQI\u5230\u4ece\u6a21\u5f0f\u63a7\u5236\u5668&#xff0c;\u89e6\u53d1\u5b9a\u65f6\u5668\u7684\u4ece\u6a21\u5f0f&#xff0c;\u518d\u5230PSC\u5206\u9891\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>TRGO \u8f93\u51fa\u4fe1\u53f7&#xff1a;\u5c06\u89e6\u53d1\u4fe1\u53f7\u8f93\u51fa\u81f3 DAC \u6216 ADC&#xff0c;\u8fdb\u884c\u534f\u8c03\u540c\u6b65\u3002<\/p>\n<\/li>\n<li>\n<p>\u4ece\u6a21\u5f0f\u63a7\u5236&#xff1a;\u5141\u8bb8\u5b9a\u65f6\u5668\u5728\u4e3b\u4ece\u6a21\u5f0f\u4e0b\u5de5\u4f5c&#xff0c;\u901a\u8fc7\u4ece\u6a21\u5f0f\u5bc4\u5b58\u5668\u914d\u7f6e\u89e6\u53d1\u4fe1\u53f7&#xff08;\u4f8b\u5982\u590d\u4f4d\u3001\u4f7f\u80fd\u3001\u5411\u4e0a\/\u5411\u4e0b\u8ba1\u6570\u7b49&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5bf9\u4e8eTRGI&#xff0c;\u83b7\u5f97\u65f6\u949f&#xff0c;\u5176\u4e2d\u9664\u4e86TRC\u7684ITR\u4f7f\u7528\u7ea7\u8054\u5b9a\u65f6\u5668\u7684\u65b9\u5f0f\u8fd8\u6709\u901a\u8fc7TIIF_ED&#xff0c;\u4e5f\u5c31\u662f\u901a\u8fc7CH1\u5f15\u811a\u83b7\u5f97\u65f6\u949f&#xff0c;\u8fd9\u79cd\u65b9\u5f0f\u83b7\u5f97\u65f6\u949f\u4e0a\u5347\u6cbf\u548c\u4e0b\u964d\u6cbf\u90fd\u6709\u6548\u3002\u9664\u6b64\u4e4b\u5916TRGI\u9664\u4e86TRC&#xff0c;\u8fd8\u80fd\u901a\u8fc7TI1FP1\u548cTI2FP2\u83b7\u5f97&#xff0c;\u5206\u522b\u8fde\u63a5\u5230IC1\u548cIC2\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005627-6848d43b715ca.jpg\" alt=\"img\" \/><\/p>\n<p>\u5176\u5b9e\u4e3b\u8981\u5c31\u662f\u65f6\u949f\u7684\u6765\u6e90&#xff0c;\u9664\u4e86\u57fa\u672c\u5b9a\u65f6\u5668\u7684\u6765\u81ea\u7cfb\u7edfRCC\u7684\u5185\u90e8\u65f6\u949f&#xff0c;\u8fd8\u80fd\u6709\u5176\u5b83\u65b9\u5f0f&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005628-6848d43c3630f.jpg\" alt=\"img\" \/><\/p>\n<h5>2. \u8f93\u5165\u6355\u83b7\u5355\u5143 (Input Capture Unit)<\/h5>\n<ul>\n<li>\n<p>\u901a\u7528\u5b9a\u65f6\u5668\u652f\u6301\u56db\u8def\u8f93\u5165\u6355\u83b7\u901a\u9053&#xff08;TI1\u3001TI2\u3001TI3\u3001TI4&#xff09;&#xff0c;\u7528\u4e8e\u6355\u83b7\u5916\u90e8\u8f93\u5165\u4fe1\u53f7\u7684\u4e8b\u4ef6&#xff0c;\u4e3b\u8981\u7528\u4e8e\u9891\u7387\u6d4b\u91cf\u3001\u4fe1\u53f7\u5468\u671f\u6216\u5360\u7a7a\u6bd4\u6d4b\u91cf\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u6bcf\u4e2a\u8f93\u5165\u6355\u83b7\u901a\u9053\u5177\u6709\u4ee5\u4e0b\u529f\u80fd\u7ec4\u4ef6&#xff1a;<\/p>\n<\/li>\n<li>\n<ul>\n<li>\u8f93\u5165\u6ee4\u6ce2\u5668&#xff1a;\u5bf9\u8f93\u5165\u4fe1\u53f7\u8fdb\u884c\u53bb\u6296\u548c\u6ee4\u6ce2\u5904\u7406&#xff0c;\u4ee5\u51cf\u5c11\u566a\u58f0\u7684\u5e72\u6270\u3002<\/li>\n<li>\u9884\u5206\u9891\u5668 (ICxPS)&#xff1a;\u53ef\u4ee5\u5c06\u8f93\u5165\u4fe1\u53f7\u5206\u9891\u540e\u518d\u6355\u83b7&#xff0c;\u4ee5\u652f\u6301\u4e0d\u540c\u9891\u7387\u4fe1\u53f7\u7684\u6d4b\u91cf\u3002<\/li>\n<li>\u6355\u83b7\u6bd4\u8f83\u5bc4\u5b58\u5668 (CCRx)&#xff1a;\u5f53\u53d1\u751f\u8f93\u5165\u4e8b\u4ef6\u65f6&#xff0c;\u6355\u83b7\u5f53\u524d\u7684 CNT \u503c\u5e76\u5b58\u50a8\u5728\u5bf9\u5e94\u7684 CCR \u5bc4\u5b58\u5668\u4e2d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>3. \u8f93\u51fa\u6bd4\u8f83\u5355\u5143 (Output Compare Unit)<\/h5>\n<ul>\n<li>\n<p>\u901a\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u652f\u6301\u56db\u4e2a\u8f93\u51fa\u901a\u9053&#xff08;OC1\u3001OC2\u3001OC3\u3001OC4&#xff09;&#xff0c;\u7528\u4e8e\u6bd4\u8f83 CNT \u8ba1\u6570\u5668\u548c\u9884\u8bbe\u7684\u6bd4\u8f83\u503c (CCRx)&#xff0c;\u4e3b\u8981\u7528\u4e8e\u4ea7\u751f PWM \u4fe1\u53f7\u3001\u8f93\u51fa\u5b9a\u65f6\u4e8b\u4ef6\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u901a\u8fc7\u6bd4\u8f83 CNT \u8ba1\u6570\u5668\u548c\u6307\u5b9a\u7684\u6bd4\u8f83\u503c (CCRx) \u6765\u63a7\u5236\u8f93\u51fa\u884c\u4e3a&#xff0c;\u652f\u6301\u591a\u79cd\u6a21\u5f0f&#xff1a;<\/p>\n<\/li>\n<li>\n<ul>\n<li>PWM \u6a21\u5f0f&#xff1a;\u901a\u8fc7\u8bbe\u7f6e\u6bd4\u8f83\u503c\u5b9e\u73b0 PWM \u8f93\u51fa&#xff0c;\u7528\u4e8e\u8c03\u8282\u8f93\u51fa\u4fe1\u53f7\u7684\u5360\u7a7a\u6bd4\u3002<\/li>\n<li>\u5b9a\u65f6\u6a21\u5f0f&#xff1a;\u5728\u8ba1\u6570\u5668\u503c\u7b49\u4e8e\u6bd4\u8f83\u503c\u65f6\u751f\u6210\u8f93\u51fa\u4e8b\u4ef6&#xff0c;\u9002\u5408\u7528\u4e8e\u5b9a\u65f6\u63a7\u5236\u3002<\/li>\n<li>\u5355\u8109\u51b2\u6a21\u5f0f&#xff1a;\u4ea7\u751f\u5355\u4e2a\u8109\u51b2\u4fe1\u53f7&#xff0c;\u53ef\u4ee5\u7528\u4e8e\u63a7\u5236\u5355\u4e00\u4e8b\u4ef6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>4. CNT \u8ba1\u6570\u5668<\/h5>\n<ul>\n<li>\n<p>\u8fd9\u662f\u6574\u4e2a\u5b9a\u65f6\u5668\u7684\u6838\u5fc3\u90e8\u4ef6&#xff0c;\u8d1f\u8d23\u8bb0\u5f55\u65f6\u949f\u7684\u8ba1\u6570\u503c\u3002\u8ba1\u6570\u5668\u6709\u591a\u79cd\u8ba1\u6570\u6a21\u5f0f&#xff1a;<\/p>\n<\/li>\n<li>\n<ul>\n<li>\u5411\u4e0a\u8ba1\u6570\u6a21\u5f0f&#xff1a;\u8ba1\u6570\u5668\u503c\u4ece 0 \u589e\u52a0\u5230\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668 (ARR) \u7684\u503c&#xff0c;\u7136\u540e\u751f\u6210\u66f4\u65b0\u4e8b\u4ef6 (U) \u6216\u4e2d\u65ad (UI)&#xff0c;\u5e76\u6e05\u96f6\u91cd\u65b0\u8ba1\u6570\u3002<\/li>\n<li>\u5411\u4e0b\u8ba1\u6570\u6a21\u5f0f&#xff1a;\u8ba1\u6570\u5668\u503c\u4ece ARR \u7684\u503c\u51cf\u5c11\u5230 0&#xff0c;\u4ea7\u751f\u66f4\u65b0\u4e8b\u4ef6\u6216\u4e2d\u65ad&#xff0c;\u7136\u540e\u91cd\u65b0\u4ece ARR \u5f00\u59cb\u8ba1\u6570\u3002<\/li>\n<li>\u4e2d\u5fc3\u5bf9\u9f50\u8ba1\u6570\u6a21\u5f0f&#xff1a;\u8ba1\u6570\u5668\u503c\u4ece 0 \u589e\u52a0\u5230 ARR&#xff0c;\u7136\u540e\u53cd\u5411\u51cf\u5c11\u5230 0&#xff0c;\u5728\u4e0a\u5347\u6cbf\u548c\u4e0b\u964d\u6cbf\u5206\u522b\u751f\u6210\u4e2d\u65ad\u6216\u66f4\u65b0\u4e8b\u4ef6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>5. \u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668 (ARR)<\/h5>\n<ul>\n<li>ARR \u5b58\u50a8\u76ee\u6807\u8ba1\u6570\u503c&#xff0c;\u5373\u8ba1\u6570\u5668\u8fbe\u5230\u8be5\u503c\u65f6\u4f1a\u89e6\u53d1\u66f4\u65b0\u4e8b\u4ef6\u3002ARR \u7684\u914d\u7f6e\u503c\u51b3\u5b9a\u4e86\u8ba1\u6570\u5668\u7684\u8ba1\u6570\u5468\u671f&#xff0c;\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6e\u5b9a\u65f6\u5668\u7684\u5468\u671f\u3002<\/li>\n<\/ul>\n<h5>6. \u9884\u5206\u9891\u5668 (PSC)<\/h5>\n<ul>\n<li>\u9884\u5206\u9891\u5668\u7528\u4e8e\u5206\u914d\u57fa\u51c6\u8ba1\u6570\u65f6\u949f (CK_PSC)&#xff0c;\u5c06\u8f93\u5165\u7684\u65f6\u949f\u9891\u7387\u964d\u4f4e\u5230\u5408\u9002\u7684\u8ba1\u6570\u9891\u7387\u3002\u6bd4\u5982\u8f93\u5165\u65f6\u949f\u4e3a 72MHz&#xff0c;\u9884\u5206\u9891\u5668\u8bbe\u7f6e\u4e3a 1 \u65f6&#xff0c;\u5206\u9891\u4e3a 72MHz&#xff1b;\u82e5\u8bbe\u7f6e\u4e3a 71&#xff0c;\u5219\u5206\u9891\u4e3a 72\/72 &#061; 1MHz\u3002\u9884\u5206\u9891\u5668\u6700\u5927\u652f\u6301 16 \u4f4d\u8bbe\u7f6e\u3002<\/li>\n<\/ul>\n<h5>7. \u4e2d\u65ad\u4e0e DMA \u4e8b\u4ef6<\/h5>\n<ul>\n<li>\u901a\u7528\u5b9a\u65f6\u5668\u53ef\u4ee5\u5728\u4e00\u4e9b\u4e8b\u4ef6\u53d1\u751f\u65f6&#xff08;\u4f8b\u5982\u8ba1\u6570\u5668\u8fbe\u5230 ARR \u503c&#xff0c;\u6216\u8f93\u5165\u6355\u83b7\u53d1\u751f\u65f6&#xff09;\u89e6\u53d1\u4e2d\u65ad\u4fe1\u53f7 UI \u548c\u66f4\u65b0\u4e8b\u4ef6 U&#xff0c;\u7528\u4e8e\u901a\u77e5 CPU \u6216\u5176\u4ed6\u6a21\u5757\u8fdb\u884c\u5904\u7406\u3002<\/li>\n<li>\u4e5f\u652f\u6301 DMA \u4f20\u8f93&#xff0c;\u5728\u6355\u83b7\u4e8b\u4ef6\u89e6\u53d1\u65f6\u53ef\u4ee5\u5c06\u6570\u636e\u81ea\u52a8\u4f20\u8f93\u5230\u5185\u5b58&#xff0c;\u51cf\u5c11 CPU \u5e72\u9884\u3002<\/li>\n<\/ul>\n<h5>8. \u5239\u8f66\u529f\u80fd (Break Input, BRK)<\/h5>\n<ul>\n<li>\u5239\u8f66\u529f\u80fd\u53ef\u4ee5\u901a\u8fc7 BRK \u5f15\u811a\u76f4\u63a5\u89e6\u53d1&#xff0c;\u7528\u4e8e\u7d27\u6025\u505c\u6b62\u8f93\u51fa\u3002\u5e38\u7528\u4e8e\u7535\u673a\u63a7\u5236\u573a\u666f&#xff0c;\u68c0\u6d4b\u5230\u8fc7\u6d41\u6216\u6545\u969c\u65f6\u53ef\u4ee5\u8fc5\u901f\u505c\u673a&#xff0c;\u4fdd\u62a4\u7535\u8def\u548c\u8bbe\u5907\u3002<\/li>\n<\/ul>\n<h4>1.2.3 \u9ad8\u7ea7\u5b9a\u65f6\u5668<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005628-6848d43cef763.jpg\" alt=\"img\" \/><\/p>\n<p>\u9ad8\u7ea7\u5b9a\u65f6\u5668\u5728\u529f\u80fd\u4e0a\u76f8\u8f83\u4e8e\u901a\u7528\u5b9a\u65f6\u5668\u66f4\u4e3a\u590d\u6742&#xff0c;\u4e3b\u8981\u7528\u4e8e\u7535\u673a\u63a7\u5236\u7b49\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002\u4ee5\u4e0b\u662f\u9ad8\u7ea7\u5b9a\u65f6\u5668\u7684\u8be6\u7ec6\u7ed3\u6784\u529f\u80fd\u89e3\u6790&#xff1a;<\/p>\n<h5>1. \u89e6\u53d1\u63a7\u5236\u5355\u5143 (Trigger Control Unit)<\/h5>\n<ul>\n<li>\u8be5\u5355\u5143\u7c7b\u4f3c\u4e8e\u901a\u7528\u5b9a\u65f6\u5668\u7684\u89e6\u53d1\u63a7\u5236\u5355\u5143&#xff0c;\u4f46\u529f\u80fd\u66f4\u4e3a\u4e30\u5bcc&#xff0c;\u652f\u6301\u591a\u79cd\u89e6\u53d1\u4fe1\u53f7\u548c\u89e6\u53d1\u6a21\u5f0f\u3002<\/li>\n<li>\u5185\u90e8\u89e6\u53d1 (ITR0 &#8211; ITR3)&#xff1a;\u53ef\u4ee5\u63a5\u6536\u5176\u4ed6\u5b9a\u65f6\u5668\u7684\u89e6\u53d1\u4fe1\u53f7&#xff0c;\u7528\u4e8e\u5b9e\u73b0\u5b9a\u65f6\u5668\u7684\u4e3b\u4ece\u6a21\u5f0f\u540c\u6b65\u3002<\/li>\n<li>\u5916\u90e8\u89e6\u53d1 (ETR)&#xff1a;\u6765\u81ea\u5916\u90e8\u5f15\u811a\u7684\u89e6\u53d1\u4fe1\u53f7&#xff0c;\u7ecf\u8fc7\u6781\u6027\u8bbe\u7f6e\u548c\u6ee4\u6ce2\u540e\u8f93\u51fa\u5230\u590d\u4f4d\u6216\u4ece\u6a21\u5f0f\u63a7\u5236\u3002<\/li>\n<li>ETRF \u4fe1\u53f7&#xff1a;\u7ecf\u8fc7\u6ee4\u6ce2\u7684 ETR \u4fe1\u53f7\u7528\u4e8e\u63a7\u5236\u8ba1\u6570\u7684\u590d\u4f4d\u3001\u4f7f\u80fd\u7b49\u3002<\/li>\n<li>TRGI\/ TRGO \u4fe1\u53f7&#xff1a;\u7528\u4e8e\u4e0e\u5176\u4ed6\u5916\u90e8\u6a21\u5757&#xff08;\u5982 ADC\u3001DAC \u7b49&#xff09;\u8fdb\u884c\u540c\u6b65\u3002<\/li>\n<\/ul>\n<h5>2. \u65f6\u57fa\u5355\u5143 (Counter and ARR)<\/h5>\n<ul>\n<li>\u9884\u5206\u9891\u5668 (PSC)&#xff1a;\u63a7\u5236\u65f6\u57fa\u5355\u5143\u7684\u8f93\u5165\u65f6\u949f&#xff0c;\u8fdb\u884c\u5206\u9891\u4ee5\u964d\u4f4e\u65f6\u949f\u9891\u7387\u3002<\/li>\n<li>CNT \u8ba1\u6570\u5668&#xff1a;\u9ad8\u7ea7\u5b9a\u65f6\u5668\u652f\u6301\u591a\u79cd\u8ba1\u6570\u6a21\u5f0f&#xff0c;\u9664\u4e86\u5411\u4e0a\u3001\u5411\u4e0b\u8ba1\u6570&#xff0c;\u8fd8\u652f\u6301\u4e2d\u5fc3\u5bf9\u9f50\u6a21\u5f0f&#xff0c;\u7528\u4e8e\u4ea7\u751f\u5bf9\u79f0\u7684 PWM \u4fe1\u53f7\u3002\u4e2d\u5fc3\u5bf9\u9f50\u6a21\u5f0f\u4f1a\u4f7f CNT \u8ba1\u6570\u5668\u5728\u5230\u8fbe\u81ea\u52a8\u91cd\u88c5\u8f7d\u503c (ARR) \u540e\u53cd\u5411\u8ba1\u6570\u3002<\/li>\n<li>\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668 (ARR)&#xff1a;\u5b58\u50a8\u8ba1\u6570\u5668\u7684\u6700\u5927\u8ba1\u6570\u503c&#xff0c;\u5230\u8fbe\u8be5\u503c\u65f6\u4ea7\u751f\u66f4\u65b0\u4e8b\u4ef6\u6216\u4e2d\u65ad&#xff0c;\u7528\u4e8e\u63a7\u5236 PWM \u5468\u671f\u3002<\/li>\n<\/ul>\n<h5>3. \u8f93\u5165\u6355\u83b7\u5355\u5143 (Input Capture Unit)<\/h5>\n<ul>\n<li>\u9ad8\u7ea7\u5b9a\u65f6\u5668\u652f\u6301\u56db\u4e2a\u8f93\u5165\u901a\u9053 (TI1-TI4)&#xff0c;\u6bcf\u4e2a\u901a\u9053\u53ef\u4ee5\u72ec\u7acb\u6355\u83b7\u5916\u90e8\u8f93\u5165\u4fe1\u53f7\u3002<\/li>\n<li>\u6bcf\u4e2a\u8f93\u5165\u901a\u9053\u914d\u6709\u8f93\u5165\u6ee4\u6ce2\u5668\u3001\u6781\u6027\u63a7\u5236\u548c\u5206\u9891\u5668&#xff0c;\u7528\u4e8e\u6355\u83b7\u5916\u90e8\u4e8b\u4ef6&#xff0c;\u4e3b\u8981\u7528\u4e8e\u6d4b\u91cf\u4fe1\u53f7\u7684\u9891\u7387\u3001\u5468\u671f\u6216\u5360\u7a7a\u6bd4\u3002<\/li>\n<li>\u8f93\u5165\u6355\u83b7\u7ed3\u679c\u5b58\u50a8\u5728\u6355\u83b7\/\u6bd4\u8f83\u5bc4\u5b58\u5668 (CCRx) \u4e2d&#xff0c;\u4f9b\u540e\u7eed\u8ba1\u7b97\u548c\u5904\u7406\u3002<\/li>\n<\/ul>\n<h5>4. \u8f93\u51fa\u6bd4\u8f83\u5355\u5143 (Output Compare Unit)<\/h5>\n<ul>\n<li>\n<p>\u9ad8\u7ea7\u5b9a\u65f6\u5668\u652f\u6301\u56db\u8def\u8f93\u51fa\u6bd4\u8f83\u5355\u5143&#xff0c;\u7528\u4e8e PWM \u4fe1\u53f7\u751f\u6210\u548c\u5b9a\u65f6\u8f93\u51fa\u3002<\/p>\n<\/li>\n<li>\n<p>\u6bcf\u4e2a\u8f93\u51fa\u6bd4\u8f83\u901a\u9053\u914d\u6709\u6bd4\u8f83\u5bc4\u5b58\u5668 (CCRx) \u548c\u6bd4\u8f83\u6a21\u5f0f\u914d\u7f6e&#xff0c;\u53ef\u4ee5\u751f\u6210\u591a\u79cd PWM \u4fe1\u53f7&#xff1a;<\/p>\n<\/li>\n<li>\n<ul>\n<li>PWM \u6a21\u5f0f 1\/\u6a21\u5f0f 2&#xff1a;\u8bbe\u7f6e\u5360\u7a7a\u6bd4&#xff0c;\u652f\u6301\u9ad8\u7cbe\u5ea6\u7684 PWM \u4fe1\u53f7\u8f93\u51fa\u3002<\/li>\n<li>\u5f3a\u5236\u8f93\u51fa\u6a21\u5f0f&#xff1a;\u53ef\u5f3a\u5236\u6539\u53d8\u8f93\u51fa\u72b6\u6001&#xff0c;\u9002\u7528\u4e8e\u9700\u8981\u7279\u6b8a\u4fe1\u53f7\u63a7\u5236\u7684\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u8fd8\u914d\u5907\u6b7b\u533a\u63a7\u5236\u5668 (DTG)&#xff0c;\u7528\u4e8e\u5728\u53cc\u5411\u63a7\u5236\u573a\u666f\u4e0b\u6dfb\u52a0\u6b7b\u533a\u65f6\u95f4&#xff0c;\u4ee5\u907f\u514d\u4e0a\u4e0b\u6865\u9a71\u52a8\u5668\u7684\u77ed\u8def\u3002<\/p>\n<\/li>\n<\/ul>\n<h5>5. \u5239\u8f66\u8f93\u5165\u5355\u5143 (Break Input)<\/h5>\n<ul>\n<li>\u5239\u8f66\u8f93\u5165 (BRK) \u662f\u9ad8\u7ea7\u5b9a\u65f6\u5668\u7684\u4e00\u9879\u91cd\u8981\u529f\u80fd&#xff0c;\u7528\u4e8e\u7d27\u6025\u505c\u6b62\u3002\u901a\u5e38\u7528\u4e8e\u7535\u673a\u63a7\u5236&#xff0c;\u907f\u514d\u56e0\u6545\u969c\u6216\u8fc7\u6d41\u5bfc\u81f4\u7684\u635f\u574f\u3002<\/li>\n<li>BI \u4fe1\u53f7&#xff1a;\u5f53\u68c0\u6d4b\u5230 BRK \u5f15\u811a\u4fe1\u53f7\u65f6&#xff0c;\u8f93\u51fa\u7acb\u5373\u88ab\u5173\u95ed\u6216\u8fdb\u5165\u5b89\u5168\u72b6\u6001\u3002<\/li>\n<li>\u5239\u8f66\u8f93\u5165\u529f\u80fd\u53ef\u914d\u7f6e\u89e6\u53d1\u7ea7\u522b&#xff0c;\u5982\u6709\u6548\u7535\u5e73\u3001\u54cd\u5e94\u65f6\u95f4\u7b49\u3002<\/li>\n<\/ul>\n<h5>6. \u6b7b\u533a\u65f6\u95f4\u63a7\u5236\u5355\u5143 (Dead-Time Generator, DTG)<\/h5>\n<ul>\n<li>DTG \u5355\u5143\u7528\u4e8e\u5728\u6865\u5f0f\u63a7\u5236\u573a\u666f\u4e0b\u751f\u6210\u6b7b\u533a\u65f6\u95f4\u3002\u6b7b\u533a\u65f6\u95f4\u662f\u4e0a\u4e0b\u6865\u81c2\u4e4b\u95f4\u7684\u5b89\u5168\u95f4\u9694\u65f6\u95f4&#xff0c;\u9632\u6b62\u4e24\u4e2a\u6865\u81c2\u540c\u65f6\u5bfc\u901a\u5bfc\u81f4\u77ed\u8def\u3002<\/li>\n<li>DTG \u7684\u8bbe\u7f6e\u51b3\u5b9a\u4e86 PWM \u8f93\u51fa\u4fe1\u53f7\u7684\u4e0a\u5347\u6cbf\u548c\u4e0b\u964d\u6cbf\u4e4b\u95f4\u7684\u5ef6\u8fdf\u65f6\u95f4\u3002<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7\u7f16\u7a0b\u8c03\u6574\u6b7b\u533a\u65f6\u95f4&#xff0c;\u4ee5\u9002\u5e94\u4e0d\u540c\u529f\u7387\u7535\u8def\u7684\u9700\u6c42\u3002<\/li>\n<\/ul>\n<h5>7. \u4e3b\u4ece\u6a21\u5f0f\u63a7\u5236 (Master-Slave Mode Control)<\/h5>\n<ul>\n<li>\u9ad8\u7ea7\u5b9a\u65f6\u5668\u652f\u6301\u4e3b\u4ece\u6a21\u5f0f\u63a7\u5236&#xff0c;\u7528\u4e8e\u591a\u5b9a\u65f6\u5668\u540c\u6b65\u3002<\/li>\n<li>\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u5b9a\u65f6\u5668\u4f5c\u4e3a\u4e3b\u5b9a\u65f6\u5668&#xff0c;\u5176\u4ea7\u751f\u7684\u4fe1\u53f7&#xff08;\u5982 TRGO&#xff09;\u53ef\u4ee5\u4f5c\u4e3a\u5176\u4ed6\u4ece\u5b9a\u65f6\u5668\u7684\u89e6\u53d1\u6e90&#xff0c;\u5b9e\u73b0\u591a\u5b9a\u65f6\u5668\u4e4b\u95f4\u7684\u540c\u6b65\u63a7\u5236\u3002<\/li>\n<li>\u5e38\u7528\u4e8e\u591a\u901a\u9053 PWM \u4fe1\u53f7\u540c\u6b65\u6216\u7535\u673a\u63a7\u5236\u5e94\u7528\u4e2d&#xff0c;\u4ee5\u5b9e\u73b0\u590d\u6742\u7684\u63a7\u5236\u903b\u8f91\u3002<\/li>\n<\/ul>\n<h5>8. \u4e8b\u4ef6\u751f\u6210\u4e0e\u4e2d\u65ad<\/h5>\n<ul>\n<li>\u9ad8\u7ea7\u5b9a\u65f6\u5668\u53ef\u4ee5\u5728\u591a\u79cd\u4e8b\u4ef6&#xff08;\u5982\u8ba1\u6570\u6ea2\u51fa\u3001\u6355\u83b7\u4e8b\u4ef6\u3001\u6bd4\u8f83\u5339\u914d\u7b49&#xff09;\u53d1\u751f\u65f6\u4ea7\u751f\u4e2d\u65ad&#xff0c;\u4f9b CPU \u6216 DMA \u8fdb\u884c\u76f8\u5e94\u5904\u7406\u3002<\/li>\n<li>\u66f4\u65b0\u4e8b\u4ef6 (U)&#xff1a;\u8ba1\u6570\u5668\u6ea2\u51fa\u65f6\u4ea7\u751f\u7684\u4e8b\u4ef6\u3002<\/li>\n<li>\u6bd4\u8f83\u4e2d\u65ad&#xff1a;\u5f53 CNT \u8ba1\u6570\u503c\u4e0e\u6bd4\u8f83\u5bc4\u5b58\u5668\u5339\u914d\u65f6\u89e6\u53d1&#xff0c;\u7528\u4e8e\u5b9a\u65f6\u8f93\u51fa\u3002<\/li>\n<li>\u8fd9\u4e9b\u4e8b\u4ef6\u53ef\u4ee5\u72ec\u7acb\u914d\u7f6e&#xff0c;\u4f7f\u9ad8\u7ea7\u5b9a\u65f6\u5668\u5177\u5907\u66f4\u7075\u6d3b\u7684\u63a7\u5236\u65b9\u5f0f\u3002<\/li>\n<\/ul>\n<h5>9.\u91cd\u590d\u8ba1\u6570\u5668 (Repetition Counter, REP)<\/h5>\n<ul>\n<li>\u5728\u4e00\u4e9b\u5b9a\u65f6\u5668&#xff08;\u5982\u9ad8\u7ea7\u5b9a\u65f6\u5668&#xff09;\u4e2d&#xff0c;\u652f\u6301\u91cd\u590d\u8ba1\u6570\u529f\u80fd&#xff0c;\u53ef\u4ee5\u8bbe\u5b9a\u4e00\u4e2a\u91cd\u590d\u8ba1\u6570\u503c&#xff0c;\u7ecf\u8fc7\u8bbe\u5b9a\u6b21\u6570\u7684\u66f4\u65b0\u4e8b\u4ef6\u540e\u624d\u89e6\u53d1\u4e00\u6b21\u8f93\u51fa&#xff0c;\u8fd9\u5728\u7535\u673a\u63a7\u5236\u4e2d\u8f83\u4e3a\u5e38\u89c1\u3002<\/li>\n<\/ul>\n<p>\u76f8\u6bd4\u901a\u7528\u5b9a\u65f6\u5668&#xff0c;\u4e3b\u8981\u5c31\u662f\u591a\u4e86\u6b7b\u533a\u65f6\u95f4\u63a7\u5236\u5355\u5143 (Dead-Time Generator, DTG)\u3001\u5239\u8f66\u8f93\u5165\u5355\u5143 (Break Input)\u3001\u91cd\u590d\u8ba1\u6570\u5668 (Repetition Counter, REP)\u3002<\/p>\n<h3>1.3 \u5b9a\u65f6\u4e2d\u65ad\u57fa\u672c\u7ed3\u6784\u56fe<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005629-6848d43db321f.jpg\" alt=\"img\" \/><\/p>\n<p>\u770b\u4e86\u4e0a\u9762\u7684\u4ecb\u7ecd\u4e0b\u540e\u518d\u6765\u770b\u8fd9\u4e2a\u57fa\u672c\u7ed3\u6784\u4f53&#xff0c;\u5176\u5b9e\u4e00\u76ee\u4e86\u7136\u4e86\u3002\u5c31\u662f\u5bf9\u4e8e\u901a\u7528\u5b9a\u65f6\u5668\u6765\u8bf4&#xff0c;\u65f6\u949f\u53ef\u4ee5\u6709\u591a\u79cd\u6765\u6e90&#xff0c;<\/p>\n<h3>1.4 \u65f6\u5e8f<\/h3>\n<h4>1.4.1 PSC\u9884\u5206\u9891\u5668<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005630-6848d43e3596c.png\" alt=\"img\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005630-6848d43e58c0f.jpg\" alt=\"img\" \/><\/p>\n<p>\u8ba1\u6570\u5668\u8ba1\u6570\u9891\u7387&#xff1a;CK_CNT &#061; CK_PSC \/ (PSC &#043; 1)<\/p>\n<ul>\n<li>\n<p>CK_PSC&#xff1a;\u8f93\u5165\u7684\u672a\u5206\u9891\u7684\u8ba1\u6570\u65f6\u949f\u3002<\/p>\n<\/li>\n<li>\n<p>CNT_EN&#xff1a;\u8ba1\u65f6\u5668\u4f7f\u80fd&#xff0c;\u9ad8\u7535\u5e73\u6b63\u5e38\u8fd0\u884c&#xff0c;\u4f4e\u7535\u5e73\u505c\u6b62\u8fd0\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>CK_CNT&#xff1a;\u5206\u9891\u540e\u7684\u8ba1\u6570\u65f6\u949f&#xff0c;\u56fe\u4e2d\u4ee5\u7ea2\u865a\u7ebf\u53ef\u4ee5\u770b\u51fa\u5206\u4e3a\u4e86\u4e24\u4e2a\u9891\u7387&#xff0c;\u524d\u534a\u548c\u672a\u5206\u9891\u7684\u65f6\u949f\u9891\u7387\u4e00\u6837&#xff0c;\u4e5f\u5c31\u662fPSC&#061;1&#xff1b;\u540e\u534a\u6bb5\u5219\u4ea7\u751f\u7684\u5206\u9891&#xff0c;PSC\u662f2&#xff0c;CK_CNT &#061; CK_PSC \/ (2 &#043; 1) &#061; CK_PSC \/ 3<\/p>\n<\/li>\n<li>\n<p>\u8ba1\u6570\u5668\u5bc4\u5b58\u5668&#xff1a;\u987e\u540d\u601d\u4e49&#xff0c;\u8fdb\u884c\u8ba1\u6570\u7684&#xff0c;\u5f53\u8ba1\u6570\u8fbe\u5230\u76ee\u6807\u503c\u5c31\u4ea7\u751f\u4e2d\u65ad\u3002\u8ba1\u6570\u7684\u9891\u7387\u548c\u5206\u9891\u540e\u7684\u65f6\u949f\u9891\u7387\u662f\u6b63\u6bd4\u7684\u3002\u53ef\u4ee5\u770b\u51fa\u7ea2\u7ebf\u5de6\u8fb9\u7684\u81ea\u52a8\u91cd\u88c5\u503c\u5c31\u662fFC&#xff0c;\u8ba1\u6570\u8fbe\u5230\u540e\u6e050&#xff0c;FC &#8211;&gt; 00<\/p>\n<\/li>\n<li>\n<ul>\n<li>CNT \u5bc4\u5b58\u5668\u7528\u4e8e\u4fdd\u5b58\u8ba1\u6570\u503c&#xff0c;\u6bcf\u5f53 CK_CNT \u4e0a\u5347\u6cbf\u5230\u6765\u65f6&#xff0c;CNT \u52a0\u4e00\u3002<\/li>\n<li>\u5f53 CNT \u8fbe\u5230\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668 (ARR) \u7684\u503c\u65f6&#xff0c;\u4f1a\u89e6\u53d1\u4e2d\u65ad&#xff0c;\u5e76\u5c06 CNT \u6e05\u96f6&#xff0c;\u91cd\u65b0\u5f00\u59cb\u8ba1\u6570\u3002<\/li>\n<li>CNT \u7684\u8ba1\u6570\u9891\u7387\u4e0e CK_CNT \u662f\u6b63\u6bd4\u7684&#xff0c;\u5206\u9891\u540e\u7684\u65f6\u949f\u9891\u7387\u51b3\u5b9a\u4e86 CNT \u7684\u66f4\u65b0\u901f\u5ea6\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u66f4\u65b0\u4e8b\u4ef6&#xff08;UEV&#xff09;&#xff1a;\u8ba1\u65f6\u5668\u8ba1\u6570\u8fbe\u5230\u91cd\u88c5\u503c\u4e86&#xff0c;\u540c\u65f6\u4e0b\u4e00\u4e2a\u65f6\u949f\u6765\u4e86&#xff0c;\u5206\u9891\u540e\u8fdb\u5165\u5230CNT\u8ba1\u6570\u5668&#xff0c;\u4ea7\u751f\u4e00\u4e2a\u66f4\u65b0\u4e8b\u4ef6&#xff08;\u56fe\u4e2d\u552f\u4e00\u4e00\u4e2a\u9ad8\u7535\u5e73&#xff09;&#xff0c;\u5f00\u59cb\u65b0\u7684\u8ba1\u65f6\u3002<\/p>\n<\/li>\n<li>\n<ul>\n<li>\u66f4\u65b0\u4e8b\u4ef6&#xff08;UEV&#xff09;\u662f\u5728 CNT \u5230\u8fbe\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668\u503c\u5e76\u6e05\u96f6\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6\u3002<\/li>\n<li>UEV \u901a\u5e38\u7528\u4e8e\u540c\u6b65\u5176\u4ed6\u6a21\u5757\u6216\u8005\u4ea7\u751f\u4e2d\u65ad&#xff0c;\u544a\u77e5\u5916\u90e8\u7cfb\u7edf\u8ba1\u65f6\u5468\u671f\u5df2\u7ecf\u5b8c\u6210\u3002<\/li>\n<li>\u63d0\u5230\u7684\u56fe\u4e2d\u552f\u4e00\u7684\u9ad8\u7535\u5e73&#xff08;\u9ad8\u7535\u5e73\u4ee3\u8868\u89e6\u53d1\u66f4\u65b0\u4e8b\u4ef6&#xff09;\u7b26\u5408\u63cf\u8ff0\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9884\u5206\u9891\u63a7\u5236\u5bc4\u5b58\u5668&#xff08; PSC Register) &#xff09;&#xff1a;\u4f9b\u6211\u4eec\u8bfb\u5199\u7528\u7684\u3002\u6bd4\u5982\u5c060\u6539\u6210\u4e861&#xff0c;\u90a3\u4e48\u5728\u65f6\u949f\u5468\u671f\u7ed3\u675f\u540e&#xff0c;\u9884\u5206\u914d\u7f13\u51b2\u5668\u4e5f\u4f1a\u4ece0\u2013&gt;1&#xff0c;\u6b64\u65f6\u9884\u5206\u9891\u7387\u8ba1\u6570\u5668\u5c31\u4f1a\u6309\u71670\u30011\u30010\u30011\u6765\u8f93\u51fa&#xff0c;\u4e00\u4e2a0\u30011\u5c31\u5bf9\u5e94\u5230\u4e00\u4e2a\u5206\u9891\u5668\u8f93\u51fa\u7684CK_CNT&#xff0c;\u4e5f\u5c31\u662f\u5bf9\u5e94\u5230\u4e00\u4e2a\u8ba1\u6570\u3002\u52301 CK_CNT\u5c31\u8f93\u51fa\u9ad8\u7535\u5e73\u3002<\/p>\n<\/li>\n<li>\n<ul>\n<li>PSC \u662f\u4e00\u4e2a\u53ef\u4ee5\u8bfb\u5199\u7684\u63a7\u5236\u5bc4\u5b58\u5668&#xff0c;\u7528\u4e8e\u8bbe\u7f6e\u5206\u9891\u7cfb\u6570 PSC &#043; 1\u3002<\/li>\n<li>\u4fee\u6539 PSC \u503c\u4f1a\u6539\u53d8 CK_CNT \u7684\u9891\u7387\u3002\u5728\u4e0b\u4e00\u4e2a\u8ba1\u65f6\u5468\u671f\u5f00\u59cb\u65f6&#xff0c;\u65b0\u503c\u4f1a\u52a0\u8f7d\u5230\u9884\u5206\u9891\u7f13\u51b2\u5668&#xff0c;\u786e\u4fdd\u5206\u9891\u53d8\u66f4\u751f\u6548\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9884\u5206\u9891\u7f13\u51b2\u5668&#xff1a;\u771f\u6b63\u8d77\u4f5c\u7528\u7684\u5bc4\u5b58\u5668&#xff0c;\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u5bc4\u5b58\u5668&#xff0c;\u6211\u4eec\u5728\u67d0\u4e2a\u65f6\u95f4\u5185\u5bf9\u9884\u5206\u9891\u63a7\u5236\u5bc4\u5b58\u5668\u5bc4\u5b58\u5668\u8fdb\u884c\u5199\u5165&#xff0c;\u628a0\u6539\u62101&#xff0c;\u6b64\u65f6\u8fd8\u5728\u8fdb\u884c\u7740\u4e00\u4e2a\u5468\u671f\u7684\u65f6\u949f&#xff0c;\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u8be5\u5468\u671f\u7684\u65f6\u949f\u7684\u524d\u534a\u90e8\u5206\u548c\u540e\u534a\u90e8\u5206\u9891\u7387\u4e0d\u4e00\u6837\u4e86&#xff0c;\u8fd9\u6837\u662f\u4e0d\u884c\u7684\u3002\u56e0\u6b64\u5c31\u6709\u4e86\u9884\u5206\u9891\u7f13\u51b2\u5668&#xff0c;\u5373\u4f7f\u6211\u4eec\u5bf9\u67d0\u4e00\u4e2a\u6b63\u5728\u8fdb\u884c\u7684\u65f6\u949f\u5468\u671f\u5185\u5bf9\u9884\u5206\u9891\u63a7\u5236\u5bc4\u5b58\u5668\u5bc4\u5b58\u5668\u6539\u53d8\u4e86\u503c&#xff0c;\u4e5f\u4f1a\u7b49\u5230\u8be5\u5468\u671f\u7ed3\u675f\u4e86&#xff0c;\u624d\u5bf9\u9884\u5206\u9891\u7f13\u51b2\u5668\u7684\u503c\u8fdb\u884c\u66f4\u6539&#xff0c;\u4ea7\u751f\u65b0\u7684\u4e8b\u4ef6&#xff0c;\u5f00\u59cb\u65b0\u7684\u65f6\u949f\u5468\u671f\u3002<\/p>\n<\/li>\n<li>\n<ul>\n<li>\u9884\u5206\u9891\u7f13\u51b2\u5668\u5728\u67d0\u4e2a\u5468\u671f\u7ed3\u675f\u540e\u66f4\u65b0\u4e3a\u65b0\u503c&#xff0c;\u907f\u514d\u5728\u8ba1\u6570\u5468\u671f\u4e2d\u9014\u4fee\u6539 PSC \u5bfc\u81f4\u5206\u9891\u4e0d\u4e00\u81f4\u3002<\/li>\n<li>\u5f53\u4fee\u6539 PSC \u503c\u65f6&#xff0c;\u65b0\u503c\u4f1a\u5148\u5b58\u50a8\u5728\u63a7\u5236\u5bc4\u5b58\u5668\u4e2d&#xff0c;\u5f53\u524d\u8ba1\u6570\u5468\u671f\u7ee7\u7eed\u4f7f\u7528\u65e7\u503c\u3002<\/li>\n<li>\u5f53\u5f53\u524d\u5468\u671f\u7ed3\u675f\u65f6&#xff0c;\u9884\u5206\u9891\u7f13\u51b2\u5668\u4f1a\u540c\u6b65\u66f4\u65b0\u4e3a\u65b0\u7684 PSC \u503c&#xff0c;\u5e76\u5728\u4e0b\u4e00\u8ba1\u6570\u5468\u671f\u751f\u6548\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65f6\u949f\u9891\u7387\u7684\u8fde\u7eed\u6027\u548c\u7a33\u5b9a\u6027&#xff0c;\u4e0d\u4f1a\u56e0\u4e3a\u4fee\u6539 PSC \u800c\u5f15\u8d77\u4e0d\u5fc5\u8981\u7684\u9891\u7387\u6ce2\u52a8\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>1.4.2 \u8ba1\u65f6\u5668\u65f6\u5e8f<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005631-6848d43f08ce7.jpg\" alt=\"img\" \/><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005631-6848d43f7104e.jpg\" alt=\"img\" \/><\/p>\n<p>\u8ba1\u6570\u5668\u6ea2\u51fa\u9891\u7387&#xff1a;CK_CNT_OV &#061; CK_CNT \/ (ARR &#043; 1) &#061; CK_PSC \/ (PSC &#043; 1) \/ (ARR &#043; 1)<\/p>\n<h4>1.4.3 \u8ba1\u6570\u5668\u65e0\u9884\u88c5\u65f6\u5e8f<\/h4>\n<p>\u5c31\u662f\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668\u662f\u5426\u542f\u7528\u4e86\u7f13\u51b2\u5bc4\u5b58\u5668&#xff0c;\u5176\u5b9e\u548cPSC\u9884\u5206\u9891\u5668\u7684\u7f13\u51b2\u5668\u9053\u7406\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p>\u5bf9\u4e8e\u6709\u9634\u5f71\u90e8\u5206\u7684\u5668\u4ef6&#xff0c;\u5176\u90fd\u662f\u6709\u7f13\u51b2\u5bc4\u5b58\u5668\u7684\u529f\u80fd\u7684\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005631-6848d43fe2a15.jpg\" alt=\"img\" \/><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005632-6848d4405bae2.jpg\" alt=\"img\" \/><\/p>\n<p>\u5bf9\u4e8e\u6ca1\u6709\u542f\u7528\u7f13\u51b2\u5668\u7684\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668&#xff0c;\u5728\u67d0\u4e00\u4e2a\u65f6\u949f\u5468\u671f\u5185&#xff08;\u7ea2\u865a\u7ebf\u5de6\u8fb9&#xff09;&#xff0c;\u5bf9\u76ee\u6807\u8ba1\u6570\u8fdb\u884c\u4e86\u66f4\u65b0&#xff0c;\u4e5f\u5c31\u662f\u539f\u672c\u662fFF\u6539\u4e3a\u4e8636&#xff0c;\u90a3\u4e48\u539f\u6765\u8be5\u65f6\u949f\u5468\u671f\u7684\u8ba1\u6570\u76ee\u6807\u662f\u5230FF\u624d\u4ea7\u751f\u7533\u8bf7\u4e2d\u65ad&#xff0c;\u5230\u7531\u4e8e\u66f4\u6539\u4e86&#xff0c;\u8ba1\u6570\u523036\u5c31\u7533\u8bf7\u4e2d\u65ad&#xff0c;\u8ba1\u6570\u6e050<\/p>\n<p>\u8fd9\u548cPSC\u662f\u4e00\u6837\u7684&#xff0c;\u5982\u679c\u4e0d\u5f00\u542f\u7f13\u51b2\u5668&#xff0c;\u90a3\u4e48\u5c31\u4f1a\u5bfc\u81f4\u5728\u67d0\u4e00\u4e2a\u5468\u671f\u5185\u4ea7\u751f\u65b0\u7684\u5206\u9891&#xff0c;\u9020\u6210\u65f6\u949f\u7684\u8ba1\u6570\u9891\u7387\u4e0d\u4e00\u6837\u3002<\/p>\n<h4>1.4.4 \u8ba1\u6570\u5668\u6709\u9884\u88c5\u65f6\u5e8f<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005633-6848d44108e29.jpg\" alt=\"img\" \/><\/p>\n<p>\u8fd9\u79cd\u5728\u67d0\u4e00\u4e2a\u5468\u671f\u5185\u66f4\u6539\u4e86\u76ee\u6807\u8ba1\u6570&#xff0c;\u53ea\u4f1a\u5728\u4e0b\u4e00\u4e2a\u65f6\u949f\u5468\u671f\u751f\u6548&#xff0c;\u4e0d\u4f1a\u5f71\u54cd\u5230\u5f53\u524d\u7684\u5468\u671f<\/p>\n<h3>1.5 RCC\u65f6\u949f\u6811<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005633-6848d441a5fa1.jpg\" alt=\"img\" \/><\/p>\n<p>\u7ea2\u8272\u5de6\u8fb9\u7684\u90fd\u662f\u65f6\u949f\u7684\u4ea7\u751f\u7535\u8def&#xff0c;\u53f3\u8fb9\u7684\u5219\u662f\u65f6\u949f\u7684\u5206\u914d\u7535\u8def\u3002\u4e2d\u95f4\u7684SYSCLK\u5c31\u662f\u7cfb\u7edf\u7684\u65f6\u949f72MHz&#xff0c;\u4e0d\u8fc7\u65f6\u949f\u4e00\u5f00\u59cb\u8f93\u51fa\u7684\u5e76\u4e0d\u662f72MHz&#xff0c;\u5728\u65f6\u949f\u4ea7\u751f\u7535\u8def\u4e2d&#xff0c;\u662f\u67094\u4e2a\u632f\u8361\u6e90&#xff0c;\u4ece\u4e0a\u5f80\u4e0b\u5206\u522b\u662f:<\/p>\n<ul>\n<li>8 MHz HSI RC&#xff1a;\u5185\u90e8\u76848MHz\u7684\u9ad8\u901fRC\u632f\u8361\u5668<\/li>\n<li>4-16 MHz HSE OSC&#xff1a;\u5916\u90e8\u76844-16MHz\u9ad8\u901f\u77f3\u82f1\u6676\u4f53\u632f\u8361\u5668&#xff0c;\u4e5f\u5c31\u662f\u6676\u632f&#xff0c;\u4e00\u822c\u90fd\u662f\u63a58MHz<\/li>\n<li>LSE OSC 32.768 kHz&#xff1a;\u5916\u90e8\u7684 32.768 kHz\u7684\u4f4e\u901f\u6676\u632f&#xff0c;\u4e00\u822c\u662f\u7ed9RTC\u4f7f\u7528\u7684<\/li>\n<li>LSI RC 40 KHz&#xff1a;\u5185\u90e8\u768440 KHz\u4f4e\u901fRC\u6676\u632f&#xff0c;\u7ed9\u770b\u95e8\u72d7\u63d0\u4f9b\u65f6\u949f\u7684<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u524d\u4e24\u4e2a\u662f\u7ed9\u7cfb\u7edf\u63d0\u4f9b\u620f\u4e2d\u7684&#xff0c;AHB\u3001APB1\u3001APB2\u603b\u7ebf\u7684\u65f6\u949f\u90fd\u662f\u7531\u5176\u63d0\u4f9b\u7684\u3002\u4e00\u4e2a\u5185\u90e8\u4e00\u4e2a\u5916\u90e8&#xff0c;\u90fd\u662f\u53ef\u4ee5\u4f7f\u7528\u7684&#xff0c;1\u53ea\u4e0d\u8fc7\u5916\u90e8\u7684\u77f3\u82f1\u6676\u4f53\u632f\u8361\u5668\u4f1a\u6bd4\u5185\u90e8\u7684RC\u632f\u8361\u5668\u66f4\u7a33\u5b9a\u3002<\/p>\n<p>\u5bf9\u4e8e\u7cfb\u7edf\u5185\u90e8\u7684\u65f6\u949f&#xff0c;\u662f\u6709\u63d0\u4f9b\u7684init\u51fd\u6570\u6765\u8fdb\u884c\u521d\u59cb\u5316\u7684&#xff0c;\u5176\u601d\u8def\u662f\u8fd9\u6837\u7684&#xff0c;\u5148\u542f\u7528\u7684\u7b2c\u4e00\u4e2a8 MHz HSI RC\u4f5c\u4e3a\u7cfb\u7edf\u65f6\u949f&#xff0c;\u4e4b\u540e\u518d\u53bb\u914d\u7f6e\u7b2c\u4e8c\u4e2a\u5916\u90e84-16 MHz HSE OSC&#xff0c;\u7b49\u5176\u7ecf\u8fc7PLLMUL\u9501\u76f8\u73af\u8fdb\u884c\u500d\u9891&#xff0c;8MHz\u500d\u98919\u500d&#xff0c;\u4e5f\u5c31\u662f\u5f97\u5230\u7a33\u5b9a\u768472MHz\u540e&#xff0c;\u518d\u542f\u7528\u5176\u4f5c\u4e3a\u7cfb\u7edf\u7684\u65f6\u949f&#xff0c;\u539f\u672c\u7684\u7b2c\u4e00\u4e2a\u65f6\u949f\u5173\u95ed&#xff0c;\u5b9e\u73b0\u4e86\u4ece8MHz\u5207\u6362\u5230\u4e8672MHz\u3002<\/p>\n<p>\u6240\u4ee5\u5982\u679c\u5728\u67d0\u4e9b\u65f6\u523b&#xff0c;\u660e\u660e\u4f60\u5b9a\u7684\u65f6\u949f\u662f1s&#xff0c;\u7ed3\u679c\u5927\u7ea610s\u540e\u624d\u53d1\u751f\u4e2d\u65ad&#xff0c;\u90a3\u4e48\u5c31\u6709\u53ef\u80fd\u6b64\u65f6\u4f7f\u7528\u7684\u8fd8\u662f\u7b2c\u4e00\u4e2a\u5185\u90e8\u76848MHz\u7684\u9ad8\u901fRC\u632f\u8361\u5668\u4f5c\u4e3a\u7cfb\u7edf\u7684\u65f6\u949f&#xff0c;\u7b2c\u4e8c\u4e2a\u65f6\u949f\u7684\u6676\u632f\u53ef\u80fd\u51fa\u73b0\u95ee\u9898\u4e86\u3002<\/p>\n<ul>\n<li>\u6b64\u5916\u91cc\u9762\u8fd8\u6709\u4e00\u4e2aCSS\u7684\u5668\u4ef6&#xff0c;\u4e5f\u5c31\u662f\u65f6\u949f\u5b89\u5168\u7cfb\u7edf&#xff0c;\u8d1f\u8d23\u5207\u6362\u65f6\u949f&#xff0c;\u53ef\u4ee5\u68c0\u6d4b\u5916\u90e8\u65f6\u949f\u7684\u8fd0\u884c\u72b6\u6001&#xff0c;\u4e00\u65e6\u5916\u90e8\u65f6\u949f\u5931\u6548\u5c31\u4f1a\u5207\u6362\u5230\u5185\u90e8\u65f6\u949f&#xff0c;\u9632\u6b62\u7a0b\u5e8f\u4e00\u76f4\u5361\u6b7b\u5728\u90a3\u3002<\/li>\n<\/ul>\n<h2>2.\u57fa\u672c\u4f7f\u7528<\/h2>\n<h3>2.1 \u6b65\u9aa4<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005629-6848d43db321f.jpg\" alt=\"img\" \/><\/p>\n<p>\u6309\u7167\u8fd9\u4e2a\u7ed3\u6784\u4f53\u53bb\u8fdb\u884c\u914d\u7f6e\u5b9a\u65f6\u5668&#xff1a;<\/p>\n<li>RCC\u5f00\u542f\u65f6\u949f&#xff0c;\u5728\u6a21\u5757\u7a0b\u5e8f\u7f16\u5199\u7684\u65f6\u5019\u90fd\u662f\u57fa\u672c\u4f1a\u6267\u884c\u7684\u3002\u6253\u5f00\u540e\u5b9a\u65f6\u5668\u7684\u57fa\u51c6\u65f6\u949f\u548c\u6574\u4e2a\u5916\u8bbe\u65f6\u949f\u90fd\u4f1a\u6253\u5f00<\/li>\n<li>\u9009\u62e9\u65f6\u57fa\u5355\u5143\u7684\u65f6\u949f\u6e90&#xff0c;\u8fd9\u91cc\u6211\u4eec\u9009\u62e9\u7684\u662fRCC\u5185\u90e8\u65f6\u949f&#xff0c;\u56e0\u6b64\u914d\u7f6e\u4e3a\u5185\u90e8\u65f6\u949f\u6a21\u5f0f<\/li>\n<li>\u914d\u7f6e\u65f6\u57fa\u5355\u5143&#xff1a;PSC\u9884\u5206\u9891\u5668\u3001CNT\u8ba1\u6570\u5668\u3001ARP\u81ea\u52a8\u91cd\u88c5\u5668&#xff0c;\u8fd9\u4e00\u90e8\u5206\u7528\u7ed3\u6784\u4f53\u914d\u7f6e\u5c31\u597d\u4e86<\/li>\n<li>\u914d\u7f6e\u4e2d\u65ad\u8f93\u51fa\u63a7\u5236&#xff0c;\u5141\u8bb8\u66f4\u65b0\u4e2d\u65ad\u8f93\u51fa\u5230NVCI<\/li>\n<li>\u914d\u7f6eNVIC&#xff0c;\u5728NVIC\u4e2d\u6253\u5f00\u5b9a\u65f6\u5668\u4e2d\u65ad\u7684\u901a\u9053&#xff0c;\u5e76\u914d\u7f6e\u4e00\u4e2a\u4f18\u5148\u7ea7<\/li>\n<li>\u8fd0\u884c\u63a7\u5236\u914d\u7f6e&#xff0c;\u4e5f\u5c31\u662f\u4f7f\u80fd\u5b9a\u65f6\u5668<\/li>\n<li>\u5b9a\u4e49\u5b9a\u65f6\u5668\u4e2d\u65ad\u51fd\u6570<\/li>\n<h3>2.2 \u76f8\u5173\u51fd\u6570<\/h3>\n<p>\u6309\u7167\u914d\u7f6e\u6b65\u9aa4&#xff0c;\u53bb\u8c03\u7528\u76f8\u5173\u7684\u5e93\u51fd\u6570&#xff0c;\u6709\u54ea\u4e9b\u5e93\u51fd\u6570\u53ef\u4ee5\u53bb\u67e5\u770bstm32f10x_tim.h\u6587\u4ef6<\/p>\n<p>\u5e93\u51fd\u6570\u624b\u518c\u4e2d\u4e5f\u5df2\u7ecf\u8be6\u7ec6\u7684\u8bb2\u89e3\u4e86\u3002\u4e0b\u9762\u6839\u636e\u914d\u7f6e\u6b65\u9aa4&#xff0c;\u7ed9\u51fa\u6240\u9700\u8981\u7684\u76f8\u5173\u51fd\u6570&#xff1a;<\/p>\n<li>RCC\u5f00\u542f\u65f6\u949f&#xff0c;\u5728\u6a21\u5757\u7a0b\u5e8f\u7f16\u5199\u7684\u65f6\u5019\u90fd\u662f\u57fa\u672c\u4f1a\u6267\u884c\u7684\u3002\u6253\u5f00\u540e\u5b9a\u65f6\u5668\u7684\u57fa\u51c6\u65f6\u949f\u548c\u6574\u4e2a\u5916\u8bbe\u65f6\u949f\u90fd\u4f1a\u6253\u5f00<\/li>\n<li>\u9009\u62e9\u65f6\u57fa\u5355\u5143\u7684\u65f6\u949f\u6e90&#xff0c;\u8fd9\u91cc\u6211\u4eec\u9009\u62e9\u7684\u662fRCC\u5185\u90e8\u65f6\u949f&#xff0c;\u56e0\u6b64\u914d\u7f6e\u4e3a\u5185\u90e8\u65f6\u949f\u6a21\u5f0f<\/li>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_InternalClockConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u5c06\u5b9a\u65f6\u5668\u7684\u65f6\u949f\u6e90\u914d\u7f6e\u4e3a\u5185\u90e8\u65f6\u949f&#xff0c;\u5373\u7cfb\u7edf\u65f6\u949f&#xff08;\u6bd4\u5982<span class=\"token number\">72<\/span> MHz&#xff09;\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ITRxExternalClockConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_InputTriggerSource<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668 TIMx \u7684\u5916\u90e8\u65f6\u949f\u6e90\u4e3a\u67d0\u4e2a\u5185\u90e8\u89e6\u53d1\u6e90&#xff08;ITRx&#xff09;\u3002<br \/>\nTIM_InputTriggerSource \u7528\u4e8e\u6307\u5b9a\u89e6\u53d1\u6e90&#xff08;\u5982TRGI\u4fe1\u53f7&#xff09;\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_TIxExternalClockConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_TIxExternalCLKSource<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_ICPolarity<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> ICFilter<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668 TIMx \u7684\u5916\u90e8\u65f6\u949f\u4e3a TIx \u5f15\u811a\u7684\u8f93\u5165\u4fe1\u53f7\u3002<br \/>\n\u53c2\u6570\u5305\u62ec\u8f93\u5165\u901a\u9053\u3001\u6781\u6027&#xff08;\u4e0a\u5347\u6cbf\u6216\u4e0b\u964d\u6cbf\u89e6\u53d1&#xff09;\u4ee5\u53ca\u8f93\u5165\u6ee4\u6ce2\u5668\u914d\u7f6e\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ETRClockMode1Config<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_ExtTRGPrescaler<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_ExtTRGPolarity<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> ExtTRGFilter<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668 TIMx \u7684\u5916\u90e8\u65f6\u949f\u6a21\u5f0f<span class=\"token number\">1<\/span>&#xff0c;\u4f7f\u7528 ETR&#xff08;\u5916\u90e8\u89e6\u53d1&#xff09;\u4f5c\u4e3a\u65f6\u949f\u6e90\u3002<br \/>\n\u53ef\u4ee5\u8bbe\u7f6e ETR \u7684\u9884\u5206\u9891\u3001\u6781\u6027\u548c\u6ee4\u6ce2\u5668\u3002<\/p>\n<p>oid <span class=\"token function\">TIM_ETRClockMode2Config<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_ExtTRGPrescaler<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_ExtTRGPolarity<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> ExtTRGFilter<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668 TIMx \u7684\u5916\u90e8\u65f6\u949f\u6a21\u5f0f<span class=\"token number\">2<\/span>&#xff0c;\u4f7f\u7528 ETR&#xff08;\u5916\u90e8\u89e6\u53d1&#xff09;\u4f5c\u4e3a\u65f6\u949f\u6e90\u3002<br \/>\n\u4e0e\u6a21\u5f0f<span class=\"token number\">1<\/span>\u7c7b\u4f3c&#xff0c;\u4f46\u5177\u4f53\u884c\u4e3a\u7565\u6709\u4e0d\u540c&#xff0c;\u901a\u5e38\u7528\u4e8e\u66f4\u590d\u6742\u7684\u540c\u6b65\u9700\u6c42\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005634-6848d442200d5.jpg\" alt=\"img\" \/><\/p>\n<li>\u914d\u7f6e\u65f6\u57fa\u5355\u5143&#xff1a;PSC\u9884\u5206\u9891\u5668\u3001CNT\u8ba1\u6570\u5668\u3001ARP\u81ea\u52a8\u91cd\u88c5\u5668&#xff0c;\u8fd9\u4e00\u90e8\u5206\u7528\u7ed3\u6784\u4f53\u914d\u7f6e\u5c31\u597d\u4e86<\/li>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_TimeBaseInit<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> TIM_TimeBaseInitTypeDef<span class=\"token operator\">*<\/span> TIM_TimeBaseInitStruct<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u521d\u59cb\u5316\u5b9a\u65f6\u5668\u7684\u57fa\u672c\u65f6\u95f4\u57fa\u914d\u7f6e\u3002<br \/>\nTIM_TimeBaseInitStruct \u662f\u4e00\u4e2a\u7ed3\u6784\u4f53&#xff0c;\u5305\u542b\u5b9a\u65f6\u5668\u7684\u9884\u5206\u9891\u7cfb\u6570\u3001\u8ba1\u6570\u6a21\u5f0f\u3001\u8ba1\u6570\u5668\u5468\u671f\u3001\u65f6\u949f\u5206\u9891\u3001\u91cd\u590d\u8ba1\u6570\u7b49\u53c2\u6570\u3002\u3001<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_TimeBaseStructInit<\/span><span class=\"token punctuation\">(<\/span>TIM_TimeBaseInitTypeDef<span class=\"token operator\">*<\/span> TIM_TimeBaseInitStruct<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u5c06 TIM_TimeBaseInitTypeDef \u7ed3\u6784\u4f53\u521d\u59cb\u5316\u4e3a\u9ed8\u8ba4\u503c\u3002<\/p>\n<p><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><span class=\"token operator\">&#8212;<\/span><br \/>\n<span class=\"token comment\">\/\/\u4e0b\u9762\u662f\u548c\u65f6\u57fa\u5355\u5143\u53e6\u5916\u76f8\u5173\u7684\u51fd\u6570&#xff0c;\u57fa\u7840\u77e5\u8bc6\u5728\u4e0a\u9762\u5bf9\u5b9a\u65f6\u5668\u7684\u4ecb\u7ecd\u7684\u65f6\u5019\u4e5f\u8bb2\u8fc7&#xff1a;<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_PrescalerConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> Prescaler<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_PSCReloadMode<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668\u7684\u9884\u5206\u9891\u5668\u503c Prescaler\u3002<br \/>\nTIM_PSCReloadMode \u6307\u5b9a\u662f\u5426\u7acb\u5373\u52a0\u8f7d\u65b0\u7684\u5206\u9891\u503c&#xff08;\u4e00\u822c\u4e3a TIM_PSCReloadMode_Immediate&#xff09;\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_SetCounter<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> Counter<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u8bbe\u7f6e\u5b9a\u65f6\u5668\u7684\u8ba1\u6570\u5668\u503c&#xff0c;\u5373\u76f4\u63a5\u5bf9 CNT \u5bc4\u5b58\u5668\u8d4b\u503c\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ARRPreloadConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> FunctionalState NewState<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668&#xff08;ARR&#xff09;\u7684\u9884\u88c5\u8f7d\u529f\u80fd&#xff0c;\u63a7\u5236 ARR \u503c\u7684\u66f4\u65b0\u65b9\u5f0f\u3002<br \/>\n\u82e5\u542f\u7528\u9884\u88c5\u8f7d&#xff0c;ARR \u503c\u5c06\u5728\u4e0b\u4e00\u4e2a\u66f4\u65b0\u4e8b\u4ef6\u65f6\u52a0\u8f7d\u5230\u8ba1\u6570\u5668\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_SetCounter<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> Counter<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u8bbe\u7f6e\u5b9a\u65f6\u5668\u7684\u8ba1\u6570\u5668\u503c&#xff0c;\u5373\u76f4\u63a5\u5bf9 CNT \u5bc4\u5b58\u5668\u8d4b\u503c\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_SetAutoreload<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> Autoreload<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u8bbe\u7f6e\u81ea\u52a8\u91cd\u88c5\u8f7d\u503c&#xff08;ARR&#xff09;&#xff0c;\u7528\u4e8e\u63a7\u5236\u8ba1\u6570\u5468\u671f\u7684\u957f\u5ea6\u3002<\/p>\n<p><span class=\"token class-name\">uint16_t<\/span> <span class=\"token function\">TIM_GetCounter<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u83b7\u53d6\u5f53\u524d\u8ba1\u6570\u5668\u7684\u503c&#xff08;CNT\u5bc4\u5b58\u5668\u7684\u503c&#xff09;\u3002<\/p>\n<p><span class=\"token class-name\">uint16_t<\/span> <span class=\"token function\">TIM_GetPrescaler<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u83b7\u53d6\u5f53\u524d\u7684\u9884\u5206\u9891\u5668\u503c&#xff08;PSC\u5bc4\u5b58\u5668\u7684\u503c&#xff09;\u3002<\/p>\n<p>FlagStatus <span class=\"token function\">TIM_GetFlagStatus<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_FLAG<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u83b7\u53d6\u5b9a\u65f6\u5668\u7684\u7279\u5b9a\u6807\u5fd7\u72b6\u6001&#xff08;\u5982\u66f4\u65b0\u6807\u5fd7\u3001\u89e6\u53d1\u6807\u5fd7\u7b49&#xff09;\u3002\u8fd4\u56de\u6807\u5fd7\u7684\u72b6\u6001\u662f\u8bbe\u7f6e\u8fd8\u662f\u6e05\u9664\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ClearFlag<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_FLAG<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u6e05\u9664\u6307\u5b9a\u7684\u5b9a\u65f6\u5668\u6807\u5fd7&#xff0c;\u5c06\u5bf9\u5e94\u7684\u6807\u5fd7\u4f4d\u590d\u4f4d\u3002<\/p>\n<p>ITStatus <span class=\"token function\">TIM_GetITStatus<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_IT<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u68c0\u67e5\u6307\u5b9a\u7684\u5b9a\u65f6\u5668\u4e2d\u65ad\u662f\u5426\u53d1\u751f&#xff0c;\u8fd4\u56de\u4e2d\u65ad\u72b6\u6001\u3002<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ClearITPendingBit<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_IT<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u6e05\u9664\u6307\u5b9a\u7684\u5b9a\u65f6\u5668\u4e2d\u65ad\u6302\u8d77\u4f4d&#xff0c;\u5373\u91cd\u7f6e\u4e2d\u65ad\u6807\u5fd7&#xff0c;\u4f7f\u5f97\u8be5\u4e2d\u65ad\u80fd\u591f\u518d\u6b21\u89e6\u53d1\u3002<\/p>\n<li>\u914d\u7f6e\u4e2d\u65ad\u8f93\u51fa\u63a7\u5236&#xff0c;\u5141\u8bb8\u66f4\u65b0\u4e2d\u65ad\u8f93\u51fa\u5230NVCI<\/li>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_ITConfig<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">uint16_t<\/span> TIM_IT<span class=\"token punctuation\">,<\/span> FunctionalState NewState<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u914d\u7f6e\u5b9a\u65f6\u5668\u7684\u4e2d\u65ad\u529f\u80fd&#xff0c;\u4f7f\u80fd\u6216\u7981\u7528\u6307\u5b9a\u7684\u4e2d\u65ad\u3002<br \/>\n\u8be5\u51fd\u6570\u7528\u4e8e\u63a7\u5236\u5b9a\u65f6\u5668\u7684\u7279\u5b9a\u4e2d\u65ad\u6e90\u7684\u4f7f\u80fd\u72b6\u6001\u3002\u5f53 NewState \u4e3a ENABLE \u65f6&#xff0c;\u5f00\u542f\u6307\u5b9a\u7684\u4e2d\u65ad\u6e90&#xff1b;\u5f53 NewState \u4e3a DISABLE \u65f6&#xff0c;\u5173\u95ed\u6307\u5b9a\u7684\u4e2d\u65ad\u6e90\u3002<\/p>\n<li>\u914d\u7f6eNVIC&#xff0c;\u5728NVIC\u4e2d\u6253\u5f00\u5b9a\u65f6\u5668\u4e2d\u65ad\u7684\u901a\u9053&#xff0c;\u5e76\u914d\u7f6e\u4e00\u4e2a\u4f18\u5148\u7ea7\u3002 \u2014 \u8fd9\u4e00\u90e8\u5206\u7684\u51fd\u6570\u5728\u4e4b\u524d\u8bb2\u89e3NVIC\u7684\u57fa\u672c\u4e00\u81f4\u3002<\/li>\n<li>\u8fd0\u884c\u63a7\u5236\u914d\u7f6e&#xff0c;\u4e5f\u5c31\u662f\u4f7f\u80fd\u5b9a\u65f6\u5668<\/li>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">TIM_Cmd<\/span><span class=\"token punctuation\">(<\/span>TIM_TypeDef<span class=\"token operator\">*<\/span> TIMx<span class=\"token punctuation\">,<\/span> FunctionalState NewState<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n\u7528\u4e8e\u5f00\u542f\u6216\u5173\u95ed\u6307\u5b9a\u7684\u5b9a\u65f6\u5668\u3002\u5f53 NewState \u4e3a ENABLE \u65f6&#xff0c;\u5b9a\u65f6\u5668\u5f00\u59cb\u8fd0\u884c&#xff1b;\u5f53 NewState \u4e3a DISABLE \u65f6&#xff0c;\u5b9a\u65f6\u5668\u505c\u6b62\u8fd0\u884c\u3002<\/p>\n<li>\u5b9a\u4e49\u5b9a\u65f6\u5668\u4e2d\u65ad\u51fd\u6570<\/li>\n<h3>2.3 \u7ed3\u6784\u4f53<\/h3>\n<p>\u4ee5\u4e0b\u662f\u7ed3\u6784\u4f53 TIM_TimeBaseInitTypeDef \u7684\u6210\u5458\u53d8\u91cf\u7684\u4e2d\u6587\u6ce8\u91ca&#xff0c;\u5e76\u9644\u4e0a\u8be6\u7ec6\u7684\u89e3\u91ca&#xff1a;<\/p>\n<p><span class=\"token keyword\">typedef<\/span> <span class=\"token keyword\">struct<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token class-name\">uint16_t<\/span> TIM_Prescaler<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/*!&lt; \u6307\u5b9a\u7528\u4e8e\u5206\u9891\u5b9a\u65f6\u5668\u65f6\u949f\u7684\u9884\u5206\u9891\u5668\u503c\u3002<br \/>\n                                       \u6b64\u53c2\u6570\u53ef\u4ee5\u662f 0x0000 \u5230 0xFFFF \u4e4b\u95f4\u7684\u4e00\u4e2a\u6570\u503c *\/<\/span><\/p>\n<p>  <span class=\"token class-name\">uint16_t<\/span> TIM_CounterMode<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/*!&lt; \u6307\u5b9a\u8ba1\u6570\u5668\u6a21\u5f0f\u3002<br \/>\n                                       \u6b64\u53c2\u6570\u53ef\u4ee5\u662f &#064;ref TIM_Counter_Mode \u7684\u4e00\u4e2a\u503c *\/<\/span><\/p>\n<p>  <span class=\"token class-name\">uint16_t<\/span> TIM_Period<span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/*!&lt; \u6307\u5b9a\u5c06\u5728\u4e0b\u4e00\u4e2a\u66f4\u65b0\u4e8b\u4ef6\u65f6\u88c5\u8f7d\u5230\u6d3b\u52a8\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668\u4e2d\u7684\u5468\u671f\u503c\u3002<br \/>\n                                       \u6b64\u53c2\u6570\u5fc5\u987b\u662f 0x0000 \u5230 0xFFFF \u4e4b\u95f4\u7684\u4e00\u4e2a\u6570\u503c *\/<\/span> <\/p>\n<p>  <span class=\"token class-name\">uint16_t<\/span> TIM_ClockDivision<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/*!&lt; \u6307\u5b9a\u65f6\u949f\u5206\u9891\u7cfb\u6570\u3002<br \/>\n                                       \u6b64\u53c2\u6570\u53ef\u4ee5\u662f &#064;ref TIM_Clock_Division_CKD \u7684\u4e00\u4e2a\u503c *\/<\/span><\/p>\n<p>  <span class=\"token class-name\">uint8_t<\/span> TIM_RepetitionCounter<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/*!&lt; \u6307\u5b9a\u91cd\u590d\u8ba1\u6570\u5668\u7684\u503c\u3002\u6bcf\u5f53 RCR \u9012\u51cf\u8ba1\u6570\u5668\u8fbe\u5230\u96f6\u65f6&#xff0c;\u751f\u6210\u4e00\u4e2a\u66f4\u65b0\u4e8b\u4ef6\u5e76\u4ece RCR \u503c (N) \u91cd\u65b0\u5f00\u59cb\u8ba1\u6570\u3002<br \/>\n                                       \u5728 PWM \u6a21\u5f0f\u4e0b&#xff0c;\u8fd9\u610f\u5473\u7740 (N&#043;1) \u5bf9\u5e94\u4e8e&#xff1a;<br \/>\n                                          &#8211; \u8fb9\u6cbf\u5bf9\u9f50\u6a21\u5f0f\u4e0b\u7684 PWM \u5468\u671f\u6570<br \/>\n                                          &#8211; \u4e2d\u5fc3\u5bf9\u9f50\u6a21\u5f0f\u4e0b\u7684\u534a\u4e2a PWM \u5468\u671f\u6570<br \/>\n                                       \u6b64\u53c2\u6570\u5fc5\u987b\u662f 0x00 \u5230 0xFF \u4e4b\u95f4\u7684\u4e00\u4e2a\u6570\u503c\u3002<br \/>\n                                       &#064;note \u6b64\u53c2\u6570\u4ec5\u5bf9 TIM1 \u548c TIM8 \u6709\u6548 *\/<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> TIM_TimeBaseInitTypeDef<span class=\"token punctuation\">;<\/span><\/p>\n<li>TIM_Prescaler (\u9884\u5206\u9891\u5668)&#xff1a;<\/li>\n<ul>\n<li>\n<ul>\n<li>\u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u5b9a\u65f6\u5668\u65f6\u949f\u7684\u9884\u5206\u9891\u503c\u3002<\/li>\n<li>\u8303\u56f4&#xff1a;\u53ef\u4ee5\u53d6 0x0000 \u5230 0xFFFF \u4e4b\u95f4\u7684\u6570\u503c\u3002<\/li>\n<li>\u89e3\u91ca&#xff1a;\u5b9a\u65f6\u5668\u7684\u65f6\u949f\u9891\u7387\u662f\u901a\u8fc7\u9884\u5206\u9891\u5668\u5206\u9891\u5f97\u5230\u7684&#xff0c;\u5373 CK_CNT &#061; CK_PSC \/ (TIM_Prescaler &#043; 1)&#xff0c;\u5176\u4e2d CK_PSC \u4e3a\u8f93\u5165\u7684\u65f6\u949f\u9891\u7387\u3002\u9884\u5206\u9891\u503c\u8d8a\u5927&#xff0c;CK_CNT \u7684\u9891\u7387\u5c31\u8d8a\u4f4e\u3002\u901a\u8fc7\u63a7\u5236\u9884\u5206\u9891\u5668&#xff0c;\u53ef\u4ee5\u66f4\u7075\u6d3b\u5730\u63a7\u5236\u5b9a\u65f6\u5668\u7684\u8ba1\u6570\u901f\u5ea6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<li>TIM_CounterMode (\u8ba1\u6570\u5668\u6a21\u5f0f)&#xff1a;<\/li>\n<ul>\n<li>\n<ul>\n<li>\u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u8ba1\u6570\u5668\u7684\u8ba1\u6570\u6a21\u5f0f\u3002<\/li>\n<li>\u53d6\u503c&#xff1a;\u53ef\u4ee5\u662f TIM_Counter_Mode \u7684\u679a\u4e3e\u503c&#xff0c;\u5e38\u89c1\u7684\u503c\u5305\u62ec&#xff1a;<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\n<ul>\n<li>\u5411\u4e0a\u8ba1\u6570\u6a21\u5f0f&#xff1a;TIM_CounterMode_Up<\/li>\n<li>\u5411\u4e0b\u8ba1\u6570\u6a21\u5f0f&#xff1a;TIM_CounterMode_Down<\/li>\n<li>\u4e2d\u5fc3\u5bf9\u9f50\u8ba1\u6570\u6a21\u5f0f&#xff08;\u53ef\u4ee5\u4ea7\u751f\u5bf9\u79f0\u4fe1\u53f7&#xff0c;\u5e38\u7528\u4e8e PWM&#xff09;&#xff1a;TIM_CounterMode_CenterAligned1\u3001TIM_CounterMode_CenterAligned2\u3001TIM_CounterMode_CenterAligned3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u89e3\u91ca&#xff1a;\u5728\u4e0d\u540c\u7684\u6a21\u5f0f\u4e0b&#xff0c;\u8ba1\u6570\u5668\u53ef\u4ee5\u8fdb\u884c\u5411\u4e0a\u8ba1\u6570&#xff08;\u4ece 0 \u8ba1\u6570\u5230\u8bbe\u5b9a\u7684\u5468\u671f\u503c&#xff09;\u6216\u5411\u4e0b\u8ba1\u6570&#xff08;\u4ece\u8bbe\u5b9a\u7684\u5468\u671f\u503c\u8ba1\u6570\u5230 0&#xff09;\u3002\u4e2d\u5fc3\u5bf9\u9f50\u6a21\u5f0f\u5219\u4f1a\u5148\u5411\u4e0a\u8ba1\u6570\u5230\u8bbe\u5b9a\u503c&#xff0c;\u7136\u540e\u518d\u5411\u4e0b\u8ba1\u6570\u5230 0\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<li>TIM_Period (\u5468\u671f)&#xff1a;<\/li>\n<ul>\n<li>\n<ul>\n<li>\u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u81ea\u52a8\u91cd\u88c5\u8f7d\u5bc4\u5b58\u5668\u7684\u5468\u671f\u503c\u3002<\/li>\n<li>\u8303\u56f4&#xff1a;0x0000 \u5230 0xFFFF \u4e4b\u95f4\u7684\u6570\u503c\u3002<\/li>\n<li>\u89e3\u91ca&#xff1a;\u8ba1\u6570\u5668\u8ba1\u6570\u5230 TIM_Period \u7684\u503c\u540e\u4f1a\u4ea7\u751f\u66f4\u65b0\u4e8b\u4ef6&#xff08;UEV&#xff09;&#xff0c;\u7136\u540e\u8ba1\u6570\u5668\u4f1a\u91cd\u7f6e\u4e3a 0\u3002\u5468\u671f\u503c\u7684\u5927\u5c0f\u51b3\u5b9a\u4e86\u8ba1\u6570\u5668\u6ea2\u51fa\u6240\u9700\u7684\u65f6\u95f4&#xff0c;\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u5468\u671f\u503c\u6765\u8bbe\u7f6e\u8ba1\u65f6\u5468\u671f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<li>TIM_ClockDivision (\u65f6\u949f\u5206\u9891)&#xff1a;<\/li>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005635-6848d443394b9.png\" alt=\"img\" \/><\/p>\n<ul>\n<li>\n<ul>\n<li>\u4f5c\u7528&#xff1a;\u63a7\u5236\u5b9a\u65f6\u5668\u65f6\u949f\u7684\u5206\u9891\u7cfb\u6570\u3002<\/li>\n<li>\u53d6\u503c&#xff1a;\u53ef\u4ee5\u662f TIM_Clock_Division_CKD \u7684\u679a\u4e3e\u503c&#xff0c;\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u9009\u9879&#xff1a;<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\n<ul>\n<li>\u4e0d\u5206\u9891 (0)&#xff1a;TIM_CKD_DIV1<\/li>\n<li>\u5206\u9891\u7cfb\u6570\u4e3a 2 (1)&#xff1a;TIM_CKD_DIV2<\/li>\n<li>\u5206\u9891\u7cfb\u6570\u4e3a 4 (2)&#xff1a;TIM_CKD_DIV4<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<ul>\n<li>\u89e3\u91ca&#xff1a;\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b&#xff0c;\u53ef\u4ee5\u5bf9\u5b9a\u65f6\u5668\u7684\u5185\u90e8\u65f6\u949f\u8fdb\u884c\u5206\u9891&#xff0c;\u4ee5\u6ee1\u8db3\u4e0d\u540c\u5e94\u7528\u573a\u666f\u7684\u9700\u6c42\u3002\u901a\u5e38\u7528\u4e8e\u4e00\u4e9b\u7279\u6b8a\u7684\u8ba1\u65f6\u5e94\u7528\u4e2d\u3002\u8fd8\u6709\u5c31\u662f\u5bf9\u4e8e\u4e00\u4e9b\u5916\u90e8\u7684\u65f6\u949f&#xff0c;\u8981\u8fbe\u5230\u65f6\u57fa\u5355\u5143\u662f\u8981\u7ecf\u8fc7\u6ee4\u6ce2\u5668\u8fdb\u884c\u6ee4\u6ce2\u7684&#xff0c;\u6ee4\u6ce2\u5668\u7684\u539f\u7406\u5c31\u662f\u5728\u56fa\u5b9a\u7684\u65f6\u949f\u9891\u7387\u4e0b\u5bf9\u6ce2\u5f62\u8fdb\u884c\u91c7\u6837&#xff0c;\u5982\u679c\u8fde\u7eedN\u4e2a\u91c7\u6837\u70b9\u90fd\u662f\u76f8\u540c\u7684&#xff0c;\u5219\u4ee3\u8868\u4fe1\u53f7\u7a33\u5b9a&#xff0c;\u5c31\u5c06\u91c7\u6837\u503c\u8f93\u51fa\u51fa\u53bb\u3002\u800c\u8fd9\u4e2a\u56fa\u5b9a\u7684\u65f6\u949f\u91c7\u6837\u9891\u7387\u5c31\u662f\u53ef\u4ee5\u7531\u5185\u90e8\u7684\u65f6\u949f\u9891\u7387\u800c\u6765&#xff0c;\u4e5f\u53ef\u4ee5\u662f\u7531\u5185\u90e8\u65f6\u949f\u52a0\u4e00\u4e2a\u5206\u9891\u5668\u540e\u5206\u9891\u800c\u6765&#xff0c;\u540e\u8005\u8fd9\u4e2a\u5206\u9891\u662f\u591a\u5c11&#xff0c;\u5c31\u662f\u7531\u8be5\u6210\u5458\u51b3\u5b9a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<li>TIM_RepetitionCounter (\u91cd\u590d\u8ba1\u6570\u5668)&#xff1a;<\/li>\n<ul>\n<li>\n<ul>\n<li>\u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u91cd\u590d\u8ba1\u6570\u5668\u503c\u3002<\/li>\n<li>\u8303\u56f4&#xff1a;0x00 \u5230 0xFF \u4e4b\u95f4\u7684\u6570\u503c\u3002<\/li>\n<li>\u89e3\u91ca&#xff1a;\u6bcf\u5f53\u91cd\u590d\u8ba1\u6570\u5668\u9012\u51cf\u81f3\u96f6\u65f6&#xff0c;\u4f1a\u751f\u6210\u4e00\u4e2a\u66f4\u65b0\u4e8b\u4ef6&#xff08;UEV&#xff09;&#xff0c;\u7136\u540e\u91cd\u590d\u8ba1\u6570\u5668\u4f1a\u91cd\u65b0\u52a0\u8f7d\u8bbe\u5b9a\u7684\u503c\u3002\u5728 PWM \u6a21\u5f0f\u4e0b&#xff0c;\u8fd9\u4e00\u53c2\u6570\u7528\u4e8e\u63a7\u5236 PWM \u4fe1\u53f7\u7684\u91cd\u590d\u5468\u671f\u6570\u3002\u5bf9\u4e8e\u8fb9\u6cbf\u5bf9\u9f50\u6a21\u5f0f&#xff0c;\u91cd\u590d\u8ba1\u6570\u5668\u7684\u503c\u52a0 1 \u5c31\u662f PWM \u5468\u671f\u6570&#xff1b;\u800c\u5bf9\u4e8e\u4e2d\u5fc3\u5bf9\u9f50\u6a21\u5f0f&#xff0c;\u5219\u662f\u534a\u4e2a PWM \u5468\u671f\u6570\u3002\u6ce8\u610f&#xff0c;\u91cd\u590d\u8ba1\u6570\u5668\u53ea\u9002\u7528\u4e8e\u9ad8\u7ea7\u5b9a\u65f6\u5668&#xff08;\u5982 TIM1 \u548c TIM8&#xff09;&#xff0c;\u5728\u666e\u901a\u5b9a\u65f6\u5668\u4e2d\u65e0\u6548\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>2.4 \u7f16\u5199<\/h3>\n<h4>2.4.1 \u5b9a\u65f6\u5668\u5185\u90e8\u4e2d\u65ad<\/h4>\n<p>User&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;main.c<\/li>\n<\/ul>\n<p>System&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;Timer.h<\/li>\n<li>&#x1f4ce;Timer.c<\/li>\n<\/ul>\n<p>Hardware&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;OLED_Font.h<\/li>\n<li>&#x1f4ce;OLED.c<\/li>\n<li>&#x1f4ce;OLED.h<\/li>\n<\/ul>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;stm32f10x.h&#034;<\/span>                  <span class=\"token comment\">\/\/ Device header<\/span><\/span><\/p>\n<p><span class=\"token comment\">\/**<br \/>\n  * \u51fd    \u6570&#xff1a;\u5b9a\u65f6\u4e2d\u65ad\u521d\u59cb\u5316<br \/>\n  *\/<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">Timer_Init<\/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 comment\">\/*\u5f00\u542f\u65f6\u949f*\/<\/span><br \/>\n<span class=\"token function\">RCC_APB1PeriphClockCmd<\/span><span class=\"token punctuation\">(<\/span>RCC_APB1Periph_TIM2<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5f00\u542fTIM2\u7684\u65f6\u949f<\/span><\/p>\n<p><span class=\"token comment\">\/*\u914d\u7f6e\u65f6\u949f\u6e90*\/<\/span><br \/>\n<span class=\"token function\">TIM_InternalClockConfig<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\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<\/span><\/p>\n<p><span class=\"token comment\">\/*\u65f6\u57fa\u5355\u5143\u521d\u59cb\u5316*\/<\/span><br \/>\nTIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5b9a\u4e49\u7ed3\u6784\u4f53\u53d8\u91cf<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_ClockDivision <span class=\"token operator\">&#061;<\/span> TIM_CKD_DIV1<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\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<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_CounterMode <span class=\"token operator\">&#061;<\/span> TIM_CounterMode_Up<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8ba1\u6570\u5668\u6a21\u5f0f&#xff0c;\u9009\u62e9\u5411\u4e0a\u8ba1\u6570<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_Period <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10000<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8ba1\u6570\u5468\u671f&#xff0c;\u5373ARR\u7684\u503c<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_Prescaler <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">7200<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u9884\u5206\u9891\u5668&#xff0c;\u5373PSC\u7684\u503c<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_RepetitionCounter <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u91cd\u590d\u8ba1\u6570\u5668&#xff0c;\u9ad8\u7ea7\u5b9a\u65f6\u5668\u624d\u4f1a\u7528\u5230<\/span><br \/>\n<span class=\"token function\">TIM_TimeBaseInit<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>TIM_TimeBaseInitStructure<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5c06\u7ed3\u6784\u4f53\u53d8\u91cf\u4ea4\u7ed9TIM_TimeBaseInit&#xff0c;\u914d\u7f6eTIM2\u7684\u65f6\u57fa\u5355\u5143<\/span><\/p>\n<p><span class=\"token comment\">\/*\u4e2d\u65ad\u8f93\u51fa\u914d\u7f6e*\/<\/span><br \/>\n<span class=\"token function\">TIM_ClearFlag<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> TIM_FLAG_Update<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6e05\u9664\u5b9a\u65f6\u5668\u66f4\u65b0\u6807\u5fd7\u4f4d<\/span><br \/>\n<span class=\"token comment\">\/\/TIM_TimeBaseInit\u51fd\u6570\u672b\u5c3e&#xff0c;\u624b\u52a8\u4ea7\u751f\u4e86\u66f4\u65b0\u4e8b\u4ef6<\/span><br \/>\n<span class=\"token comment\">\/\/\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<\/span><br \/>\n<span class=\"token comment\">\/\/\u5982\u679c\u4e0d\u4ecb\u610f\u6b64\u95ee\u9898&#xff0c;\u5219\u4e0d\u6e05\u9664\u6b64\u6807\u5fd7\u4f4d\u4e5f\u53ef<\/span><\/p>\n<p><span class=\"token function\">TIM_ITConfig<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> TIM_IT_Update<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5f00\u542fTIM2\u7684\u66f4\u65b0\u4e2d\u65ad<\/span><\/p>\n<p><span class=\"token comment\">\/*NVIC\u4e2d\u65ad\u5206\u7ec4*\/<\/span><br \/>\n<span class=\"token function\">NVIC_PriorityGroupConfig<\/span><span class=\"token punctuation\">(<\/span>NVIC_PriorityGroup_2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u914d\u7f6eNVIC\u4e3a\u5206\u7ec42<\/span><br \/>\n<span class=\"token comment\">\/\/\u5373\u62a2\u5360\u4f18\u5148\u7ea7\u8303\u56f4&#xff1a;0~3&#xff0c;\u54cd\u5e94\u4f18\u5148\u7ea7\u8303\u56f4&#xff1a;0~3<\/span><br \/>\n<span class=\"token comment\">\/\/\u6b64\u5206\u7ec4\u914d\u7f6e\u5728\u6574\u4e2a\u5de5\u7a0b\u4e2d\u4ec5\u9700\u8c03\u7528\u4e00\u6b21<\/span><br \/>\n<span class=\"token comment\">\/\/\u82e5\u6709\u591a\u4e2a\u4e2d\u65ad&#xff0c;\u53ef\u4ee5\u628a\u6b64\u4ee3\u7801\u653e\u5728main\u51fd\u6570\u5185&#xff0c;while\u5faa\u73af\u4e4b\u524d<\/span><br \/>\n<span class=\"token comment\">\/\/\u82e5\u8c03\u7528\u591a\u6b21\u914d\u7f6e\u5206\u7ec4\u7684\u4ee3\u7801&#xff0c;\u5219\u540e\u6267\u884c\u7684\u914d\u7f6e\u4f1a\u8986\u76d6\u5148\u6267\u884c\u7684\u914d\u7f6e<\/span><\/p>\n<p><span class=\"token comment\">\/*NVIC\u914d\u7f6e*\/<\/span><br \/>\nNVIC_InitTypeDef NVIC_InitStructure<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5b9a\u4e49\u7ed3\u6784\u4f53\u53d8\u91cf<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannel <span class=\"token operator\">&#061;<\/span> TIM2_IRQn<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u9009\u62e9\u914d\u7f6eNVIC\u7684TIM2\u7ebf<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelCmd <span class=\"token operator\">&#061;<\/span> ENABLE<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u4f7f\u80fd<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelPreemptionPriority <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u7684\u62a2\u5360\u4f18\u5148\u7ea7\u4e3a2<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelSubPriority <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u7684\u54cd\u5e94\u4f18\u5148\u7ea7\u4e3a1<\/span><br \/>\n<span class=\"token function\">NVIC_Init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&amp;<\/span>NVIC_InitStructure<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5c06\u7ed3\u6784\u4f53\u53d8\u91cf\u4ea4\u7ed9NVIC_Init&#xff0c;\u914d\u7f6eNVIC\u5916\u8bbe<\/span><\/p>\n<p><span class=\"token comment\">\/*TIM\u4f7f\u80fd*\/<\/span><br \/>\n<span class=\"token function\">TIM_Cmd<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u4f7f\u80fdTIM2&#xff0c;\u5b9a\u65f6\u5668\u5f00\u59cb\u8fd0\u884c<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/* \u5b9a\u65f6\u5668\u4e2d\u65ad\u51fd\u6570&#xff0c;\u53ef\u4ee5\u590d\u5236\u5230\u4f7f\u7528\u5b83\u7684\u5730\u65b9<br \/>\nvoid TIM2_IRQHandler(void)<br \/>\n{<br \/>\nif (TIM_GetITStatus(TIM2, TIM_IT_Update) &#061;&#061; SET)<br \/>\n{<\/p>\n<p>TIM_ClearITPendingBit(TIM2, TIM_IT_Update);<br \/>\n}<br \/>\n}<br \/>\n*\/<\/span><\/p>\n<p>\u5bf972MHz&#xff08;72000000Hz&#xff09;\u8fdb\u884c7200\u7684\u5206\u9891&#xff0c;\u5c31\u662f10KHz\u7684\u9891\u7387&#xff0c;\u4e5f\u5c31\u662f1\/10K s\u8bb0\u4e00\u6b21\u6570&#xff0c;\u90a3\u4e48\u8ba1\u657010000\u6b21\u4e0d\u5c31\u662f\u521a\u597d1s&#xff0c;\u6240\u4ee5\u8fd9\u4e2a\u65f6\u949f\u4e2d\u65ad\u662f\u6bcf1s\u7533\u8bf7\u4e00\u6b21\u4e2d\u65ad\u3002<\/p>\n<h4>2.4.2 \u5b9a\u65f6\u5668\u5916\u90e8\u4e2d\u65ad<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005635-6848d443484aa.jpg\" alt=\"img\" \/><\/p>\n<p>User&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;main.c<\/li>\n<\/ul>\n<p>Hardware&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;OLED_Font.h<\/li>\n<li>&#x1f4ce;OLED.c<\/li>\n<li>&#x1f4ce;OLED.h<\/li>\n<\/ul>\n<p>System&#xff1a;<\/p>\n<ul>\n<li>&#x1f4ce;Timer.h<\/li>\n<li>&#x1f4ce;Timer.c<\/li>\n<\/ul>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;stm32f10x.h&#034;<\/span>                  <span class=\"token comment\">\/\/ Device header<\/span><\/span><\/p>\n<p><span class=\"token comment\">\/**<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  * \u6ce8\u610f\u4e8b\u9879&#xff1a;\u6b64\u51fd\u6570\u914d\u7f6e\u4e3a\u5916\u90e8\u65f6\u949f&#xff0c;\u5b9a\u65f6\u5668\u76f8\u5f53\u4e8e\u8ba1\u6570\u5668<br \/>\n  *\/<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">Timer_Init<\/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 comment\">\/*\u5f00\u542f\u65f6\u949f*\/<\/span><br \/>\n<span class=\"token function\">RCC_APB1PeriphClockCmd<\/span><span class=\"token punctuation\">(<\/span>RCC_APB1Periph_TIM2<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5f00\u542fTIM2\u7684\u65f6\u949f<\/span><br \/>\n<span class=\"token function\">RCC_APB2PeriphClockCmd<\/span><span class=\"token punctuation\">(<\/span>RCC_APB2Periph_GPIOA<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5f00\u542fGPIOA\u7684\u65f6\u949f<\/span><\/p>\n<p><span class=\"token comment\">\/*GPIO\u521d\u59cb\u5316*\/<\/span><br \/>\nGPIO_InitTypeDef GPIO_InitStructure<span class=\"token punctuation\">;<\/span><br \/>\nGPIO_InitStructure<span class=\"token punctuation\">.<\/span>GPIO_Mode <span class=\"token operator\">&#061;<\/span> GPIO_Mode_IPU<span class=\"token punctuation\">;<\/span><br \/>\nGPIO_InitStructure<span class=\"token punctuation\">.<\/span>GPIO_Pin <span class=\"token operator\">&#061;<\/span> GPIO_Pin_0<span class=\"token punctuation\">;<\/span><br \/>\nGPIO_InitStructure<span class=\"token punctuation\">.<\/span>GPIO_Speed <span class=\"token operator\">&#061;<\/span> GPIO_Speed_50MHz<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">GPIO_Init<\/span><span class=\"token punctuation\">(<\/span>GPIOA<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>GPIO_InitStructure<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5c06PA0\u5f15\u811a\u521d\u59cb\u5316\u4e3a\u4e0a\u62c9\u8f93\u5165<\/span><\/p>\n<p><span class=\"token comment\">\/*\u5916\u90e8\u65f6\u949f\u914d\u7f6e*\/<\/span><br \/>\n<span class=\"token function\">TIM_ETRClockMode2Config<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> TIM_ExtTRGPSC_OFF<span class=\"token punctuation\">,<\/span> TIM_ExtTRGPolarity_NonInverted<span class=\"token punctuation\">,<\/span> <span class=\"token number\">0x0F<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u9009\u62e9\u5916\u90e8\u65f6\u949f\u6a21\u5f0f2&#xff0c;\u65f6\u949f\u4eceTIM_ETR\u5f15\u811a\u8f93\u5165<\/span><br \/>\n<span class=\"token comment\">\/\/\u6ce8\u610fTIM2\u7684ETR\u5f15\u811a\u56fa\u5b9a\u4e3aPA0&#xff0c;\u65e0\u6cd5\u968f\u610f\u66f4\u6539<\/span><br \/>\n<span class=\"token comment\">\/\/\u6700\u540e\u4e00\u4e2a\u6ee4\u6ce2\u5668\u53c2\u6570\u52a0\u5230\u6700\u59270x0F&#xff0c;\u53ef\u6ee4\u9664\u65f6\u949f\u4fe1\u53f7\u6296\u52a8<\/span><\/p>\n<p><span class=\"token comment\">\/*\u65f6\u57fa\u5355\u5143\u521d\u59cb\u5316*\/<\/span><br \/>\nTIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5b9a\u4e49\u7ed3\u6784\u4f53\u53d8\u91cf<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_ClockDivision <span class=\"token operator\">&#061;<\/span> TIM_CKD_DIV1<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\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<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_CounterMode <span class=\"token operator\">&#061;<\/span> TIM_CounterMode_Up<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8ba1\u6570\u5668\u6a21\u5f0f&#xff0c;\u9009\u62e9\u5411\u4e0a\u8ba1\u6570<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_Period <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8ba1\u6570\u5468\u671f&#xff0c;\u5373ARR\u7684\u503c<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_Prescaler <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u9884\u5206\u9891\u5668&#xff0c;\u5373PSC\u7684\u503c<\/span><br \/>\nTIM_TimeBaseInitStructure<span class=\"token punctuation\">.<\/span>TIM_RepetitionCounter <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u91cd\u590d\u8ba1\u6570\u5668&#xff0c;\u9ad8\u7ea7\u5b9a\u65f6\u5668\u624d\u4f1a\u7528\u5230<\/span><br \/>\n<span class=\"token function\">TIM_TimeBaseInit<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>TIM_TimeBaseInitStructure<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5c06\u7ed3\u6784\u4f53\u53d8\u91cf\u4ea4\u7ed9TIM_TimeBaseInit&#xff0c;\u914d\u7f6eTIM2\u7684\u65f6\u57fa\u5355\u5143<\/span><\/p>\n<p><span class=\"token comment\">\/*\u4e2d\u65ad\u8f93\u51fa\u914d\u7f6e*\/<\/span><br \/>\n<span class=\"token function\">TIM_ClearFlag<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> TIM_FLAG_Update<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6e05\u9664\u5b9a\u65f6\u5668\u66f4\u65b0\u6807\u5fd7\u4f4d<\/span><br \/>\n<span class=\"token comment\">\/\/TIM_TimeBaseInit\u51fd\u6570\u672b\u5c3e&#xff0c;\u624b\u52a8\u4ea7\u751f\u4e86\u66f4\u65b0\u4e8b\u4ef6<\/span><br \/>\n<span class=\"token comment\">\/\/\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<\/span><br \/>\n<span class=\"token comment\">\/\/\u5982\u679c\u4e0d\u4ecb\u610f\u6b64\u95ee\u9898&#xff0c;\u5219\u4e0d\u6e05\u9664\u6b64\u6807\u5fd7\u4f4d\u4e5f\u53ef<\/span><\/p>\n<p><span class=\"token function\">TIM_ITConfig<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> TIM_IT_Update<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5f00\u542fTIM2\u7684\u66f4\u65b0\u4e2d\u65ad<\/span><\/p>\n<p><span class=\"token comment\">\/*NVIC\u4e2d\u65ad\u5206\u7ec4*\/<\/span><br \/>\n<span class=\"token function\">NVIC_PriorityGroupConfig<\/span><span class=\"token punctuation\">(<\/span>NVIC_PriorityGroup_2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u914d\u7f6eNVIC\u4e3a\u5206\u7ec42<\/span><br \/>\n<span class=\"token comment\">\/\/\u5373\u62a2\u5360\u4f18\u5148\u7ea7\u8303\u56f4&#xff1a;0~3&#xff0c;\u54cd\u5e94\u4f18\u5148\u7ea7\u8303\u56f4&#xff1a;0~3<\/span><br \/>\n<span class=\"token comment\">\/\/\u6b64\u5206\u7ec4\u914d\u7f6e\u5728\u6574\u4e2a\u5de5\u7a0b\u4e2d\u4ec5\u9700\u8c03\u7528\u4e00\u6b21<\/span><br \/>\n<span class=\"token comment\">\/\/\u82e5\u6709\u591a\u4e2a\u4e2d\u65ad&#xff0c;\u53ef\u4ee5\u628a\u6b64\u4ee3\u7801\u653e\u5728main\u51fd\u6570\u5185&#xff0c;while\u5faa\u73af\u4e4b\u524d<\/span><br \/>\n<span class=\"token comment\">\/\/\u82e5\u8c03\u7528\u591a\u6b21\u914d\u7f6e\u5206\u7ec4\u7684\u4ee3\u7801&#xff0c;\u5219\u540e\u6267\u884c\u7684\u914d\u7f6e\u4f1a\u8986\u76d6\u5148\u6267\u884c\u7684\u914d\u7f6e<\/span><\/p>\n<p><span class=\"token comment\">\/*NVIC\u914d\u7f6e*\/<\/span><br \/>\nNVIC_InitTypeDef NVIC_InitStructure<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5b9a\u4e49\u7ed3\u6784\u4f53\u53d8\u91cf<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannel <span class=\"token operator\">&#061;<\/span> TIM2_IRQn<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u9009\u62e9\u914d\u7f6eNVIC\u7684TIM2\u7ebf<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelCmd <span class=\"token operator\">&#061;<\/span> ENABLE<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u4f7f\u80fd<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelPreemptionPriority <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u7684\u62a2\u5360\u4f18\u5148\u7ea7\u4e3a2<\/span><br \/>\nNVIC_InitStructure<span class=\"token punctuation\">.<\/span>NVIC_IRQChannelSubPriority <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5b9aNVIC\u7ebf\u8def\u7684\u54cd\u5e94\u4f18\u5148\u7ea7\u4e3a1<\/span><br \/>\n<span class=\"token function\">NVIC_Init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&amp;<\/span>NVIC_InitStructure<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u5c06\u7ed3\u6784\u4f53\u53d8\u91cf\u4ea4\u7ed9NVIC_Init&#xff0c;\u914d\u7f6eNVIC\u5916\u8bbe<\/span><\/p>\n<p><span class=\"token comment\">\/*TIM\u4f7f\u80fd*\/<\/span><br \/>\n<span class=\"token function\">TIM_Cmd<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">,<\/span> ENABLE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u4f7f\u80fdTIM2&#xff0c;\u5b9a\u65f6\u5668\u5f00\u59cb\u8fd0\u884c<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/**<br \/>\n  * \u51fd    \u6570&#xff1a;\u8fd4\u56de\u5b9a\u65f6\u5668CNT\u7684\u503c<br \/>\n  * \u53c2    \u6570&#xff1a;\u65e0<br \/>\n  * \u8fd4 \u56de \u503c&#xff1a;\u5b9a\u65f6\u5668CNT\u7684\u503c&#xff0c;\u8303\u56f4&#xff1a;0~65535<br \/>\n  *\/<\/span><br \/>\n<span class=\"token class-name\">uint16_t<\/span> <span class=\"token function\">Timer_GetCounter<\/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 keyword\">return<\/span> <span class=\"token function\">TIM_GetCounter<\/span><span class=\"token punctuation\">(<\/span>TIM2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8fd4\u56de\u5b9a\u65f6\u5668TIM2\u7684CNT<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/* \u5b9a\u65f6\u5668\u4e2d\u65ad\u51fd\u6570&#xff0c;\u53ef\u4ee5\u590d\u5236\u5230\u4f7f\u7528\u5b83\u7684\u5730\u65b9<br \/>\nvoid TIM2_IRQHandler(void)<br \/>\n{<br \/>\nif (TIM_GetITStatus(TIM2, TIM_IT_Update) &#061;&#061; SET)<br \/>\n{<\/p>\n<p>TIM_ClearITPendingBit(TIM2, TIM_IT_Update);<br \/>\n}<br \/>\n}<br \/>\n*\/<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.8k\u6b21\uff0c\u70b9\u8d5e40\u6b21\uff0c\u6536\u85cf45\u6b21\u3002\u4e07\u6587\u5e26\u4f60\u8ba4\u8bc6stm32f103\u7684TIM\u5b9a\u65f6\u5668\uff0c\u6db5\u76d6\u901a\u7528\u3001\u666e\u901a\u3001\u9ad8\u7ea7\u5b9a\u65f6\u5668\u5404\u90e8\u5206\u4ecb\u7ecd\uff08\u89e6\u53d1\u63a7\u5236\u5355\u4f4d\u3001\u8f93\u5165\u6355\u83b7\u5355\u5143\u3001\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u3001CNT\u8ba1\u6570\u5668\u3001ARR\u3001PSC\u706f\uff09\uff0c\u5e76\u8bb2\u89e3\u57fa\u672c\u4f7f\u7528\uff1a\u5305\u62ec\u7ed3\u6784\u4f53\u4ecb\u7ecd\u548c\u57fa\u672c\u5e38\u7528\u51fd\u6570\u4ecb\u7ecd\u3002_stm32 \u5b9a\u65f6\u5668\u4e2d\u65ad<\/p>\n","protected":false},"author":2,"featured_media":43177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[217,270,2903,219],"topic":[],"class_list":["post-43197","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-stm32","tag-270","tag-2903","tag-219"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \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\/43197.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.8k\u6b21\uff0c\u70b9\u8d5e40\u6b21\uff0c\u6536\u85cf45\u6b21\u3002\u4e07\u6587\u5e26\u4f60\u8ba4\u8bc6stm32f103\u7684TIM\u5b9a\u65f6\u5668\uff0c\u6db5\u76d6\u901a\u7528\u3001\u666e\u901a\u3001\u9ad8\u7ea7\u5b9a\u65f6\u5668\u5404\u90e8\u5206\u4ecb\u7ecd\uff08\u89e6\u53d1\u63a7\u5236\u5355\u4f4d\u3001\u8f93\u5165\u6355\u83b7\u5355\u5143\u3001\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u3001CNT\u8ba1\u6570\u5668\u3001ARR\u3001PSC\u706f\uff09\uff0c\u5e76\u8bb2\u89e3\u57fa\u672c\u4f7f\u7528\uff1a\u5305\u62ec\u7ed3\u6784\u4f53\u4ecb\u7ecd\u548c\u57fa\u672c\u5e38\u7528\u51fd\u6570\u4ecb\u7ecd\u3002_stm32 \u5b9a\u65f6\u5668\u4e2d\u65ad\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/43197.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-11T00:56:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005625-6848d4399abd0.gif\" \/>\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=\"11 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43197.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/43197.html\",\"name\":\"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-11T00:56:36+00:00\",\"dateModified\":\"2025-06-11T00:56:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/43197.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/43197.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43197.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3\"}]},{\"@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":"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \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\/43197.html","og_locale":"zh_CN","og_type":"article","og_title":"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.8k\u6b21\uff0c\u70b9\u8d5e40\u6b21\uff0c\u6536\u85cf45\u6b21\u3002\u4e07\u6587\u5e26\u4f60\u8ba4\u8bc6stm32f103\u7684TIM\u5b9a\u65f6\u5668\uff0c\u6db5\u76d6\u901a\u7528\u3001\u666e\u901a\u3001\u9ad8\u7ea7\u5b9a\u65f6\u5668\u5404\u90e8\u5206\u4ecb\u7ecd\uff08\u89e6\u53d1\u63a7\u5236\u5355\u4f4d\u3001\u8f93\u5165\u6355\u83b7\u5355\u5143\u3001\u8f93\u51fa\u6bd4\u8f83\u5355\u5143\u3001CNT\u8ba1\u6570\u5668\u3001ARR\u3001PSC\u706f\uff09\uff0c\u5e76\u8bb2\u89e3\u57fa\u672c\u4f7f\u7528\uff1a\u5305\u62ec\u7ed3\u6784\u4f53\u4ecb\u7ecd\u548c\u57fa\u672c\u5e38\u7528\u51fd\u6570\u4ecb\u7ecd\u3002_stm32 \u5b9a\u65f6\u5668\u4e2d\u65ad","og_url":"https:\/\/www.wsisp.com\/helps\/43197.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-11T00:56:36+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005625-6848d4399abd0.gif"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"11 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/43197.html","url":"https:\/\/www.wsisp.com\/helps\/43197.html","name":"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-11T00:56:36+00:00","dateModified":"2025-06-11T00:56:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/43197.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/43197.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/43197.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"stm32\u4e4bTIM\u5b9a\u65f6\u4e2d\u65ad\u8be6\u89e3"}]},{"@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\/43197","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=43197"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/43197\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/43177"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=43197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=43197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=43197"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=43197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}