{"id":108284,"date":"2026-09-21T14:40:52","date_gmt":"2026-09-21T06:40:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/108284.html"},"modified":"2026-09-21T14:40:52","modified_gmt":"2026-09-21T06:40:52","slug":"%e5%9f%ba%e4%ba%8e-stm32f103-%e6%a0%87%e5%87%86%e5%ba%93%e7%9a%84%e5%a4%9a%e6%a8%a1%e5%bc%8f%e4%bc%a0%e6%84%9f%e5%99%a8%e7%bb%88%e7%ab%af%ef%bc%88adc-%e4%b8%89%e9%80%9a%e9%81%93-%e6%bb%91%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/108284.html","title":{"rendered":"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09"},"content":{"rendered":"<p><span style=\"color:#a5a5a5\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u672c\u6587\u662f\u4e2a\u4eba\u7684STM32 \u6807\u51c6\u5e93\u7684\u81ea\u5b66\u8bb0\u5f55&#xff0c;\u4ee3\u7801\u53c2\u8003\u4e86 ST \u5b98\u65b9\u56fa\u4ef6\u5e93\u4f8b\u7a0b\u3001\u7f51\u4e0a\u5f00\u6e90\u9879\u76ee(\u6c5f\u534f\u79d1\u6280\u4e3a\u4e3b)\u4ee5\u53ca AI \u8f85\u52a9\u7684\u8ba8\u8bba&#xff0c;\u6240\u6709\u4ee3\u7801\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41&#xff0c;\u4e5f\u975e\u5e38\u5e0c\u671b\u5404\u4f4d\u5927\u4f6c\u80fd\u6307\u70b9\u4e00\u4e8c&#xff0c;\u611f\u8c22\u5404\u4f4d\u524d\u8f88\u7684\u5f00\u6e90\u5206\u4eab\u3002<\/span><\/p>\n<ul>\n<li>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E9%A1%B9%E7%9B%AE%E6%A6%82%E5%86%B5%EF%BC%9A-toc\" style=\"margin-left:0px\">\u4e00\u3001\u9879\u76ee\u6982\u51b5&#xff1a;<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84%E4%B8%8E%E5%9F%BA%E7%A1%80%E5%A4%96%E8%AE%BE-toc\" style=\"margin-left:0px\">\u4e8c\u3001\u7cfb\u7edf\u67b6\u6784\u4e0e\u57fa\u7840\u5916\u8bbe<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.1%20%E4%B8%BB%E5%BE%AA%E7%8E%AF%E4%B8%8E%E6%A8%A1%E5%9D%97%E5%88%92%E5%88%86-toc\" style=\"margin-left:40px\">\u00a02.1 \u4e3b\u5faa\u73af\u4e0e\u6a21\u5757\u5212\u5206<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2%C2%A0PWM%E8%B0%83%E5%85%89-toc\" style=\"margin-left:40px\">2.2\u00a0PWM\u8c03\u5149<\/p>\n<p id=\"%E4%B8%89%E3%80%81ADC%20%E4%B8%89%E9%80%9A%E9%81%93%E4%B8%8E%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%BB%A4%E6%B3%A2-toc\" style=\"margin-left:0px\">\u4e09\u3001ADC \u4e09\u901a\u9053\u4e0e\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2<\/p>\n<p id=\"3.1%20ADC%20%E4%B8%89%E9%80%9A%E9%81%93%E9%87%87%E9%9B%86-toc\" style=\"margin-left:40px\">3.1 ADC \u4e09\u901a\u9053\u91c7\u96c6<\/p>\n<p id=\"3.2%20%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%BB%A4%E6%B3%A2-toc\" style=\"margin-left:40px\">3.2 \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2<\/p>\n<p id=\"3.3%20%E7%94%B5%E4%BD%8D%E5%99%A8%EF%BC%88%E6%A8%A1%E5%BC%8F1%EF%BC%89-toc\" style=\"margin-left:40px\">3.3 \u7535\u4f4d\u5668&#xff08;\u6a21\u5f0f1&#xff09;<\/p>\n<p id=\"3.4%20%E7%83%AD%E6%95%8F%E7%94%B5%E9%98%BB%EF%BC%88%E6%A8%A1%E5%BC%8F2%EF%BC%89-toc\" style=\"margin-left:40px\">3.4 \u70ed\u654f\u7535\u963b&#xff08;\u6a21\u5f0f2&#xff09;<\/p>\n<p id=\"3.5%20%E5%85%89%E6%95%8F%E7%94%B5%E9%98%BB%EF%BC%88%E6%A8%A1%E5%BC%8F3%EF%BC%89-toc\" style=\"margin-left:40px\">3.5 \u5149\u654f\u7535\u963b&#xff08;\u6a21\u5f0f3&#xff09;<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E6%8C%89%E9%94%AE%E3%80%81%E4%B8%B2%E5%8F%A3%E6%97%A5%E5%BF%97%E4%B8%8E%E7%9C%8B%E9%97%A8%E7%8B%97-toc\" style=\"margin-left:0px\">\u56db\u3001\u6309\u952e\u3001\u4e32\u53e3\u65e5\u5fd7\u4e0e\u770b\u95e8\u72d7<\/p>\n<p id=\"4.1%20%E6%8C%89%E9%94%AE-toc\" style=\"margin-left:40px\">4.1 \u6309\u952e<\/p>\n<p id=\"4.2%20%E4%B8%B2%E5%8F%A3%E6%97%A5%E5%BF%97-toc\" style=\"margin-left:40px\">4.2 \u4e32\u53e3\u65e5\u5fd7<\/p>\n<p id=\"4.3%20%E7%9C%8B%E9%97%A8%E7%8B%97-toc\" style=\"margin-left:40px\">4.3 \u770b\u95e8\u72d7<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E5%8A%9F%E8%83%BD%E6%BC%94%E7%A4%BA-toc\" style=\"margin-left:0px\">\u4e94\u3001\u529f\u80fd\u6f14\u793a<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E5%8A%9F%E8%83%BD%E6%BC%94%E7%A4%BA-toc\" style=\"margin-left:0px\">\u516d\u3001\u8e29\u5751\u8bb0\u5f55\u4e0e\u603b\u7ed3<\/p>\n<hr id=\"hr-toc\" \/>\n<\/p>\n<h2 id=\"%E4%B8%80%E3%80%81%E9%A1%B9%E7%9B%AE%E6%A6%82%E5%86%B5%EF%BC%9A\">\u4e00\u3001\u9879\u76ee\u6982\u51b5&#xff1a;<\/h2>\n<\/li>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u672c\u6b21\u9879\u76ee\u4f7f\u7528\u7684\u662fSTM32F103C8T6 &#043;\u00a0\u6807\u51c6\u5e93\u5916\u8bbe\u5e93&#xff0c;\u505a\u4e86\u4e00\u4e2a\u80fd\u91c7\u6837\u4e09\u79cd\u6a21\u62df\u91cf&#xff0c;\u4e09\u79cd\u6a21\u5f0f\u5206\u522b\u4f7f\u7528\u5176\u4e2d\u7684\u4e00\u8def\u6570\u636e\u3001\u5e26\u770b\u95e8\u72d7\u7684\u91c7\u96c6\u7cfb\u7edf\u3002<\/p>\n<p>\u8981\u4f7f\u7528\u6a21\u5757\u6709&#xff1a;<\/p>\n<table align=\"center\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u4f20\u611f\u5668<\/td>\n<td style=\"text-align:center\">\u5bf9\u5e94\u7684\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u7535\u4f4d\u5668<\/td>\n<td style=\"text-align:center\">\u8c03\u8282PWM\u5360\u6bd4&#xff0c;\u63a7\u5236LED\u7684\u4eae\u5ea6&#xff08;\u5bf9\u5e94\u6a21\u5f0f1&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u70ed\u654f\u7535\u963b<\/td>\n<td style=\"text-align:center\">\u6e29\u5ea6\u8d85\u9608\u503c&#xff08;\u6bd4\u5982 &gt;30\u00b0C&#xff09;\u8702\u9e23\u5668\u62a5\u8b66&#xff08;\u5bf9\u5e94\u6a21\u5f0f2&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5149\u654f\u7535\u963b<\/td>\n<td style=\"text-align:center\">\u5149\u7167\u4f4e\u4e8e\u9608\u503c&#xff0c;\u81ea\u52a8\u70b9\u4eae LED&#xff08;\u5bf9\u5e94\u6a21\u5f0f3&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6709\u6e90\u8702\u9e23\u5668<\/td>\n<td style=\"text-align:center\">\u62a5\u8b66\u54cd\u5e94<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6309\u952e<\/td>\n<td style=\"text-align:center\">\u5207\u6362\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">LED x 3<\/td>\n<td>\n<p style=\"text-align:center\">PWM\u8c03\u5149\u5bf9\u8c61<\/p>\n<p style=\"text-align:center\">\u8702\u9e23\u5668\u6307\u793a&#xff08;\u6e29\u5ea6\u62a5\u8b66\u65f6\u706d&#xff09;<\/p>\n<p style=\"text-align:center\">\u591c\u706f&#xff08;\u5149\u7167\u4f4e\u4e8e\u9608\u503c\u65f6\u4eae&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u63a5\u7ebf\u56fe\u5982\u4e0b\u56fe\u6240\u793a&#xff1a;<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260921064047-6ab0d16f42e3d.png\" \/><\/p>\n<p>\u672c\u9879\u76ee\u5f00\u53d1\u73af\u5883\u4e3a&#xff1a;<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u5f00\u53d1\u73af\u5883<\/td>\n<td style=\"text-align:center\">\u578b\u53f7<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5f00\u53d1\u677f<\/td>\n<td style=\"text-align:center\">\u91ce\u706b_STM32F103C8T6\u6838\u5fc3\u677f<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u56fa\u4ef6\u5e93<\/td>\n<td style=\"text-align:center\">\u6807\u51c6\u5916\u8bbe\u5e93SPL V3.5.0\u7248\u672c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5de5\u5177\u94fe<\/td>\n<td style=\"text-align:center\">STM32CubeIDE &#043; GCC<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2 id=\"%E4%BA%8C%E3%80%81%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84%E4%B8%8E%E5%9F%BA%E7%A1%80%E5%A4%96%E8%AE%BE\">\u4e8c\u3001\u7cfb\u7edf\u67b6\u6784\u4e0e\u57fa\u7840\u5916\u8bbe<\/h2>\n<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.1%20%E4%B8%BB%E5%BE%AA%E7%8E%AF%E4%B8%8E%E6%A8%A1%E5%9D%97%E5%88%92%E5%88%86\">\u00a02.1 \u4e3b\u5faa\u73af\u4e0e\u6a21\u5757\u5212\u5206<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0main.c\u4e3b\u51fd\u6570\u4e0e\u4e0eTIM3\u5b9a\u65f6\u5668\u4e2d\u65ad\u670d\u52a1\u51fd\u6570\u5177\u4f53\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>#include &lt;stdint.h&gt;<br \/>\n#include &#034;stm32f10x.h&#034;<br \/>\n#include &#034;stm32f10x_conf.h&#034;<br \/>\n#include &#034;stdio.h&#034;<\/p>\n<p>#include &#034;LED.h&#034;<br \/>\n#include &#034;Timer.h&#034;<br \/>\n#include &#034;KEY.h&#034;<br \/>\n#include &#034;Delay.h&#034;<br \/>\n#include &#034;ADC.h&#034;<br \/>\n#include &#034;UART.h&#034;<br \/>\n#include &#034;IWDG.h&#034;<\/p>\n<p>#define FEATURE_COUNT3\/\/\u6a21\u5f0f\u603b\u6570<br \/>\n#define NEXT_FEATURE(Mode_Num &#043; 1)\/\/\u5207\u6362\u4e0b\u4e00\u4e2a\u6a21\u5f0f<br \/>\n#define FIRST_FEATURE1\/\/\u8fd4\u56de\u7b2c\u4e00\u4e2a\u6a21\u5f0f<br \/>\n#define KEY_SCAN_MS     10\/\/\u6309\u952e\u626b\u63cf\u5468\u671f<br \/>\n#defineLOG_REFRESH_MS  2000\/\/\u65e5\u5fd7\u5237\u65b0\u5468\u671f<br \/>\n#define RISING_EDGE1\/\/\u6309\u4e0b\u6309\u94ae\u4ea7\u751f\u4e0a\u5347\u6cbf\u6807\u5fd7\u4f4d<\/p>\n<p>#if !defined(__SOFT_FP__) &amp;&amp; defined(__ARM_FP)<br \/>\n  #warning &#034;FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use.&#034;<br \/>\n#endif<\/p>\n<p>const char *IWDG_String &#061; &#034;\\\\n\u7cfb\u7edf\u5361\u6b7b&#xff0c;\u6b63\u5728\u91cd\u542f\\\\n&#034;;\/\/\u5b58\u653e\u7cfb\u7edf\u5361\u6b7b\u8f93\u51fa\u5b57\u7b26<br \/>\nADC_Value Read_Value;\/\/\u5b58\u653e\u4e09\u4e2a\u4f20\u611f\u5668\u8f93\u51fa\u6570\u503c<br \/>\nvolatile uint8_t Log_Refresh_SW &#061; 1;\/\/\u521d\u59cb\u5316\u65e5\u5fd7\u5237\u65b0\u6807\u5fd7\u4f4d<br \/>\nstatic uint8_t Key_Status; \/\/\u6309\u952e\u4e8b\u4ef6\u72b6\u6001<br \/>\nstatic uint8_t Mode_Num &#061; 1;\/\/\u5f53\u524d\u6a21\u5f0f&#xff0c;\u521d\u503c 1<\/p>\n<p>int main(void)<br \/>\n{<\/p>\n<p>\/\/\u521d\u59cb\u5316\u5bf9\u5e94\u5916\u8bbe<br \/>\nLED_Init();<br \/>\nTimer_Init();<br \/>\nKey_Init();<br \/>\nADC_INIT();<br \/>\nUART_Init();<br \/>\nIWDG_Init();<\/p>\n<p>\/*\u5224\u65ad\u770b\u95e8\u72d7\u91cd\u542f\u6807\u5fd7\u4f4d&#xff0c;\u770b\u662f\u4e0d\u662f\u770b\u95e8\u72d7\u91cd\u542f*\/<br \/>\nif(RCC_GetFlagStatus(RCC_FLAG_IWDGRST) &#061;&#061; SET)<br \/>\n{<br \/>\nUART_SendString((uint8_t*)IWDG_String);<br \/>\nRCC_ClearFlag();\/\/\u6e05\u7a7a\u6807\u5fd7\u4f4d<br \/>\n}<\/p>\n<p>while(1)<br \/>\n{<br \/>\nIWDG_ReloadCounter();\/\/\u5582\u72d7<br \/>\nIWDG_Test();\/\/\u6309\u952e&#xff08;PC13&#xff09;\u963b\u585e\u7a0b\u5e8f&#xff0c;\u9a8c\u8bc1\u770b\u95e8\u72d7\u529f\u80fd\u662f\u5426\u5728\u5de5\u4f5c<\/p>\n<p>\/\/\u4e00\u5708\u53ea\u91c7\u4e00\u6b21&#xff0c;\u540e\u7eed\u590d\u7528&#xff0c;\u907f\u514d\u6ee4\u6ce2\u7a97\u53e3\u88ab\u91cd\u590d\u63a8\u8fdb<br \/>\nKey_Status &#061; Key_GetKeyNum();<br \/>\nRead_Value.Pot   &#061; Pot_GetValue();<br \/>\nRead_Value.Temp  &#061;Temp_GetValue();<br \/>\nRead_Value.Light &#061; Light_GetValue();<\/p>\n<p>if(Key_Status &#061;&#061; RISING_EDGE)\/\/\u5f53\u68c0\u6d4b\u5230\u6309\u952e\u5904\u4e8e\u4e0a\u5347\u6cbf\u65f6<br \/>\nMode_Num &#061; (Mode_Num &lt; FEATURE_COUNT) ? NEXT_FEATURE : FIRST_FEATURE;<\/p>\n<p>\/\/\u6a21\u5f0f\u9009\u62e9<br \/>\nswitch(Mode_Num)<br \/>\n{<br \/>\n\/*\u7535\u4f4d\u5668\u8c03\u5149\u6a21\u5f0f*\/<br \/>\ncase Pot_Mode:GPIO_SetBits(GPIOA,GPIO_Pin_3);\/\/\u5173\u95ed\u5149\u654f\u591c\u706f\u6a21\u5f0f\u7684LED<br \/>\nTIM_SetCompare2(TIM2, Read_Value.Pot);\/\/\u63a7\u5236\u5bf9\u5e94LED\u7684PWM\u5360\u7a7a\u6bd4\u6765\u63a7\u5236\u4eae\u5ea6<br \/>\nbreak;<br \/>\n\/*\u6e29\u5ea6\u62a5\u8b66\u6a21\u5f0f*\/<br \/>\ncase Temp_Mode:if(Read_Value.Temp &gt;&#061; TEMP_WARNING_VALUE)\/\/\u5224\u65ad\u662f\u5426\u9ad8\u4e8e\u9884\u8bbe\u503c<br \/>\nGPIO_SetBits(GPIOA,GPIO_Pin_2);\/\/\u8702\u9e23\u5668\u54cd<br \/>\nelse<br \/>\nGPIO_ResetBits(GPIOA,GPIO_Pin_2);\/\/\u8702\u9e23\u5668\u4e0d\u54cd<br \/>\nbreak;<br \/>\n\/*\u5149\u654f\u591c\u706f\u6a21\u5f0f*\/<br \/>\ncase Light_Mode:GPIO_ResetBits(GPIOA,GPIO_Pin_2);\/\/\u5207\u51fa\u6e29\u5ea6\u62a5\u8b66\u6a21\u5f0f\u65f6\u5173\u95ed\u8702\u9e23\u5668<br \/>\nif(Read_Value.Light &lt; MINIMUM_BRIGHT_VALUE)\/\/\u5224\u65ad\u4eae\u5ea6\u662f\u5426\u4f4e\u4e8e\u9884\u8bbe\u503c<br \/>\nGPIO_ResetBits(GPIOA,GPIO_Pin_3);\/\/\u5f00\u706f<br \/>\nelse<br \/>\nGPIO_SetBits(GPIOA,GPIO_Pin_3);\/\/\u5173\u706f<br \/>\nbreak;<br \/>\n}<\/p>\n<p>UART_Log_Display(&amp;Log_Refresh_SW, Mode_Num, &amp;Read_Value);\/\/\u4e32\u53e3\u65e5\u5fd7\u663e\u793a\u7cfb\u7edf\u7684\u72b6\u6001\u4e0e\u4fe1\u606f<br \/>\n}<br \/>\n}<\/p>\n<p>\/* 1ms \u4e2d\u65ad&#xff1a;\u6309\u952e\u626b\u63cf &#043; \u65e5\u5fd7\u5237\u65b0\u6807\u5fd7 *\/<br \/>\nvoid TIM3_IRQHandler(void)<br \/>\n{<br \/>\nstatic uint16_t con_1 &#061; 0;\/\/\u6309\u952e\u626b\u63cf\u5468\u671f\u8ba1\u65f6<br \/>\nstatic uint16_t con_2 &#061; 0;\/\/\u4e32\u53e3\u65e5\u5fd7\u5237\u65b0\u5468\u671f\u8ba1\u65f6<br \/>\nif(TIM_GetITStatus(TIM3, TIM_IT_Update) &#061;&#061; SET)<br \/>\n{<br \/>\ncon_1&#043;&#043;;<br \/>\ncon_2&#043;&#043;;<br \/>\nif(con_1 &gt;&#061; KEY_SCAN_MS)<br \/>\n{<br \/>\nKey_Scan();<br \/>\ncon_1 &#061; 0;<br \/>\n}<\/p>\n<p>if(con_2 &gt;&#061; LOG_REFRESH_MS)<br \/>\n{<br \/>\nLog_Refresh_SW &#061; 1;\/\/\u7f6e\u4e32\u53e3\u65e5\u5fd7\u5237\u65b0\u6807\u5fd7<br \/>\ncon_2 &#061; 0;<br \/>\n}<\/p>\n<p>}<br \/>\nTIM_ClearITPendingBit(TIM3, TIM_IT_Update);\/\/\u6e05\u7a7a\u5b9a\u65f6\u5668\u4e2d\u65ad\u6807\u5fd7\u4f4d<br \/>\n}<\/p>\n<p>main.c\u4e3b\u51fd\u6570\u6d41\u7a0b\u56fe\u5982\u56fe\u4e0b\u6240\u793a&#xff1a;<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260921064050-6ab0d172d2e6f.png\" \/><\/p>\n<p>\u6a21\u5757\u804c\u8d23\u8868&#xff0c;\u5982\u4e0b\u8868\u6240\u793a&#xff1a;<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u6587\u4ef6<\/td>\n<td style=\"text-align:center\">\u804c\u8d23<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">LED.c<\/td>\n<td style=\"text-align:center\">PWM \u8f93\u51fa &#043; \u4e09\u4e2aGPIO<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">ADC.c<\/td>\n<td style=\"text-align:center\">\u4e09\u901a\u9053\u91c7\u6837\u3001\u6ed1\u52a8\u5e73\u5747\u3001\u6570\u503c\u6362\u7b97<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">KEY.c<\/td>\n<td style=\"text-align:center\">\u6309\u952e\u626b\u63cf\u4e0e\u6309\u952e\u4e8b\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Timer.c<\/td>\n<td style=\"text-align:center\">1ms\u65f6\u57fa<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">UART.c<\/td>\n<td style=\"text-align:center\">\u72b6\u6001\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">IWDG.c<\/td>\n<td style=\"text-align:center\">\u770b\u95e8\u72d7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e09\u4e2a\u8bbe\u8ba1\u70b9&#xff1a;<\/p>\n<p><span style=\"background-color:null\">1.\u5582\u72d7\u4e3a\u4ec0\u4e48\u653e\u5728\u5faa\u73af\u7684\u5f00\u5934&#xff1a;<\/span> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5582\u72d7\u653e\u5728\u4e3b\u5faa\u73af\u5f00\u5934&#xff0c;\u4fdd\u8bc1\u6bcf\u8f6e\u5faa\u73af\u90fd\u5237\u65b0\u8ba1\u6570\u5668&#xff0c;\u5582\u72d7\u5468\u671f &#061; \u5faa\u73af\u5468\u671f&#xff1b; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"background-color:null\">2.\u4e00\u5708\u91c7\u6837\u4e00\u6b21\u4f20\u611f\u5668\u6570\u503c&#xff1a;<\/span> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e4b\u524d\u5199\u7684\u65f6\u5019case\u91c7\u96c6\u4e00\u6b21\u3001\u65e5\u5fd7\u663e\u793a\u91c7\u96c6\u4e00\u6b21&#xff0c;\u91c7\u96c6\u6b21\u6570\u8fc7\u591a\u6ed1\u52a8\u6ee4\u6ce2\u5931\u6548\u4e86&#xff0c;\u6240\u4ee5\u653e\u5728switch\u5224\u65ad\u8bed\u53e5\u4e4b\u524d\u53ea\u91c7\u6837\u4e00\u6b21&#xff1b;  <span style=\"color:null\"><span style=\"background-color:null\">\u00a03.\u65e5\u5fd7\u4e3a\u4ec0\u4e48\u7528\u6807\u5fd7\u4f4d\u9a71\u52a8&#xff1a;<\/span><\/span> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e4b\u524d\u4f7f\u7528\u5ef6\u65f6\u963b\u585e\u6765\u63a7\u5236\u4e32\u53e3\u65e5\u5fd7\u7684\u5237\u65b0\u9891\u7387&#xff0c;\u4f46\u5bfc\u81f4\u4e86\u4f20\u611f\u5668\u91c7\u6837\u9891\u7387\u592a\u4f4e&#xff0c;\u7531\u4e8e\u4f7f\u7528\u7684\u662f\u6ed1\u52a8\u6ee4\u6ce2\u7684\u539f\u56e0&#xff0c;\u6ed1\u52a8\u7a97\u53e3\u8981 8 \u6b21\u65b0\u91c7\u6837\u624d\u80fd\u5b8c\u5168\u66f4\u65b0\u5bfc\u81f4\u6ee4\u6ce2\u540e\u7684\u6570\u503c\u5c31\u8981\u7b49\u6570\u5341\u79d2\u624d\u80fd\u8ddf\u4e0a\u5b9e\u9645\u53d8\u5316&#xff0c;\u6539\u6210\u5b9a\u65f6\u5668\u4e2d\u65ad\u7f6e\u6807\u5fd7\u4f4d\u540e&#xff0c;\u91c7\u6837\u4e0d\u518d\u88ab\u4e32\u53e3\u53d1\u9001\u963b\u585e\u3002<\/p>\n<hr \/>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2%C2%A0PWM%E8%B0%83%E5%85%89\">2.2\u00a0PWM\u8c03\u5149<\/h3>\n<\/p>\n<p>\u8981\u6c42&#xff1a;\u672c\u9879\u76ee\u7684\u6a21\u5f0f 1 \u662f\u7535\u4f4d\u5668\u8c03\u8282LED\u7684\u4eae\u5ea6&#xff0c;\u6a21\u5f0f\u8be5\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);<br \/>\n    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);<\/p>\n<p>    GPIO_InitStructure.GPIO_Mode &#061; GPIO_Mode_AF_PP;<br \/>\n    GPIO_InitStructure.GPIO_Pin &#061; GPIO_Pin_1;<br \/>\n    GPIO_InitStructure.GPIO_Speed &#061; GPIO_Speed_10MHz;<br \/>\n    GPIO_Init(GPIOA, &amp;GPIO_InitStructure);<\/p>\n<p>        TIM_TimeBaseInitStruct.TIM_ClockDivision &#061; TIM_CKD_DIV1;<br \/>\n    TIM_TimeBaseInitStruct.TIM_CounterMode &#061; TIM_CounterMode_Up;<br \/>\n    TIM_TimeBaseInitStruct.TIM_Period &#061; 1000 &#8211; 1;<br \/>\n    TIM_TimeBaseInitStruct.TIM_Prescaler &#061; 72 &#8211; 1;<br \/>\n    TIM_TimeBaseInit(TIM2, &amp;TIM_TimeBaseInitStruct);<\/p>\n<p>    TIM_OCInitStruct.TIM_OCIdleState &#061; TIM_OCIdleState_Set;<br \/>\n    TIM_OCInitStruct.TIM_OCMode &#061; TIM_OCMode_PWM1;<br \/>\n    TIM_OCInitStruct.TIM_OCNIdleState  &#061; TIM_OCNIdleState_Set;<br \/>\n    TIM_OCInitStruct.TIM_OCNPolarity &#061; TIM_OCNPolarity_High;<br \/>\n    TIM_OCInitStruct.TIM_OCPolarity &#061; TIM_OCPolarity_High;<br \/>\n    TIM_OCInitStruct.TIM_OutputNState &#061; TIM_OutputNState_Disable;<br \/>\n    TIM_OCInitStruct.TIM_OutputState &#061; TIM_OutputState_Enable;<br \/>\n    TIM_OCInitStruct.TIM_Pulse &#061; 50;<\/p>\n<p>    TIM_OC2Init(TIM2, &amp;TIM_OCInitStruct);<br \/>\n    TIM_Cmd(TIM2, ENABLE); <\/p>\n<p>\u914d\u7f6e\u8fc7\u7a0b\u9047\u5230\u7684\u5751&#xff1a;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5751\u4e00&#xff1a;\u914d\u7f6e TIM2 \u7684 RCC \u65f6\u949f\u65f6&#xff0c;\u628a\u603b\u7ebf\u9009\u6210\u4e86 APB2&#xff0c;\u7f16\u8bd1\u76f4\u63a5\u9519&#xff0c;\u540e\u9762\u770b\u4e86\u4e00\u4e0bSTM32\u7684\u6570\u636e\u624b\u518c\u624d\u5f97\u77e5TIM2\u662f\u6302\u5728APB1\u603b\u7ebf\u4e0a\u7684\u3002<\/p>\n<p>\/\/RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM2, ENABLE);    \/\/\u9519\u8bef\u914d\u7f6e&#xff1a;      error: &#039;RCC_APB2Periph_TIM2&#039; undeclared<br \/>\nRCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);      \/\/\u6b63\u786e\u914d\u7f6e<br \/>\n    \/* TIM1\u3001TIM8 \u6302 APB2&#xff1b;TIM2~TIM7 \u6302 APB1 *\/ <\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5751\u4e8c&#xff1a;\u4f7f\u7528TIM_SetCompare1\u51fd\u6570\u8c03\u8282LED\u7684\u4eae\u5ea6&#xff0c;\u8c03\u4e86\u534a\u5929\u53d1\u73b0\u4eae\u5ea6\u4e0d\u53d8&#xff0c;\u540e\u9762\u7ffb\u8d44\u6599\u540e\u786e\u8ba4\u540e<span style=\"color:#0d0016\">\u624d\u5f97\u77e5,TIM2_CH2\u8981\u4f7f<\/span>TIM_SetCompare2\u6765\u8fdb\u884c\u8c03\u8282&#xff0c;TIM_SetCompare1 \u6539\u7684\u662f CH1 \u7684 CCR&#xff0c;\u800c PA1 \u8f93\u51fa\u7684\u662f CH2\u7684\u6ce2\u5f62&#xff0c;\u4e24\u8005\u4e0d\u76f8\u5e72\u3002<\/p>\n<p>            \/\/TIM_SetCompare1(TIM2, Read_Value.Pot);   \/\/\u9519\u8bef\u914d\u7f6e<br \/>\n            TIM_SetCompare2(TIM2, Read_Value.Pot);     \/\/\u6b63\u786e\u914d\u7f6e <\/p>\n<h2 id=\"%E4%B8%89%E3%80%81ADC%20%E4%B8%89%E9%80%9A%E9%81%93%E4%B8%8E%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%BB%A4%E6%B3%A2\">\u4e09\u3001ADC \u4e09\u901a\u9053\u4e0e\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2<\/h2>\n<h3 id=\"3.1%20ADC%20%E4%B8%89%E9%80%9A%E9%81%93%E9%87%87%E9%9B%86\">3.1 ADC \u4e09\u901a\u9053\u91c7\u96c6<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u91c7\u96c6\u4e09\u901a\u9053\u6570\u636e&#xff0c;\u5f15\u811a\u5206\u522b\u662f&#xff1a;PA4&#xff08;\u7535\u4f4d\u5668&#xff09;\u3001PA5&#xff08;\u70ed\u654f&#xff09;\u3001PA6&#xff08;\u5149\u654f&#xff09;&#xff0c;\u914d\u7f6e\u7a0b\u5e8f\u5982\u4e0b&#xff1a;<\/p>\n<p>void ADC_INIT(void)<br \/>\n{<br \/>\nADC_InitTypeDef ADC_InitStruct;<br \/>\nGPIO_InitTypeDef GPIO_InitStruct;<\/p>\n<p>RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);<br \/>\nRCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);<\/p>\n<p>\/\/ADC \u65f6\u949f &#061; 72MHz \/ 6 &#061; 12MHz&#xff08;F103 \u4e0a\u9650 14MHz&#xff09;<br \/>\nRCC_ADCCLKConfig(RCC_PCLK2_Div6);<\/p>\n<p>GPIO_InitStruct.GPIO_Mode &#061; GPIO_Mode_AIN;<\/p>\n<p>\/*PA4\u63a5\u7535\u4f4d\u5668\u3001PA5\u63a5\u70ed\u654f\u4f20\u611f\u5668\u3001PA6\u63a5\u5149\u654f\u4f20\u611f\u5668*\/<br \/>\nGPIO_InitStruct.GPIO_Pin &#061; GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6;<br \/>\nGPIO_InitStruct.GPIO_Speed &#061; GPIO_Speed_10MHz;<br \/>\nGPIO_Init(GPIOA, &amp;GPIO_InitStruct);<\/p>\n<p>ADC_InitStruct.ADC_Mode &#061; ADC_Mode_Independent;<br \/>\nADC_InitStruct.ADC_ScanConvMode &#061; DISABLE;<br \/>\nADC_InitStruct.ADC_ContinuousConvMode &#061; DISABLE;<br \/>\nADC_InitStruct.ADC_ExternalTrigConv &#061; ADC_ExternalTrigConv_None;<br \/>\nADC_InitStruct.ADC_DataAlign &#061; ADC_DataAlign_Right;<br \/>\nADC_InitStruct.ADC_NbrOfChannel &#061; 1;<br \/>\nADC_Init(ADC1, &amp;ADC_InitStruct);<\/p>\n<p>ADC_Cmd(ADC1, ENABLE);<\/p>\n<p>\/*ADC\u6821\u51c6\u8fc7\u7a0b*\/<br \/>\nADC_ResetCalibration(ADC1);<br \/>\nwhile(ADC_GetResetCalibrationStatus(ADC1) &#061;&#061; SET);\/\/\u7b49\u5f85\u590d\u4f4d\u5b8c\u6210<br \/>\nADC_StartCalibration(ADC1);<br \/>\nwhile(ADC_GetCalibrationStatus(ADC1) &#061;&#061; SET);\/\/\u7b49\u5f85\u6821\u51c6\u5b8c\u6210<\/p>\n<p>\/* \u6ed1\u52a8\u7a97\u53e3\u957f\u5ea6 8&#xff0c;\u9884\u586b\u5145\u907f\u514d\u5f00\u673a\u524d 7 \u6b21\u88ab 0 \u62c9\u504f *\/<br \/>\nfor(uint8_t i &#061; 0; i &lt; 8; i&#043;&#043;)<br \/>\n{<br \/>\nPot_GetValue();<br \/>\nTemp_GetValue();<br \/>\nLight_GetValue();<br \/>\n}<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\"><span style=\"background-color:#d7d8d9\">\u4e09\u4e2a\u914d\u7f6e\u9009\u62e9&#xff1a;<\/span><\/span>  1. ADC \u65f6\u949f\u53d6 12MHz \u2014\u2014 ADC \u65f6\u949f\u4e0a\u9650 14MHz&#xff0c;72\u00f76 \u662f\u591f\u7528\u53c8\u4e0d\u8d85\u7684\u53d6\u6cd5;<\/p>\n<\/p>\n<p>2. \u5355\u901a\u9053\u8f6e\u8be2\u800c\u975e\u626b\u63cf\u6a21\u5f0f \u2014\u2014 \u4e09\u8def\u6570\u636e\u540e\u7eed\u8981\u5206\u522b\u6362\u7b97&#xff08;\u67e5\u8868\u3001\u5f52\u4e00\u5316&#xff09;&#xff0c; \u8f6e\u8be2\u66f4\u76f4\u89c2\u91c7\u6837\u9891\u7387\u4e5f\u8fdc\u9ad8\u4e8e\u9700\u6c42;<\/p>\n<\/p>\n<p>3. \u521d\u59cb\u5316\u672b\u5c3e\u9884\u586b\u5145 8 \u6b21 \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u957f\u5ea6\u662f 8&#xff0c;\u4e0d\u9884\u586b\u5145\u7684\u8bdd\u5f00\u673a\u524d 7 \u6b21 \u7a97\u53e3\u91cc\u6b8b\u7559 0&#xff0c;\u8f93\u51fa\u88ab\u62c9\u504f;<\/p>\n<h3 id=\"3.2%20%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%BB%A4%E6%B3%A2\">3.2 \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7531\u4e8eADC\u539f\u59cb\u6570\u503c\u4f1a\u56e0\u4e3a\u7535\u6e90\u566a\u58f0\u3001\u53c2\u8003\u7535\u538b\u6ce2\u52a8\u6216\u8005\u91c7\u6837\u65f6\u523b\u7684\u4e0d\u540c\u800c\u5bfc\u81f4\u6709\u6296\u52a8&#xff0c;\u4e3a\u4e86\u8f93\u51fa\u6570\u636e\u7a33\u5b9a\u4e14\u4e0d\u727a\u7272\u592a\u591a\u54cd\u5e94\u901f\u5ea6&#xff0c;\u91c7\u7528\u4e86\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2&#xff0c;\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2\u51fd\u6570<br \/>\n  * &#064;param  Filter_value&#xff1a;\u5bf9\u5e94\u7684\u91c7\u6837\u6570\u7ec4\u6307\u9488&#xff0c;Value&#xff1a;\u66f4\u65b0\u7684\u6570\u636e<br \/>\n  * &#064;retval \u8f93\u5165\u503c\u7684 8 \u70b9\u5e73\u5747\u503c<br \/>\n  * &#064;note   \u4f7f\u6bcf\u4e2a\u4f20\u611f\u5668\u8f93\u51fa\u7684\u503c\u66f4\u7a33\u5b9a<br \/>\n  *\/<br \/>\nuint16_t Moving_Average(uint16_t *Filter_value, uint16_t Value)<br \/>\n{<br \/>\nint8_t i;<br \/>\nuint16_tsum &#061; 0;<\/p>\n<p>for(i &#061; 0; i &lt; 7; i&#043;&#043;)<br \/>\n{<br \/>\n\/\/\u6b63\u5e8f\u642c&#xff1a;\u5f80\u4f4e\u5730\u5740\u642c\u5fc5\u987b\u4ece\u524d\u5f80\u540e<br \/>\nFilter_value[i] &#061; Filter_value[i &#043; 1];<br \/>\n}<\/p>\n<p>Filter_value[7] &#061; Value;<\/p>\n<p>for(i &#061; 0; i &lt; 8; i&#043;&#043;)<br \/>\n{<br \/>\nsum &#043;&#061; Filter_value[i];<br \/>\n}<\/p>\n<p>return (sum \/ 8);<br \/>\n}<\/p>\n<p>\u00a0\u4ee3\u7801\u7684\u5de5\u4f5c\u539f\u7406&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6570\u7ec4\u4f1a\u50a8\u5b58\u6700\u8fd18\u6b21\u7684\u6570\u503c&#xff0c;\u628a\u524d 7 \u4e2a\u5143\u7d20\u6574\u4f53\u5de6\u79fb\u4e00\u683c&#xff0c;\u6700\u4e45\u7684\u7b2c 1 \u4f4d\u7684\u6570\u503c\u5c31\u4f1a\u88ab\u6324\u6389&#xff0c;\u65b0\u503c\u4f1a\u653e\u5728\u6570\u503c\u7b2c 8 \u4f4d&#xff0c;\u6bcf\u6b21\u8c03\u7528\u7684\u6d41\u7a0b\u5c31\u662f&#xff1a;7\u6b21\u642c\u8fd0 -&gt; 8\u6b21\u6c42\u548c -&gt; 1\u6b21\u9664\u6cd5\u3002<\/p>\n<h3 id=\"3.3%20%E7%94%B5%E4%BD%8D%E5%99%A8%EF%BC%88%E6%A8%A1%E5%BC%8F1%EF%BC%89\">3.3 \u7535\u4f4d\u5668&#xff08;\u6a21\u5f0f1&#xff09;<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6a21\u5f0f1\u662f\u4f7f\u7528\u7535\u4f4d\u5668\u6765\u8c03\u8282PA1\u5f15\u811a\u4e0a\u7684LED\u7684\u4eae\u5ea6&#xff0c;\u8bfb\u53d6PA4\u5f15\u811a\u4e0a\u7684ADC\u503c&#xff0c;\u7136\u540e\u6620\u5c04\u5bf9\u5e94\u76840 ~ 999 \u7684\u5360\u7a7a\u6bd4\u503c&#xff0c;\u8be6\u7ec6\u7a0b\u5e8f\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u8bfb\u53d6\u7535\u4f4d\u5668\u7684AD\u503c\u8f6c\u6362\u6210PWM\u8f93\u51fa<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval 0 ~ 999<br \/>\n  *\/<br \/>\nuint16_t Pot_GetValue(void)<br \/>\n{<br \/>\nuint16_t AD_Value, led_duty;<br \/>\nstatic uint16_t pot_buf[8];\/\/\u6ed1\u52a8\u91c7\u6837\u6570\u503c<\/p>\n<p>AD_Value &#061; ADC_GetValue(ADC_Channel_4);<\/p>\n<p>\/\/\u8f6c\u6362\u6210PWM&#xff1a;\u8303\u56f4\u662f0 ~ 999<br \/>\nled_duty &#061; (float)(4095 &#8211; AD_Value) \/ 4095.0 * 999.0;\/\/\u5148\u8f6c float&#xff0c;\u5426\u5219\u6574\u6570\u9664\u6cd5\u53ea\u51fa 0 \u6216 999<\/p>\n<p>return Moving_Average(pot_buf, led_duty);<br \/>\n}<\/p>\n<p>\u8f6c\u6362\u516c\u5f0f\u6709\u4e24\u70b9\u6ce8\u610f<\/p>\n<\/p>\n<p>\u7b2c\u4e00\u70b9&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u00a04095 &#8211; AD_Value&#xff1f;<\/p>\n<\/p>\n<p>\u7b54&#xff1a;LED\u4e3a\u4f4e\u7535\u5e73\u4eae&#xff0c;CCR\u8d8a\u5927\u8d8a\u6697&#xff0c;\u6240\u4ee5\u8981\u628aADC\u503c\u53cd\u8fc7\u6765\u6620\u5c04\u3002<\/p>\n<p>\u00a0 <\/p>\n<p>\u7b2c\u4e8c\u70b9&#xff1a;\u4e3a\u4ec0\u4e48\u8ba1\u7b97&#xff08;4095 &#8211; AD_Value&#xff09;\u524d\u8981\u8fdb\u884c\u5f3a\u5236 float \u8f6c\u6362&#xff1f;<\/p>\n<\/p>\n<p>\u7b54&#xff1a;\u5982\u679c\u4e0d\u5148\u6267\u884c float \u5f3a\u5236\u8f6c\u6362&#xff0c;\u4f1a\u6309\u7167 int \u7c7b\u578b\u6765\u8ba1\u7b97\u4f1a\u5ffd\u7565\u5c0f\u6570\u70b9\u540e\u9762\u7684\u6570&#xff0c;\u7ed3\u679c\u5c31\u53ea\u6709\u4e24\u4e2a\u6570\u503c 0 \u6216 999&#xff1b;<\/p>\n<h3 id=\"3.4%20%E7%83%AD%E6%95%8F%E7%94%B5%E9%98%BB%EF%BC%88%E6%A8%A1%E5%BC%8F2%EF%BC%89\">3.4 \u70ed\u654f\u7535\u963b&#xff08;\u6a21\u5f0f2&#xff09;<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u6a21\u5f0f2\u9700\u8981\u73af\u5883\u6e29\u5ea6&#xff0c;\u6a21\u5757\u4e0a\u7684\u70ed\u654f\u7535\u963b\u4e0e10K\u03a9\u7535\u963b\u5206\u538b&#xff0c;ADC \u8bfb\u5230\u7684\u662f\u5206\u538b\u70b9\u7535\u538b,\u9700\u8981\u5148\u6c42\u51fa\u70ed\u654f\u7535\u963b\u7684\u963b\u503c&#xff0c;\u518d\u4f7f\u7528\u4e8c\u5206\u67e5\u8868\u6cd5\u4e0e\u63d2\u503c\u516c\u5f0f\u6765\u63a8\u7b97\u73af\u5883\u6e29\u5ea6&#xff0c;\u5177\u4f53\u7a0b\u5e8f\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u8bfb\u53d6\u70ed\u654f\u4f20\u611f\u5668\u7684AD\u503c\u8f6c\u6362\u6210\u6e29\u5ea6\u8f93\u51fa<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval 0 ~ 60&#xff08;\u5355\u4f4d&#xff1a;\u2103&#xff09;<br \/>\n  *\/<br \/>\nuint16_t Temp_GetValue(void)<br \/>\n{<br \/>\nuint16_t AD_Value, Temp;<br \/>\nstatic uint16_ttemp_buf[8];\/\/\u6ed1\u52a8\u91c7\u6837\u6570\u503c<br \/>\nfloat Vo, Ro;<\/p>\n<p>AD_Value &#061; ADC_GetValue(ADC_Channel_5);<br \/>\nVo &#061; (float) AD_Value \/ 4095 * VDD_VOLTAGE;\/\/\u5c06AD\u503c\u8f6c\u6362\u6210\u8f93\u5165\u7535\u538b<br \/>\nRo &#061; (Vo * R_DIVIDER) \/ (VDD_VOLTAGE &#8211; Vo);\/\/\u8ba1\u7b97\u51fa\u70ed\u654f\u7535\u963b\u7684\u963b\u503c<\/p>\n<p>Temp &#061; Scan_NTC(Ro);\/\/\u67e5\u8868 &#043; \u63d2\u503c\u8ba1\u7b97\u51fa\u5177\u4f53\u6e29\u5ea6<\/p>\n<p>return Moving_Average(temp_buf, Temp);<br \/>\n}<\/p>\n<p>\u672c\u7a0b\u5e8f\u7684\u4e09\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<\/p>\n<p>1. \u4e3a\u4ec0\u4e48\u7528\u67e5\u8868&#xff0c;\u4e0d\u7528\u7ebf\u6027\u516c\u5f0f&#xff1f;<\/p>\n<\/p>\n<p>\u7b54&#xff1a;\u70ed\u654f\u7535\u963b\u662f\u8d1f\u6e29\u5ea6\u7cfb\u6570&#xff0c;\u963b\u503c-\u6e29\u5ea6\u662f\u6307\u6570\u5173\u7cfb&#xff0c;\u4e0d\u662f\u76f4\u7ebf&#xff1b;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u4f8b\u5982\u8bf4&#xff1a;25\u2103\u963b\u503c\u4e3a&#xff1a;10K\u03a9\u30010\u2103\u963b\u503c\u4e3a&#xff1a;32K\u03a9\u3001\u00a0 -25\u2103\u963b\u503c\u4e3a&#xff1a;117K\u03a9<\/p>\n<p>\u00a0-&gt; \u6240\u4ee5\u7528\u7ebf\u6027\u516c\u5f0f\u5957&#xff0c;\u4e2d\u95f4\u6bb5\u8bef\u5dee\u5f88\u5927\u3002<\/p>\n<\/p>\n<p>2. \u8868\u4ece\u54ea\u6765&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u5357\u4eac\u65f6\u6052 MF52A103F3950 \u89c4\u683c\u4e66\u7684\u4e2d\u5fc3\u503c&#xff0c;0 ~ 60\u2103\u517161\u4e2a\u70b9&#xff0c;\u6bcf 1 \u2103 \u4e00\u4e2a\u70b9&#xff0c;\u6e29\u5ea6\u4e3a\u6570\u7ec4\u4e0b\u6807&#xff0c;\u963b\u503c\u4e3a\u6570\u7ec4\u91cc\u7684\u53c2\u6570\u3002<\/p>\n<\/p>\n<p>\u00a03. \u600e\u4e48\u67e5&#xff1f;<\/p>\n<p>\u00a0\u7b54&#xff1a;\u4f7f\u7528\u4e8c\u5206\u67e5\u8868\u6cd5\u4e0e\u63d2\u503c\u516c\u5f0f\u6765\u53cd\u63a8\u51fa\u5b9e\u9645\u6e29\u5ea6\u6570\u503c\u3002\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p> float Scan_NTC(float Ro)<br \/>\n{<br \/>\nuint8_t Left &#061; 0, Right &#061; NTC_LEN &#8211; 1, Middle;<br \/>\nfloat Temp;<\/p>\n<p>\/*\u94b3\u4f4d\u5224\u65ad\u6570\u503c\u662f\u5426\u8d85\u51fa\u91cf\u7a0b*\/<br \/>\nif(Ro &lt;&#061; ntc_R_kohm[Right]) return 60.0;\/\/\u4f4e\u4e8e\u8868\u7684\u963b\u503c\u4e0b\u9650\u76f4\u63a5\u8f93\u51fa\u6e29\u5ea6\u6700\u5927\u503c 60\u2103<br \/>\nif(Ro &gt;&#061; ntc_R_kohm[Left])return 0.0;\/\/\u9ad8\u4e8e\u8868\u7684\u963b\u503c\u4e0a\u9650\u76f4\u63a5\u8f93\u51fa\u6e29\u5ea6\u6700\u5c0f\u503c 0\u2103<\/p>\n<p>\/*\u4e8c\u5206\u67e5\u8868\u6cd5&#xff0c;\u4ea4\u53c9\u9000\u51fa\u5faa\u73af*\/<br \/>\nwhile(Left &lt;&#061; Right)<br \/>\n{<br \/>\nMiddle &#061; (Left &#043; Right) \/ 2;<\/p>\n<p>if(ntc_R_kohm[Middle] &#061;&#061; Ro) return Middle;<br \/>\nelse if(Ro &gt; ntc_R_kohm[Middle]) Right &#061; Middle &#8211; 1;<br \/>\nelse if(Ro &lt; ntc_R_kohm[Middle]) Left&#061; Middle &#043; 1;<br \/>\n}<\/p>\n<p>\/\/\u4ece Right&#xff08;\u4f4e\u6e29\u4fa7&#xff09;\u8d77\u63d2\u503c<br \/>\nTemp &#061; Right &#043; (Left &#8211; Right) * (Ro &#8211; ntc_R_kohm[Right]) \/ (ntc_R_kohm[Left] &#8211; ntc_R_kohm[Right]);<\/p>\n<p>return Temp;<br \/>\n} <\/p>\n<h3 id=\"3.5%20%E5%85%89%E6%95%8F%E7%94%B5%E9%98%BB%EF%BC%88%E6%A8%A1%E5%BC%8F3%EF%BC%89\">3.5 \u5149\u654f\u7535\u963b&#xff08;\u6a21\u5f0f3&#xff09;<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u6a21\u5f0f 3 \u9700\u8981\u83b7\u53d6\u73af\u5883\u4eae\u5ea6&#xff0c;\u6765\u5224\u65ad\u5149\u7167\u5f3a\u5ea6&#xff0c;\u4e14\u4f4e\u4e8e\u9608\u503c\u5c31\u70b9\u706f\u3002\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u8bfb\u53d6\u5149\u654f\u4f20\u611f\u5668\u7684AD\u503c\u8f6c\u6362\u6210\u4eae\u5ea6\u767e\u5206\u6bd4<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval 0 ~ 100&#xff08;\u5355\u4f4d&#xff1a;%&#xff09;<br \/>\n  *\/<br \/>\nuint16_t Light_GetValue(void)<br \/>\n{<br \/>\nuint16_t AD_Value, Lux;<br \/>\nstatic uint16_tlight_buf[8];\/\/\u6ed1\u52a8\u91c7\u6837\u6570\u503c<\/p>\n<p>AD_Value &#061; ADC_GetValue(ADC_Channel_6);<\/p>\n<p>\/*\u94b3\u4f4d\u5224\u65ad\u6570\u503c\u662f\u5426\u8d85\u51fa\u91cf\u7a0b*\/<br \/>\nif(AD_Value &gt; DARK_VALUE) AD_Value &#061; DARK_VALUE;\/\/\u8fc7\u6697\u5c31\u6309\u7167\u6700\u6697\u91cf\u7a0b\u6765\u8ba1\u7b97<br \/>\nif(AD_Value &lt; BRIGHT_VALUE)AD_Value &#061; BRIGHT_VALUE;\/\/\u8fc7\u4eae\u5c31\u6309\u7167\u6700\u4eae\u91cf\u7a0b\u6765\u8ba1\u7b97<\/p>\n<p>\/*AD\u503c\u8f6c\u6362\u4eae\u5ea6\u767e\u5206\u6bd4*\/<br \/>\nLux &#061; 100 &#8211; ((float)AD_Value &#8211; BRIGHT_VALUE) \/ (DARK_VALUE &#8211; BRIGHT_VALUE) * 100;<\/p>\n<p>return Moving_Average(light_buf, Lux);<br \/>\n}<\/p>\n<p>\u672c\u7a0b\u5e8f\u7684\u4e24\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>1.\u4e3a\u4ec0\u4e48\u4e0d\u4f7f\u7528\u67e5\u8868&#xff0c;\u800c\u662f\u4f7f\u7528\u7167\u5ea6\u767e\u5206\u6bd4&#xff1f;<\/p>\n<p>\u7b54&#xff1a;\u8fd9\u91cc\u548c\u70ed\u654f\u7535\u963b\u4e0d\u4e00\u6837\u7684\u5730\u65b9\u5728\u4e8e&#xff0c;GL5516\u6570\u636e\u624b\u518c\u53ea\u7ed9\u4e86\u4e24\u4e2a\u70b9&#xff0c;10Lux \u963b\u503c\u4e3a5 ~10K\u03a9\u3001\u6697\u963b\u503c\u4e3a0.5M\u03a9&#xff0c;\u6ca1\u6709\u5b8c\u6574\u7684\u963b\u503c\u4e0e\u7167\u5ea6\u8868&#xff0c;\u67e5\u8868\u505a\u4e0d\u4e86&#xff0c;\u6240\u4ee5\u4f7f\u7528\u4e86\u767e\u5206\u6bd4&#xff0c;\u6765\u8868\u793a\u660e\u6697\u7a0b\u5ea6\u3002<\/p>\n<p><span style=\"color:#ed7976\">\u6ce8\u610f&#xff1a;\u56e0\u4e3a\u5149\u654f\u7684\u963b\u503c-\u7167\u5ea6\u662f\u5bf9\u6570\u5173\u7cfb&#xff08;\u03b3&#061;0.5&#xff09;&#xff0c;\u8fd9\u4e2a\u767e\u5206\u6bd4\u4e0d\u7b49\u4e8e\u7167\u5ea6\u767e\u5206\u6bd4&#xff0c;\u53ea\u662f\u76f8\u5bf9\u660e\u6697\u7a0b\u5ea6\u3002\u4e0d\u8fc7\u5bf9\u4e8e&#034;\u4f4e\u4e8e\u9608\u503c\u70b9\u706f&#034;\u591f\u7528\u3002<\/span><\/p>\n<\/p>\n<p>2.\u94b3\u4f4d\u7684\u4f5c\u7528\u3002<\/p>\n<\/p>\n<p>\u7b54&#xff1a;Moving_Average \u91cc\u7684 sum \u662f uint16 \u7c7b\u578b\u3002AD \u8d85\u51fa\u9884\u8bbe\u503c\u65f6\u516c\u5f0f\u4f1a\u7b97\u51fa\u8d1f\u6570&#xff0c; \u8d4b\u7ed9 uint16_t \u540e\u4f1a\u56de\u7ed5\u6210 6 \u4e07\u591a&#xff0c;sum \u7d2f\u52a0\u65f6\u5c31\u6ea2\u51fa\u4e86&#xff0c;\u6240\u4ee5\u5148\u94b3\u4f4f AD \u503c\u518d\u7b97\u3002<\/p>\n<hr \/>\n<h2 id=\"%E5%9B%9B%E3%80%81%E6%8C%89%E9%94%AE%E3%80%81%E4%B8%B2%E5%8F%A3%E6%97%A5%E5%BF%97%E4%B8%8E%E7%9C%8B%E9%97%A8%E7%8B%97\">\u56db\u3001\u6309\u952e\u3001\u4e32\u53e3\u65e5\u5fd7\u4e0e\u770b\u95e8\u72d7<\/h2>\n<h3 id=\"4.1%20%E6%8C%89%E9%94%AE\">4.1 \u6309\u952e<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u4f7f\u7528\u4e86\u4e24\u4e2a\u6309\u952e\u5b9e\u73b0\u7684\u529f\u80fd\u4e3a&#xff1a;\u6a21\u5f0f\u5207\u6362&#xff08;PA0&#xff09;\u3001\u770b\u95e8\u72d7\u529f\u80fd\u9a8c\u8bc1&#xff08;PC13&#xff09;&#xff0c;10ms\u626b\u9762\u4e00\u6b21\u6309\u952e&#xff08;PA0&#xff09;&#xff0c;\u68c0\u6d4b\u4e0a\u5347\u6cbf\u4e8b\u4ef6\u3002\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u626b\u63cf\u6309\u952e<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval \u65e0<br \/>\n  * &#064;note   \u51fd\u6570\u8fd0\u884c\u5728\u5b9a\u65f6\u5668\u4e2d\u65ad\u51fd\u6570&#xff0c;\u6bcf10ms\u8fd0\u884c\u4e00\u6b21<br \/>\n  * &#064;note   \u68c0\u6d4b\u5230\u4e0a\u5347\u6cbf\u65f6\u7f6e 1<br \/>\n  *\/<br \/>\nvoid Key_Scan(void)<br \/>\n{<br \/>\nstatic uint8_t prev_state &#061; 0, this_state &#061; 0;\/\/\u50a8\u5b58\u4e0a\u4e00\u6b21\u626b\u63cf\u4e0e\u672c\u6b21\u626b\u63cf\u7684\u72b6\u6001<br \/>\nprev_state &#061; this_state;<br \/>\nthis_state &#061; Key_GetValue();<\/p>\n<p>\/\/\u4e0a\u4e00\u6b21\u662f\u4f4e\u7535\u5e73\u3001\u672c\u6b21\u662f\u9ad8\u7535\u5e73&#xff0c;\u5224\u65ad\u4e3a\u4e0a\u5347\u6cbf&#xff0c;Key_Num \u7f6e 1<br \/>\nif(prev_state &#061;&#061; 0 &amp;&amp; this_state &#061;&#061; 1) Key_Num &#061; 1;<\/p>\n<p>}<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u8bfb\u53d6\u6309\u952e\u72b6\u6001<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval 0 &#061; \u65e0&#xff0c;1 &#061; \u6709\u6309\u952e\u4e8b\u4ef6<br \/>\n  * &#064;note   \u8fd0\u884c\u5728\u4e3b\u5faa\u73af&#xff0c;\u975e\u963b\u585e\u5224\u65ad\u6309\u952e\u4e8b\u4ef6<br \/>\n  *\/<br \/>\nuint8_t Key_GetKeyNum(void)<br \/>\n{<br \/>\nuint8_t Value;<br \/>\n__disable_irq();\/\/\u5173\u4e2d\u65ad\u670d\u52a1&#xff0c;\u9632\u6b62\u8bfb\u6e05\u4e4b\u95f4\u88ab\u4e2d\u65ad\u63d2\u5165\u5bfc\u81f4\u4e22\u4e8b\u4ef6<br \/>\nValue &#061; Key_Num;<br \/>\nKey_Num &#061; 0;<br \/>\n__enable_irq();\/\/\u6253\u5f00\u4e2d\u65ad\u670d\u52a1<br \/>\nreturn Value;<br \/>\n}<\/p>\n<p>\u672c\u7a0b\u5e8f\u7684\u4e24\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>1.\u4e3a\u4ec0\u4e48\u662f10ms\u626b\u63cf\u4e00\u6b21&#xff1f;<\/p>\n<\/p>\n<p>\u7b54&#xff1a;TIM3\u4e2d\u65ad\u670d\u52a1\u51fd\u6570\u91cc\u8ba1\u65f6&#xff0c;\u8de8\u8fc7\u673a\u68b0\u6309\u952e\u7684\u6296\u52a8\u7a97\u53e3&#xff08;5~20ms&#xff09;&#xff0c;\u4ee5\u786e\u4fdd\u8bfb\u503c\u7a33\u5b9a\u3002<\/p>\n<\/p>\n<p>2.\u8bfb\u6e05\u5206\u79bb\u7684\u4f5c\u7528<\/p>\n<\/p>\n<p>\u7b54&#xff1a;\u786e\u4fdd\u6309\u952e\u4e8b\u4ef6\u53ea\u4f1a\u6d88\u8d39\u4e00\u6b21&#xff0c;\u8bfb\u53d6\u65f6\u5173\u4e2d\u65ad&#xff0c;\u907f\u514d&#034;\u8bfb&#034;\u548c&#034;\u6e05&#034;\u4e4b\u95f4\u88ab\u4e2d\u65ad\u63d2\u5165&#xff0c; \u5bfc\u81f4\u4e8b\u4ef6\u4e22\u5931\u3002<\/p>\n<h3 id=\"4.2%20%E4%B8%B2%E5%8F%A3%E6%97%A5%E5%BF%97\">4.2 \u4e32\u53e3\u65e5\u5fd7<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u4e32\u53e31\u8f93\u51fa\u7cfb\u7edf\u7684\u72b6\u6001\u65e5\u5fd7&#xff0c;\u6ce2\u7279\u7387\u4e3a115200&#xff0c;TX\u4e3aPA9&#xff08;\u4e32\u53e3\u53ea\u8f93\u51fa&#xff0c;\u4e0d\u8f93\u5165&#xff0c;\u6240\u4ee5\u4e0d\u914dRX&#xff09;&#xff0c;\u6bcf 2 \u79d2\u6253\u5370\u4e00\u6b21\u65e5\u5fd7&#xff0c;\u5185\u5bb9\u4e3a&#xff1a;\u4e09\u4e2a\u901a\u9053\u7684\u6570\u503c\u3001\u5f53\u524d\u6a21\u5f0f\u3002\u5177\u4f53\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u7cfb\u7edf\u4e32\u53e3\u65e5\u5fd7<br \/>\n  * &#064;param  Refresh&#xff1a;\u5237\u65b0\u6570\u636e\u6807\u5fd7\u4f4d<br \/>\n  * &#064;param  Mode_Num&#xff1a;\u7cfb\u7edf\u6b63\u5728\u8fd0\u884c\u7684\u6a21\u5f0f<br \/>\n  * &#064;param ADC_Struct &#xff1a;\u4f20\u611f\u5668\u6570\u636e\u7ed3\u6784\u4f53\u5730\u5740<br \/>\n  * &#064;retval \u65e0<br \/>\n  * &#064;note   \u6807\u5fd7\u4f4d\u9a71\u52a8&#xff1a;*Refresh \u975e 0 \u624d\u8f93\u51fa&#xff0c;\u53d1\u9001\u5b8c\u81ea\u52a8\u6e05\u96f6<br \/>\n  *\/<br \/>\nvoid UART_Log_Display(volatile uint8_t *Refresh, uint8_t Mode_Num, ADC_Value *ADC_Struct)<br \/>\n{<br \/>\nstatic uint8_t Log_String[268];<br \/>\nstatic uint8_t Mode_Name[64];<br \/>\nuint8_t *p &#061; Log_String;<\/p>\n<p>if(*Refresh &#061;&#061; REFRESH_OFF)return;<\/p>\n<p>switch(Mode_Num)<br \/>\n{<br \/>\ncase Pot_Mode: sprintf ((char*)Mode_Name, &#034;\u7535\u4f4d\u5668\u8c03\u5149&#034;);    break;<br \/>\ncase Temp_Mode: sprintf ((char*)Mode_Name, &#034;\u6e29\u5ea6\u62a5\u8b66&#xff08;\u62a5\u8b66\u6761\u4ef6 &gt;&#061; %d\u2103&#xff09;&#034;,TEMP_WARNING_VALUE);    break;<br \/>\ncase Light_Mode:sprintf ((char*)Mode_Name, &#034;\u5149\u654f\u591c\u706f&#xff08;\u5f00\u706f\u6761\u4ef6 &lt;&#061; %d%%&#xff09;&#034;, MINIMUM_BRIGHT_VALUE);     break;<br \/>\n}<\/p>\n<p>p &#043;&#061; sprintf ((char*)p,   &#034;\\\\n\/*****\u7cfb\u7edf\u72b6\u6001\u65e5\u5fd7*****\/\\\\r\\\\n&#034;);<br \/>\np &#043;&#061; sprintf ((char*)p,   &#034;-&gt; \u7535\u4f4d\u5668\u63a7\u5236PWM\u5360\u7a7a\u6bd4&#xff1a;%d\/999\\\\r\\\\n&#034;, ADC_Struct-&gt;Pot);<br \/>\np &#043;&#061; sprintf ((char*)p,   &#034;-&gt; \u70ed\u654f\u7535\u963b\u68c0\u6d4b\u6e29\u5ea6\u4e3a&#xff1a;%d\u2103\\\\r\\\\n&#034;, ADC_Struct-&gt;Temp);<br \/>\np &#043;&#061; sprintf ((char*)p,   &#034;-&gt; \u5149\u654f\u7535\u963b\u68c0\u6d4b\u5149\u7167\u5f3a\u5ea6&#xff1a;%d%%\\\\r\\\\n\\\\n&#034;,ADC_Struct-&gt;Light);<\/p>\n<p>p &#043;&#061; sprintf ((char*)p,   &#034;-&gt; \u73b0\u5728\u662f\u6a21\u5f0f\u4e3a&#xff1a;%s \\\\r\\\\n&#034;,Mode_Name);<br \/>\nUART_SendString((uint8_t*)Log_String);<br \/>\n*Refresh &#061; REFRESH_OFF;<br \/>\n}<\/p>\n<p>\u672c\u7a0b\u5e8f\u7684\u4e24\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>1. \u4e3a\u4ec0\u4e48\u7528\u6807\u5fd7\u4f4d\u9a71\u52a8&#xff0c;\u4e0d\u76f4\u63a5\u5ef6\u65f6&#xff1f;<\/p>\n<\/p>\n<p>\u7b54&#xff1a;\u5982\u679c\u5728\u4e3b\u51fd\u6570\u4f7f\u7528 Delay_ms(2000); \u963b\u585e\u5ef6\u65f6\u7684\u8bdd&#xff0c;\u4f1a\u5f71\u54cd\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2\u5230\u8fbe\u76ee\u6807\u6570\u503c\u8981\u7b49\u4e0a\u6570\u5341\u79d2&#xff0c;\u6240\u4f7f\u7528 TIM3 \u5b9a\u65f6\u4e2d\u65ad\u670d\u52a1\u8ba1\u65f6&#xff0c;\u6bcf 2 \u79d2\u5237\u65b0\u6807\u5fd7\u7f6e1&#xff0c;\u65e5\u5fd7\u5237\u65b0\u4e00\u6b21\u5728\u5c06\u5237\u65b0\u6807\u5fd7\u7f6e 0\u3002\u00a0<\/p>\n<\/p>\n<p>2. \u4e3a\u4ec0\u4e48\u7528\u6e38\u6807<span style=\"color:#0d0016\"><span style=\"background-color:null\">\u00a0<\/span><\/span><span style=\"color:#0d0016\"><span style=\"background-color:null\"> <\/span><\/span><span style=\"color:null\"><span style=\"background-color:null\">p &#043;&#061;\u00a0&#xff1f;<\/span><\/span><\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u7b54&#xff1a;sprintf \u51fd\u6570\u6bcf\u6b21\u4f1a\u4ece\u7f13\u51b2\u533a\u5f00\u5934\u5199&#xff0c;\u5982\u679c\u56db\u6b21\u90fd\u4f7f\u7528 Log_String \u5199\u5165&#xff0c;\u5c31\u4f1a\u5bfc\u81f4\u524d\u4e09\u6b21\u90fd\u4f1a\u88ab\u8986\u76d6&#xff0c;\u53ea\u663e\u793a\u6700\u540e\u4e00\u6b21&#xff0c;\u7528\u6307\u9488\u540e\u63a8\u624d\u80fd\u663e\u793a\u591a\u884c\u65e5\u5fd7\u3002<\/p>\n<\/p>\n<h3 id=\"4.3%20%E7%9C%8B%E9%97%A8%E7%8B%97\">4.3 \u770b\u95e8\u72d7<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0IWDG \u7528\u4e8e\u7a0b\u5e8f\u8dd1\u98de\u65f6\u81ea\u52a8\u590d\u4f4d\u3002\u7528\u5185\u90e8 40kHz LSI&#xff0c;\u5206\u9891 16\u3001\u91cd\u8f7d 2499&#xff0c;\u6807\u79f0\u8d85\u65f6 1 \u79d2\u3002\u4ee3\u7801\u5982\u4e0b&#xff1a;<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u72ec\u7acb\u770b\u95e8\u72d7\u521d\u59cb\u5316<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval \u65e0<br \/>\n  * &#064;note   \u8d85\u8fc7 1 \u79d2\u6ca1\u8fdb\u884c\u201c\u5582\u72d7\u201d\u64cd\u4f5c\u770b\u95e8\u72d7\u6fc0\u6d3b&#xff0c;\u7cfb\u7edf\u91cd\u542f<br \/>\n  *\/<br \/>\nvoid IWDG_Init(void)<br \/>\n{<br \/>\nIWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);<br \/>\nIWDG_SetPrescaler(IWDG_Prescaler_16);\/\/ LSI &#061; 40000 Hz  ,LSI \/ 16 &#061; 2500Hz<br \/>\nIWDG_SetReload(2499);<br \/>\nIWDG_ReloadCounter();<br \/>\nIWDG_Enable();<\/p>\n<p>}<\/p>\n<p>\/**<br \/>\n  * &#064;brief  \u770b\u95e8\u72d7\u529f\u80fd\u9a8c\u8bc1\u6d4b\u8bd5<br \/>\n  * &#064;param  \u65e0<br \/>\n  * &#064;retval \u65e0<br \/>\n  * &#064;note   \u4f7f\u7528\u963b\u585e\u626b\u63cf\u6309\u952e\u4e8b\u4ef6<br \/>\n  * &#064;note\u9700\u8981\u6309\u4f4f\u6d4b\u8bd5\u6309\u952e&#xff08;PC13&#xff09;\u8d85\u8fc7\u4e00\u79d2\u4ee5\u4e0a<br \/>\n  *\/<br \/>\nvoid IWDG_Test(void)<br \/>\n{<br \/>\nconst char *P_String &#061; &#034;\\\\n-&gt;\u72ec\u7acb\u770b\u95e8\u72d7\u529f\u80fd\u6d4b\u8bd5&#xff0c;\u8bf7\u6309\u6d4b\u8bd5\u6309\u94ae\u7684\u65f6\u95f4\u8d85\u8fc71\u79d2\u4ee5\u4e0a&#8230;&#8230;.\\\\n&#034;;<br \/>\nif(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_13) &#061;&#061; SET)<br \/>\n{<br \/>\nUART_SendString((uint8_t*)P_String);\/\/\u4e32\u53e3\u6253\u5370\u6d4b\u8bd5\u6761\u4ef6<br \/>\nDelay_ms(15);<br \/>\nwhile(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_13) &#061;&#061; SET);\/\/\u963b\u585e\u7b49\u5f85\u6309\u952e\u91ca\u653e&#xff0c;\u6b64\u671f\u95f4\u4e0d\u5582\u72d7<br \/>\nDelay_ms(15);<br \/>\n}<br \/>\n} <\/p>\n<p>\u672c\u7a0b\u5e8f\u7684\u4e09\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>1. \u8d85\u65f6\u600e\u4e48\u7b97&#xff1f;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u7b54&#xff1a;LSI 40kHz \u00f7 16 &#061; 2500Hz&#xff0c;\u5373\u6bcf\u683c 0.4ms\u3002\u6570 2500 \u683c&#xff08;Reload \u586b 2499&#xff09;&#061; 1 \u79d2\u3002<\/p>\n<\/p>\n<p>2. \u5582\u72d7\u4f4d\u7f6e&#xff1f;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u7b54&#xff1a;\u653e\u5728\u4e3b\u5faa\u73af\u5f00\u5934&#xff0c;\u4fdd\u8bc1\u6bcf\u8f6e\u90fd\u5237\u65b0\u8ba1\u6570\u5668\u3002<\/p>\n<\/p>\n<p>3. \u600e\u4e48\u9a8c\u8bc1\u590d\u4f4d&#xff1f;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u7b54&#xff1a;\u6309\u4f4f PC13 \u8d85\u8fc7 1 \u79d2&#xff0c;\u7a0b\u5e8f\u963b\u585e\u4e0d\u5582\u72d7 \u2192\u00a0 \u770b\u95e8\u72d7\u590d\u4f4d\u3002\u590d\u4f4d\u540e\u7528\u00a0RCC_FLAG_IWDGRST\u00a0\u5224\u65ad\u590d\u4f4d\u6765\u6e90&#xff0c;\u6253\u5370\u63d0\u793a\u3002<span style=\"color:#ed7976\">\u6ce8\u610f&#xff1a;\u5224\u65ad\u5b8c\u8981\u00a0RCC_ClearFlag()&#xff0c;\u5426\u5219\u4e0b\u6b21\u6b63\u5e38\u4e0a\u7535\u4e5f\u4f1a\u8bef\u62a5\u3002<\/span><\/p>\n<\/p>\n<hr \/>\n<h2 id=\"%E4%BA%94%E3%80%81%E5%8A%9F%E8%83%BD%E6%BC%94%E7%A4%BA\">\u4e94\u3001\u529f\u80fd\u6f14\u793a<\/h2>\n<p>\u529f\u80fd\u6f14\u793a\u89c6\u9891<\/p>\n<hr \/>\n<h2 id=\"%E4%BA%94%E3%80%81%E5%8A%9F%E8%83%BD%E6%BC%94%E7%A4%BA\">\u516d\u3001\u8e29\u5751\u8bb0\u5f55\u4e0e\u603b\u7ed3<\/h2>\n<p>\u6574\u4e2a\u9879\u76ee\u505a\u4e0b\u6765&#xff0c;\u6700\u82b1\u65f6\u95f4\u7684\u4e0d\u662f\u5199\u4ee3\u7801&#xff0c;\u662f\u627e&#034;\u4e3a\u4ec0\u4e48\u4e0d\u5bf9&#034;\u3002<\/p>\n<p>\u51e0\u4e2a\u5370\u8c61\u6bd4\u8f83\u6df1\u7684\u5751&#xff1a;<\/p>\n<ul>\n<li>TIM2 \u6302 APB1&#xff0c;\u4e0d\u6302 APB2\u00a0\u2014\u2014 \u65f6\u949f\u4f7f\u80fd\u5199\u9519\u603b\u7ebf&#xff0c;\u7f16\u8bd1\u76f4\u63a5\u62a5\u9519<\/li>\n<li>PA1 \u662f TIM2_CH2\u00a0\u2014\u2014 \u7528\u00a0TIM_SetCompare1\u00a0\u8c03\u4e86\u534a\u5929\u4eae\u5ea6\u4e0d\u53d8&#xff0c;\u56e0\u4e3a\u6539\u7684\u662f CH1 \u7684\u5bc4\u5b58\u5668<\/li>\n<li>\u6574\u6570\u9664\u6cd5\u7684\u5f3a\u8f6c\u4f4d\u7f6e\u00a0\u2014\u2014\u00a0(float)\u00a0\u653e\u5728\u7b2c\u4e00\u4e2a\u64cd\u4f5c\u6570\u4e0a&#xff0c;\u5426\u5219\u9664\u6cd5\u5148\u6309\u6574\u6570\u7b97&#xff0c;\u5360\u7a7a\u6bd4\u53ea\u6709 0 \u6216 999<\/li>\n<li>\u5fd9\u7b49\u5ef6\u65f6\u7684\u7cfb\u6570\u9760\u6807\u5b9a\u00a0\u2014\u2014 7200 \u5728 -O0 \u4e0b\u8dd1\u51fa 3 \u500d\u65f6\u95f4&#xff0c;\u6700\u540e\u5b9e\u6d4b\u6807\u5b9a\u6210 6600<\/li>\n<\/ul>\n<p>\u51e0\u6761\u53ef\u590d\u7528\u7684\u7ecf\u9a8c&#xff1a;<\/p>\n<li>\u5f15\u811a\u53f7\u3001\u901a\u9053\u53f7\u3001\u603b\u7ebf\u53f7\u5fc5\u987b\u914d\u5bf9&#xff0c;\u9009\u9519\u662f\u9759\u9ed8\u5931\u6548&#xff0c;\u6700\u96be\u67e5<\/li>\n<li>\u6ce8\u610f\u6574\u6570\u9664\u6cd5\u548c\u65e0\u7b26\u53f7\u7c7b\u578b\u2014\u2014\u4e0d\u62a5\u9519\u3001\u4e0d\u5d29\u6e83&#xff0c;\u4f46\u7ed3\u679c\u5168\u9519<\/li>\n<li>\u770b\u95e8\u72d7\u590d\u4f4d\u8981\u6709\u8bc1\u636e&#xff0c;\u8bfb\u00a0RCC_FLAG_IWDGRST\u00a0\u786e\u8ba4&#xff0c;\u4e0d\u80fd\u9760\u611f\u89c9<\/li>\n<p><span class=\"link-card-box\"><span class=\"link-title\">\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\u9879\u76ee\u6e90\u7801<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260921064051-6ab0d1735b8b4.png\" \/>https:\/\/github.com\/GDchan\/stm32-multi-mode-sensor<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u662f\u4e2a\u4eba\u7684STM32 \u6807\u51c6\u5e93\u7684\u81ea\u5b66\u8bb0\u5f55&#xff0c;\u4ee3\u7801\u53c2\u8003\u4e86 ST \u5b98\u65b9\u56fa\u4ef6\u5e93\u4f8b\u7a0b\u3001\u7f51\u4e0a\u5f00\u6e90\u9879\u76ee(\u6c5f\u534f\u79d1\u6280\u4e3a\u4e3b)\u4ee5\u53ca AI \u8f85\u52a9\u7684\u8ba8\u8bba&#xff0c;\u6240\u6709\u4ee3\u7801\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41&#xff0c;\u4e5f\u975e\u5e38\u5e0c\u671b\u5404\u4f4d\u5927\u4f6c\u80fd\u6307\u70b9\u4e00\u4e8c&#xff0c;\u611f\u8c22\u5404\u4f4d\u524d\u8f88\u7684\u5f00\u6e90\u5206\u4eab\u3002 \u76ee\u5f55 \u4e00\u3001\u9879\u76ee\u6982\u51b5&#xff1a; \u4e8c\u3001\u7cfb\u7edf\u67b6\u6784\u4e0e\u57fa\u7840\u5916\u8bbe \u00a02.1 \u4e3b\u5faa\u73af\u4e0e\u6a21\u5757\u5212\u5206 2.2\u00a0PWM\u8c03\u5149 \u4e09\u3001ADC \u4e09\u901a\u9053\u4e0e\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.1 ADC \u4e09\u901a\u9053\u91c7\u96c6 3.2 \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.3 \u7535\u4f4d\u5668&amp;#xff0<\/p>\n","protected":false},"author":2,"featured_media":108281,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[174,217,270,219,1363],"topic":[],"class_list":["post-108284","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-stm32","tag-270","tag-219","tag-1363"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/108284.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u662f\u4e2a\u4eba\u7684STM32 \u6807\u51c6\u5e93\u7684\u81ea\u5b66\u8bb0\u5f55&#xff0c;\u4ee3\u7801\u53c2\u8003\u4e86 ST \u5b98\u65b9\u56fa\u4ef6\u5e93\u4f8b\u7a0b\u3001\u7f51\u4e0a\u5f00\u6e90\u9879\u76ee(\u6c5f\u534f\u79d1\u6280\u4e3a\u4e3b)\u4ee5\u53ca AI \u8f85\u52a9\u7684\u8ba8\u8bba&#xff0c;\u6240\u6709\u4ee3\u7801\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41&#xff0c;\u4e5f\u975e\u5e38\u5e0c\u671b\u5404\u4f4d\u5927\u4f6c\u80fd\u6307\u70b9\u4e00\u4e8c&#xff0c;\u611f\u8c22\u5404\u4f4d\u524d\u8f88\u7684\u5f00\u6e90\u5206\u4eab\u3002 \u76ee\u5f55 \u4e00\u3001\u9879\u76ee\u6982\u51b5&#xff1a; \u4e8c\u3001\u7cfb\u7edf\u67b6\u6784\u4e0e\u57fa\u7840\u5916\u8bbe \u00a02.1 \u4e3b\u5faa\u73af\u4e0e\u6a21\u5757\u5212\u5206 2.2\u00a0PWM\u8c03\u5149 \u4e09\u3001ADC \u4e09\u901a\u9053\u4e0e\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.1 ADC \u4e09\u901a\u9053\u91c7\u96c6 3.2 \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.3 \u7535\u4f4d\u5668&amp;#xff0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/108284.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-21T06:40:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260921064047-6ab0d16f42e3d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108284.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/108284.html\",\"name\":\"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-21T06:40:52+00:00\",\"dateModified\":\"2026-09-21T06:40:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/108284.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/108284.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108284.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/108284.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u662f\u4e2a\u4eba\u7684STM32 \u6807\u51c6\u5e93\u7684\u81ea\u5b66\u8bb0\u5f55&#xff0c;\u4ee3\u7801\u53c2\u8003\u4e86 ST \u5b98\u65b9\u56fa\u4ef6\u5e93\u4f8b\u7a0b\u3001\u7f51\u4e0a\u5f00\u6e90\u9879\u76ee(\u6c5f\u534f\u79d1\u6280\u4e3a\u4e3b)\u4ee5\u53ca AI \u8f85\u52a9\u7684\u8ba8\u8bba&#xff0c;\u6240\u6709\u4ee3\u7801\u4ec5\u4f9b\u5b66\u4e60\u4ea4\u6d41&#xff0c;\u4e5f\u975e\u5e38\u5e0c\u671b\u5404\u4f4d\u5927\u4f6c\u80fd\u6307\u70b9\u4e00\u4e8c&#xff0c;\u611f\u8c22\u5404\u4f4d\u524d\u8f88\u7684\u5f00\u6e90\u5206\u4eab\u3002 \u76ee\u5f55 \u4e00\u3001\u9879\u76ee\u6982\u51b5&#xff1a; \u4e8c\u3001\u7cfb\u7edf\u67b6\u6784\u4e0e\u57fa\u7840\u5916\u8bbe \u00a02.1 \u4e3b\u5faa\u73af\u4e0e\u6a21\u5757\u5212\u5206 2.2\u00a0PWM\u8c03\u5149 \u4e09\u3001ADC \u4e09\u901a\u9053\u4e0e\u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.1 ADC \u4e09\u901a\u9053\u91c7\u96c6 3.2 \u6ed1\u52a8\u5e73\u5747\u6ee4\u6ce2 3.3 \u7535\u4f4d\u5668&amp;#xff0","og_url":"https:\/\/www.wsisp.com\/helps\/108284.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-21T06:40:52+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260921064047-6ab0d16f42e3d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/108284.html","url":"https:\/\/www.wsisp.com\/helps\/108284.html","name":"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-21T06:40:52+00:00","dateModified":"2026-09-21T06:40:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/108284.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/108284.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/108284.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e STM32F103 \u6807\u51c6\u5e93\u7684\u591a\u6a21\u5f0f\u4f20\u611f\u5668\u7ec8\u7aef\uff08ADC \u4e09\u901a\u9053 + \u6ed1\u52a8\u5e73\u5747 + IWDG\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108284","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=108284"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108284\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/108281"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=108284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=108284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=108284"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=108284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}