{"id":133,"date":"2024-09-16T11:02:08","date_gmt":"2024-09-16T03:02:08","guid":{"rendered":"https:\/\/www.armfun.cn\/?p=133"},"modified":"2024-10-10T17:50:18","modified_gmt":"2024-10-10T09:50:18","slug":"%ef%bc%88%e4%ba%94%ef%bc%89protues%e4%bb%bf%e7%9c%9fstm32%e5%8d%95%e7%89%87%e6%9c%ba%e4%b8%b2%e5%8f%a3%e6%95%b0%e6%8d%ae%e6%b5%81%e6%94%b6%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.armfun.cn\/?p=133","title":{"rendered":"\uff08\u4e94\uff09Proteus\u4eff\u771fSTM32\u5355\u7247\u673a\u4e32\u53e3\u6570\u636e\u6d41\u6536\u53d1"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">1\uff0c\u6253\u5f00STM32CubeMX\uff0c\u627e\u5230USART1,\u914d\u7f6e\u6a21\u5f0fAsynchronous\uff0c\u6b64\u65f6PA9\u3001PA10\u81ea\u52a8\u53d8\u6210\u4e32\u53e3\u6a21\u5f0f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e32\u53e3\u9ed8\u8ba4\u53c2\u6570:115200bps 8bit  None 1stop<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"626\" src=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-1024x626.png\" alt=\"\" class=\"wp-image-135\" srcset=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-1024x626.png 1024w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-300x183.png 300w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-768x470.png 768w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-1536x939.png 1536w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15-670x410.png 670w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-15.png 1900w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\uff0cNVIC Settings\u4f7f\u80fd\u6536\u53d1\u4e2d\u65ad<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"727\" height=\"271\" src=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-16.png\" alt=\"\" class=\"wp-image-136\" srcset=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-16.png 727w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-16-300x112.png 300w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-16-670x250.png 670w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\uff0c\u53d1\u9001\u6570\u636e\u6d41<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HAL_UART_Transmit_IT(&amp;huart1, \"hello word\", 10);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\uff0c\u63a5\u6536\u56fa\u5b9a\u957f\u5ea6\u6570\u636e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u5b9a\u4e49\u4e00\u4e2a\u63a5\u653610byte\u7684\u6570\u7ec4\nuint8_t revbuff&#91;10];\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u63a5\u6536\u5b8c\u6210\u4e2d\u65ad\u901a\u77e5\u51fd\u6570\uff0c\u6570\u636e\u63a5\u6536\u5b8c\u6210\u65f6\u4f1a\u88abHAL\u5e93\u81ea\u52a8\u8c03\u7528\nvoid HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)\n{\n\/\/\u5904\u740610byte\u6570\u636e\n}\n\/\/\u521d\u59cb\u5316\u542f\u52a8\u63a5\u6536\u51fd\u6570\nHAL_UART_Receive_IT(&amp;huart1,revbuff,10);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5\uff0c\u63a5\u6536\u53ef\u53d8\u957f\u5ea6\u6570\u636e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u63a5\u6536\u56fa\u5b9a\u957f\u5ea6\u6570\u636e\u662f\u542f\u52a8\u63a5\u6536\u540e\u5fc5\u987b\u6536\u523010byte\u6570\u636e\u624d\u80fd\u6536\u5230\u4e2d\u65ad\u5b8c\u6210\u901a\u77e5\uff0c\u5e76\u4e14\u9700\u8981\u518d\u6b21\u8c03\u7528HAL_UART_Receive_IT\u91cd\u65b0\u542f\u52a8\u540e\u7eed\u6570\u636e\u63a5\u6536\uff0c\u56e0\u6b64\u5f88\u4e0d\u5e38\u7528\u3002\u4e3a\u4e86\u63a5\u6536\u53ef\u53d8\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9700\u8981\u6bcf\u6536\u5230\u4e00\u4e2abyte\u90fd\u4ea7\u751f\u4e2d\u65ad\u901a\u77e5\uff0c\u5e76\u4e14\u4e0d\u505c\u6b62\u63a5\u6536\u72b6\u6001\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u63a5\u65361byte\u7684\u6570\u7ec4\nuint8_t revbuff&#91;1];\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u63a5\u6536\u5b8c\u6210\u4e2d\u65ad\u901a\u77e5\u51fd\u6570\uff0c\u6570\u636e\u63a5\u6536\u5b8c\u6210\u65f6\u88ab\u8c03\u7528\nvoid HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)\n{\n  \/\/\u5904\u7406revbuff&#91;0]1byte\u6570\u636e\n}\n\/\/\u521d\u59cb\u5316\u542f\u52a8\u63a5\u65361byte\u51fd\u6570\nHAL_UART_Receive_IT(&amp;huart1,revbuff,1);\n\/\/\u4fee\u6539\u5e93\u51fd\u6570UART_Receive_IT,\u627e\u5230huart-&gt;pRxBuffPtr += 1U;\u5220\u9664\u6b64\u884c\uff0c\u5e76\u66ff\u6362\u4e3a\u8fd9\u4e24\u884cHAL_UART_RxCpltCallback(huart);\nreturn HAL_OK;\n\/\/\u8fd9\u6837\u6bcf\u6b21\u6536\u5230\u65b0\u6570\u636e\u90fd\u4f1a\u5199\u5230revbuff&#91;0]\u5e76\u901a\u77e5\u4e2d\u65ad\u51fd\u6570\uff0c\u4e14\u4e0d\u4f1a\u5173\u95ed\u63a5\u6536\u72b6\u6001\u3002<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001Proteus\u4eff\u771f\u4f7f\u7528\u7535\u8111\u7269\u7406\u4e32\u53e3\uff0c\u641c\u7d22\u6dfb\u52a0\u5668\u4ef6\u201dCOMPIM\u201c\uff0c\u5e76\u5982\u56fe\u8fde\u63a5<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"792\" src=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17-1024x792.png\" alt=\"\" class=\"wp-image-142\" srcset=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17-1024x792.png 1024w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17-300x232.png 300w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17-768x594.png 768w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17-670x518.png 670w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-17.png 1420w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u914d\u7f6e\u201dCOMPIM\u201c\u9009\u62e9\u7269\u7406\u4e32\u53e3\uff0c\u5e76\u914d\u7f6e\u7269\u7406\u4e32\u53e3\u548c\u5355\u7247\u673a\u7aef\u865a\u62df\u4e32\u53e3\u7684\u6ce2\u7279\u7387\u7b49\u53c2\u6570<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"736\" src=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-18.png\" alt=\"\" class=\"wp-image-143\" srcset=\"https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-18.png 805w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-18-300x274.png 300w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-18-768x702.png 768w, https:\/\/www.armfun.cn\/wp-content\/uploads\/2024\/09\/image-18-670x613.png 670w\" sizes=\"(max-width: 805px) 100vw, 805px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">git\u6e90\u7801\uff1a<a href=\"https:\/\/gitee.com\/armfun\/stm32_proteus\">https:\/\/gitee.com\/armfun\/stm32_proteus<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\uff0c\u6253\u5f00STM32CubeMX\uff0c\u627e\u5230USART1,\u914d\u7f6e\u6a21\u5f0fAsynchr&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-arm"],"views":1542,"_links":{"self":[{"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":14,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":325,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/325"}],"wp:attachment":[{"href":"https:\/\/www.armfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.armfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}