{"id":2843,"date":"2019-10-07T06:58:07","date_gmt":"2019-10-07T06:58:07","guid":{"rendered":""},"modified":"2019-10-07T14:58:28","modified_gmt":"2019-10-07T06:58:28","slug":"stm32f4xx%e7%b3%bb%e5%88%97%e8%8a%af%e7%89%87%e7%9a%84%e9%a9%b1%e5%8a%a8%e6%8e%a5%e5%8f%a3%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2843","title":{"rendered":"STM32F4XX\u7cfb\u5217\u82af\u7247\u7684\u9a71\u52a8\u63a5\u53e3\u7a0b\u5e8f\u8bbe\u8ba1"},"content":{"rendered":"
\n\t\u4e4b\u524d\u4e00\u76f4\u5728\u505a\u9a71\u52a8\u65b9\u9762\u7684\u6574\u7406\u5de5\u4f5c\uff0c\u5bf9\u9a71\u52a8\u7684\u9ad8\u6548\u6027\u6709\u4e00\u4e9b\u81ea\u5df1\u7684\u7406\u89e3\u8fd9\u91cc\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002\u5e76\u5949\u9a71\u52a8\u7a0b\u5e8f\uff0c\u672c\u7a0b\u5e8f\u8986\u76d6uart<\/u>1-8\u3002<\/p>\n
\n\t\u4e32\u53e3\u9a71\u52a8\uff0c\u8fd9\u662f\u5728\u6bcf\u4e2a\u5355\u7247\u673a<\/u>\u4e2d\u53ef\u4ee5\u8bf4\u662f\u5fc5\u5907\u63a5\u53e3<\/u>\u3002\u53ef\u4ee5\u8bf4\u5927\u90e8\u5206\u4ea7\u54c1\u4e2d\u90fd\u4f1a\u4f7f\u7528\uff0c\u66f4\u6709\u751a\u8005\u4e00\u4e2a\u4ea7\u54c1\u4e2d\u7528\u52308\u4e2a\u4e32\u53e3\u3002\u8fd9\u6837\u4e00\u4e2a\u9ad8\u6548\u7684\u9a71\u52a8\u662f\u51b3\u5b9a\u60a8\u4ea7\u54c1\u4f18\u52a3\u7684\u5173\u952e\u56e0\u7d20\u3002\u672c\u6587\u4e3b\u8981\u9488\u5bf9STM32<\/u>F4XX\u7cfb\u5217\u82af\u7247\u505a\u7684\u4e00\u4e2a\u9a71\u52a8\u63a5\u53e3\u5c42\u3002\u4ee5\u51cf\u5c11\u60a8\u5728\u5f00\u53d1\u9879\u76ee\u65f6\u9a71\u52a8\u65b9\u9762\u6240\u82b1\u8d39\u65f6\u95f4\uff0c\u4ee5\u53ca\u4e3a\u7a0b\u5e8f\u8fbe\u5230\u9ad8\u6548\u7684\u5904\u7406\u4e3a\u76ee\u7684\u3002<\/p>\n \n\t\u4ece51\uff0cpi<\/u>c\u5230\u73b0\u5728\u7684STM32\uff0c\u4e2a\u4eba\u611f\u89c9STM32\u8fd9\u65b9\u9762\u505a\u7684\u975e\u5e38\u7a81\u51fa\uff0c\u4e30\u5bcc\u7684\u4f7f\u7528\u6a21\u5f0f\uff0c\u5f3a\u5927\u7684\u5f15\u811a\u6620\u5c04\u529f\u80fd\uff0c\u5f3a\u5927\u7684\u5904\u7406\u80fd\u529b\u7b49\uff0c\u7ed9\u6211\u7559\u4e0b\u7684\u6df1\u523b\u7684\u5370\u8c61\u3002<\/p>\n \n\t<\/p>\n \n\t\u5173\u4e8e\u4e32\u53e3\u7684\u4f7f\u7528\u65b9\u5f0f\uff0c\u4e2a\u4eba\u603b\u7ed3\u51fa\u4ee5\u4e0b\u4e09\u79cd\uff1a<\/p>\n \n\t1\uff09 \u4e2d\u65ad\u63a5\u6536\uff0c\u72b6\u6001\u67e5\u8be2\u53d1\u9001\uff1a\u8fd9\u79cd\u65b9\u5f0f\u5728\u5355\u7247\u673a\u65f6\u4ee3\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u90a3\u65f6\u5019\u5927\u90e8\u5206\u82af\u7247\u7684\u5904\u7406\u901f\u5ea6\u4e0d\u591f\u5feb\uff0c\u5de5\u4e1a\u63a7\u5236\u63a5\u53e3\u4e2d\u5927\u90e8\u5206\u4f7f\u7528\u7684\u662f9600\u6ce2\u7279\u7387\uff0c\u7a0b\u5e8f\u7b80\u5355\u4e5f\u5c31\u5bf9\u4e32\u53e3\u53d1\u9001\u6570\u636e\u6240\u7528\u65f6\u95f4\u8981\u6c42\u4e0d\u9ad8\u3002<\/p>\n \n\t2\uff09 \u4e2d\u65ad\u63a5\u6536\uff0c\u4e2d\u65ad\u53d1\u9001\uff1a\u8fd9\u79cd\u65b9\u5f0f\u4e00\u822c\u4f1a\u5728\u5bf9\u9ad8\u6548\u6027\u8981\u6c42\u8f83\u9ad8\uff0c\u6216\u8f6f\u4ef6\u5b9e\u65f6\u6027\u9ad8\u7684\u4ea7\u54c1\u4e2d\u4f7f\u7528\u3002\u8fd9\u79cd\u65b9\u5f0f\u7684\u597d\u5916\u5728\u4e8e\u5b8c\u5168\u91ca\u653e\u4e86CPU<\/u>\u5728\u53d1\u9001\u5f00\u59cb\u5230\u7ed3\u675f\u8fd9\u4e00\u65f6\u95f4CPU\u63a7\u5236\u6743\u3002<\/p>\n \n\t3\uff09 \u4e2d\u65ad\u63a5\u53e3\uff0cDMA<\/u>\u53d1\u9001\uff1a\u8fd9\u79cd\u65b9\u5f0f\u7684\u4f7f\u7528\u573a\u5408\u548c\u6a21\u5f0f2\u76f8\u540c\uff0c\u6548\u7387\u4e5f\u76f8\u5dee\u4e0d\u591a\u3002\u4f46\u8fd9\u79cd\u65b9\u5f0f\u786e\u5b9e\u6bd4\u6a21\u5f0f2CPU\u7684\u5360\u7528\u65f6\u95f4\u4f1a\u66f4\u5c11\u3002<\/p>\n \n\t\u4e3e\u4e2a\u4f8b\u5b50\u6765\u8bf4\u660e\u4ee5\u4e0a\u4e09\u79cd\u6a21\u5f0f\u3002\u5047\u5982\u8981\u628a\u4e00\u5806\u7269\u54c1\u4eceA\u70b9\u8fd0\u5230B\u70b9\u901a\u8fc7\u4f20\u9001\u5e26\uff0c\u5728\u8fd9\u4e2a\u4f20\u9001\u8fc7\u7a0b\u4e2d\u4f20\u9001\u5e26\u4e0a\u4e00\u6b21\u53ea\u80fd\u8fd0\u4e00\u4e2a\u7269\u54c1\uff0c\u6a21\u5f0f\u4e00\uff1a\u628a\u7269\u54c1\u653e\u5230\u4f20\u9001\u5e26A\u70b9\u4e0a\uff0c\u7136\u540e\u7b49\u5f85\u7269\u54c1\u7531A\u70b9\u88ab\u4f20\u5230B\u70b9\uff0c\u8fd9\u65f6\u518d\u653e\u4e00\u4e2a\u7269\u54c1\u5230\u4f20\u9001\u5e26\u4e0a\uff0c\u4ee5\u6b64\u5f80\u590d\u6240\u6709\u7269\u54c1\u4f20\u9001\u8fc7\u53bb\u3002\u6a21\u5f0f\u4e8c\uff1a\u628a\u7269\u54c1\u653e\u5230A\u70b9\u7684\u4f20\u9001\u5e26\u4e0a\u7136\u540e\u5c31\u53bb\u5fd9\u522b\u7684\u4e8b\u60c5\uff0c\u770b\u5230\u7269\u54c1\u5feb\u88ab\u4f20\u5230B\u70b9\uff0c\u9a6c\u4e0a\u56de\u6765\u518d\u653e\u4e00\u4e2a\u7269\u54c1\u5230\u4f20\u9001\u5e26\u4e0a\u3002\u5f88\u660e\u663e\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u6a21\u5f0f\u4e00\u591a\u4e86\u5f88\u591a\u7a7a\u4f59\u65f6\u95f4\u3002\u6a21\u5f0f\u4e09\uff1a\u8fd9\u79cd\u6a21\u5f0f\u5c31\u725b\u4e86\uff0c\u5728\u628a\u7269\u54c1\u653e\u5230A\u70b9\u4e4b\u524d\uff0c\u76f4\u63a5\u53bb\u627e\u4e86\u4e00\u4e2a“\u95f2\u6742\u4eba\u7b49”\u8fc7\u6765\uff0c\u628a\u7269\u54c1\u4ea4\u7ed9\u4ed6\u7531\u4ed6\u53bb\u53d1\uff0c\u6211\u4eec\u9700\u8981\u518d\u53d1\u9001\u65f6\uff0c\u5148\u95ee\u4e0b\u5979\u662f\u5426\u4ee5\u53d1\u5b8c\uff0c\u5982\u679c\u53d1\u5b8c\u4e86\u5c31\u628a\u65b0\u7684\u7269\u54c1\u4ea4\u7ed9\u4ed6\uff0c\u5982\u679c\u6ca1\u53d1\u5b8c\u5c31\u7b49\u4e00\u5c0f\u56de\u518d\u6765\u627e\u4ed6\u3002\u54c8\u54c8\uff0c\u8fd9\u6837\u54b1\u4eec\u5c31\u6709\u66f4\u591a\u7684\u65f6\u95f4\u53bb\u5fd9\u66f4\u591a\u7684\u4e8b\u60c5\u4e86\uff0c\u4e5f\u4e0d\u7528\u4e00\u56de\u8dd1\u6765\u4e00\u56de\u8dd1\u53bb\u3002\u628a\u8dd1\u8def\u7684\u65f6\u95f4\u7ed9\u8282\u7ea6\u51fa\u6765\u4e86\u3002<\/p>\n \n\t\u4ee5\u4e0a\u4e09\u79cd\u6a21\u5f0f\uff0c\u5f88\u660e\u663e\u5f97\u51fa\u90a3\u79cd\u6a21\u5f0f\u53d1\u9001\u6570\u636e\u6548\u7387\u6700\u9ad8\u3002\u6211\u4eec\u4e0b\u9762\u8bf4\u63d0\u4f9b\u7684\u7a0b\u5e8f\u5c31\u662f\u4f7f\u7528\u6a21\u5f0f\u4e09\u3002<\/p>\n \n\t\u8bf4\u5b8c\u53d1\u9001\uff0c\u518d\u8bf4\u8bf4\u63a5\u6536\u65b9\u5f0f\u3002\u5927\u5bb6\u4e00\u5b9a\u53d1\u73b0\u6570\u636e\u63a5\u6536\u90fd\u662f\u91c7\u7528\u4e2d\u65ad\u65b9\u5f0f\uff0c\u662f\u7684 \u672c\u4eba\u4f7f\u7528\u8fc7DMA\u65b9\u5f0f\u8fdb\u884c\u8fc7\u591a\u6b21\u6d4b\u8bd5<\/u>\uff0c\u5728\u4f7f\u7528\u65b9\u9762\u786e\u5b9e\u6ca1\u6709\u4e2d\u65ad\u63a5\u6536\u7075\u6d3b\u3002\u4e3b\u8981\u6709\u4ee5\u4e0b\u4e24\u79cd\u60c5\u51b5\uff0c1\uff0cDMA\u63a5\u6536\u6570\u636e\u7684\u4e3b\u8981\u5224\u65ad\u4f9d\u636e1\u662f\u63a5\u6536\u5668\u6ee1\u4e2d\u65ad\uff0c\u8fd9\u79cd\u60c5\u51b5\u5728\u5b9e\u9645\u4e2d\u5f88\u5c11\u7528\uff0c\u9664\u975e\u60a8\u7684\u6570\u636e\u662f\u5b9a\u957f\u3002\u8fd9\u79cd\u65b9\u5f0f\u540c\u65f6\u8fd8\u4f1a\u5b58\u5728\u4e00\u4e9b\u5b89\u5168\u9690\u60a3\uff0c\u5047\u5982\u566a\u58f0\u539f\u56e0\u591a\u63a5\u6536\u5230\u4e00\u4e2a\u5b57\u8282\uff0c\u90a3\u4e4b\u540e\u6570\u636e\u65f6\u5e8f\u5c31\u4f1a\u9519\u4f4d\u30022\uff0cDMA\u603b\u7ebf\u7a7a\u95f2\u4e2d\u65ad\uff0c\u8fd9\u79cd\u65b9\u5f0f\u9664\u975e\u662f\u534a\u53cc\u5de5\u60c5\u51b5\u4e0b\u4f7f\u7528\u3002\u5728\u5168\u53cc\u5de5\u65f6\u88ab\u53d7\u5230\u53d1\u9001\u5b8c\u6210\u603b\u7ebf\u7a7a\u95f2\u7684\u5e72\u6270\u3002\u6240\u4ee5\u5728\u6570\u636e\u63a5\u6536\u65b9\u5f0f\u4e0a\u4e3b\u8981\u4f7f\u7528\u4e2d\u65ad\u3002<\/p>\n \n\t\u5728\u6570\u636e\u63a5\u6536\u4e2d\u65ad\u65b9\u9762\u8fd8\u5206\u4e8c\u79cd\u65b9\u5f0f\uff0c<\/p>\n \n\t\u65b9\u5f0f1\uff1a\u987a\u5e8f\u63a5\u6536\uff0c\u5728\u63a5\u6536\u5230\u7b2c\u4e00\u4e2a\u6570\u636e\u65f6\u5c31\u89e6\u53d1\u8d85\u65f6\u5b9a\u65f6\u5668<\/u>\uff0c\u6bcf\u63a5\u6536\u5230\u4e00\u4e2a\u5b57\u8282\u65f6\u5c31\u6e05\u4e00\u6b21\u5b9a\u65f6\u5668\uff0c\u90fd\u5230\u4e00\u7ec4\u6570\u636e\u63a5\u6536\u5b8c\u6bd5\uff0c\u5b9a\u65f6\u5668\u4f1a\u56e0\u4e3a\u89e6\u53d1\u8d85\u65f6\u4e2d\u65ad\u3002\u5728\u8d85\u65f6\u4e2d\u65ad\u4e2d\u6765\u5224\u65ad\u4e00\u7ec4\u6570\u636e\u88ab\u63a5\u6536\u3002\u8fd9\u79cd\u65b9\u5f0f\u4e00\u822c\u4f1a\u7528\u5230\u5b9e\u65f6\u6027\u7684\u4e00\u4e9b\u534f\u8bae\u4e2d\uff0c\u6bd4\u5982MODBUS\u3002<\/p>\n \n\t\u65b9\u5f0f2\uff1a\u961f\u5217\u63a5\u6536\uff0c\u7533\u8bf7\u4e00\u4e2a\u7f13\u51b2\u533a\u6536\u5c3e\u76f8\u63a5\uff0c\u63a5\u6536\u5230\u6570\u636e\u65f6\u8f7d\u5165\u961f\u5217\u4e4b\u4e2d\uff0c\u7528\u6237\u53ea\u8981\u5b9a\u65f6\u7684\u53bb\u961f\u5217\u4e2d\u8bfb\u6570\u636e\uff0c\u6765\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u3002\u8fd9\u79cd\u65b9\u5f0f\u662fwindow\uff0clinux<\/u>\u7684\u9a71\u52a8\u4e3b\u8981\u63a5\u6536\u65b9\u5f0f\u3002\u4ed6\u7684\u4f18\u70b9\u5c31\u5728\u4e8e\u5728\u4f7f\u7528\u6570\u636e\u65f6\u65e0\u9700\u5173\u95ed\u4e2d\u65ad\u3002\u4e5f\u5c31\u4e0d\u7528\u601b\u5fc3\u5728\u5904\u7406\u4e0a\u4e00\u7ec4\u6570\u636e\u65f6\u4e86\u6765\u65b0\u7684\u6570\u636e\u4f1a\u7834\u574f\u4e0a\u7ec4\u6570\u636e\u5185\u5bb9\u3002\u5728\u65b9\u5f0f1\u4e2d\u9700\u8981\u8003\u8651\u5728\u5904\u7406\u6570\u636e\u65f6\u6682\u65f6\u6027\u7684\u5173\u4e0b\u4e2d\u65ad\u3002<\/p>\n \n\t\u4ee5\u4e0b\u7a0b\u5e8f\u5219\u4e3b\u8981\u662f\u4f7f\u7528\u5230\u63a5\u6536\u4f7f\u7528\u65b9\u5f0f2\uff0c\u53d1\u9001\u6570\u636e\u4f7f\u7528\u6a21\u5f0f3\u7684DMA\u53d1\u9001\uff0c\u672c\u9a71\u52a8\u7a0b\u5e8f\u4e3a\u53ef\u88c1\u5207\uff0c\u8986\u76d6\u4e32\u53e31-8\uff0c\u901a\u8fc7\u5b8f\u88c1\u5207\u3002\u4e0b\u9762\u63d0\u4f9b\u4e86\u4e00\u4e9b\u63a5\u53e3\uff0c\u8fd9\u91cc\u5bf9\u63a5\u53e3\u505a\u4e00\u4e2a\u5927\u6982\u7684\u8bf4\u660e\u3002<\/p>\n \n\t\u6253\u5f00\u4e32\u53e3<\/p>\n \n\tvoid BSP_UartOpen\uff08uint8_t COM\uff0c uint32_t baud\uff0c uint8_t data\uff0c uint8_t stop\uff0c uint8_t parity\uff09;<\/p>\n \n\t\u5173\u95ed\u4e32\u53e3<\/p>\n \n\tvoid BSP_UartClose\uff08uint8_t COM\uff09;<\/p>\n \n\t\u5411\u4e32\u53e3\u4e2d\u5199\u6570\u636e<\/p>\n \n\tuint32_t BSP_UartWrite<\/u>\uff08uint8_t COM\uff0c uint8_t *bufft<\/u>er\uff0c uint32_t len\uff09;<\/p>\n \n\t\u4ece\u4e32\u53e3\u4e2d\u8bfb\u6570\u636e<\/p>\n \n\tuint32_t BSP_UartRead\uff08uint8_t COM\uff0c uint8_t *buffter\uff0c uint32_t len\uff09;<\/p>\n \n\t\u67e5\u8be2\u4e32\u53e3\u53d1\u9001\u5fd9\u788c\u72b6\u6001<\/p>\n \n\tuint32_t BSP_UartTxIdleState\uff08uint8_t COM\uff09;<\/p>\n \n\t\u8fd9\u4e2a\u63a5\u53e3\u4e3b\u8981\u7528\u5728\uff0c\u5411\u4e32\u53e3\u5199\u6570\u636e\u540e\uff0c\u5728\u8fdb\u884c\u4e0b\u4e00\u6b21\u5199\u6570\u636e\u4e4b\u524d\u9700\u8981\u8fdb\u884c\u67e5\u8be2\u3002 \u4e4b\u524d\u4e00\u76f4\u5728\u505a\u9a71\u52a8\u65b9\u9762\u7684\u6574\u7406\u5de5\u4f5c\uff0c\u5bf9\u9a71\u52a8\u7684\u9ad8\u6548\u6027\u6709\u4e00\u4e9b\u81ea\u5df1\u7684\u7406\u89e3\u8fd9\u91cc\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002\u5e76\u5949\u9a71\u52a8\u7a0b\u5e8f\uff0c\u672c\u7a0b\u5e8f\u8986\u76d6 uart 1-8\u3002 \u4e32\u53e3\u9a71\u52a8\uff0c\u8fd9\u662f\u5728\u6bcf\u4e2a \u5355\u7247\u673a \u4e2d\u53ef\u4ee5\u8bf4\u662f\u5fc5\u5907 \u63a5\u53e3<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2843"}],"collection":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2843"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2843\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2843"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n\t\u6765\u6e90\uff1b21ic<\/p>\n","protected":false},"excerpt":{"rendered":"