{"id":40867,"date":"2023-09-28T02:07:12","date_gmt":"2023-09-27T18:07:12","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=40867"},"modified":"2023-09-28T02:07:12","modified_gmt":"2023-09-27T18:07:12","slug":"lckbtl","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/40867.html","title":{"rendered":"Linux c \u4e32\u53e3\u6ce2\u7279\u7387"},"content":{"rendered":"

  \u4e32\u53e3\uff08Serial Port\uff09\u662f\u8ba1\u7b97\u673a\u7684\u4e00\u79cd\u901a\u4fe1\u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u5c06\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u8fde\u63a5\u8d77\u6765\uff0c\u4f7f\u8ba1\u7b97\u673a\u80fd\u591f\u4e0e\u5916\u90e8\u8bbe\u5907\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u3002Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u662f\u6307Linux c \u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7684\u4e32\u53e3\u6ce2\u7279\u7387\uff0c\u5b83\u662f\u63a7\u5236\u4e32\u53e3\u6570\u636e\u4f20\u8f93\u901f\u7387\u7684\u4e00\u79cd\u6280\u672f\u6307\u6807\uff0c\u5b83\u662f\u7531\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u51b3\u5b9a\u7684\u3002<\/strong><\/p>\n

Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u7684\u6982\u5ff5<\/h2>\n

  Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u662f\u6307Linux c \u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7684\u4e32\u53e3\u6ce2\u7279\u7387\uff0c\u5b83\u662f\u63a7\u5236\u4e32\u53e3\u6570\u636e\u4f20\u8f93\u901f\u7387\u7684\u4e00\u79cd\u6280\u672f\u6307\u6807\uff0c\u5b83\u662f\u7531\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u51b3\u5b9a\u7684\u3002<\/strong>\u4e32\u53e3\u6ce2\u7279\u7387\u662f\u6307\u6bcf\u79d2\u4f20\u8f93\u7684\u6bd4\u7279\u6570\uff0c\u5355\u4f4d\u662f\u6bd4\u7279\/\u79d2\uff08bps\uff09\uff0c\u4e5f\u79f0\u4e3a\u6ce2\u7279\u7387\uff08Baud Rate\uff09\u3002\u5b83\u662f\u4e32\u53e3\u901a\u4fe1\u4e2d\u6700\u5e38\u7528\u7684\u6280\u672f\u6307\u6807\uff0c\u5b83\u662f\u7531\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u51b3\u5b9a\u7684\u3002<\/p>\n

  Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u7684\u8bbe\u5b9a<\/h3>\n

  Linux c \u7a0b\u5e8f\u4e2d\u7684\u4e32\u53e3\u6ce2\u7279\u7387\u53ef\u4ee5\u901a\u8fc7\u7a0b\u5e8f\u63a7\u5236\u6765\u8bbe\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u5907\u9a71\u52a8\u7a0b\u5e8f\u6765\u8bbe\u5b9a\u3002\u5982\u679c\u8981\u5728Linux c \u7a0b\u5e8f\u4e2d\u8bbe\u5b9a\u4e32\u53e3\u6ce2\u7279\u7387\uff0c\u53ef\u4ee5\u4f7f\u7528\u7cfb\u7edf\u8c03\u7528\u51fd\u6570tcsetattr()\u6216ioctl()\u6765\u5b9e\u73b0\uff0c\u5176\u4e2dtcsetattr()\u51fd\u6570\u7528\u4e8e\u8bbe\u7f6e\u7ec8\u7aef\u7684\u6ce2\u7279\u7387\u3001\u6821\u9a8c\u4f4d\u7b49\u53c2\u6570\uff0cioctl()\u51fd\u6570\u7528\u4e8e\u63a7\u5236\u4e32\u53e3\u7684\u8bbe\u5907\u9a71\u52a8\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6e\u4e32\u53e3\u7684\u6ce2\u7279\u7387\u7b49\u53c2\u6570\u3002<\/p>\n

  Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u7684\u5e38\u7528\u503c<\/h3>\n

  Linux c \u7a0b\u5e8f\u4e2d\u4e32\u53e3\u6ce2\u7279\u7387\u7684\u5e38\u7528\u503c\u6709\uff1a2400bps\u30014800bps\u30019600bps\u300119200bps\u300138400bps\u300157600bps\u3001115200bps\u7b49\u3002\u5176\u4e2d\uff0c2400bps\u662f\u6700\u4f4e\u7684\u6ce2\u7279\u7387\uff0c115200bps\u662f\u6700\u9ad8\u7684\u6ce2\u7279\u7387\uff0c\u5b83\u4eec\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u6765\u9009\u62e9\u3002<\/p>\n

Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u7684\u5e94\u7528<\/h2>\n

  Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u53ef\u4ee5\u7528\u4e8e\u63a7\u5236Linux c \u7a0b\u5e8f\u4e2d\u7684\u4e32\u53e3\u6570\u636e\u4f20\u8f93\u901f\u7387\uff0c\u4ece\u800c\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u63a7\u5236\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u4f8b\u5982\u53ef\u4ee5\u7528\u4e8e\u63a7\u5236\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u5982\u63a7\u5236\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u786c\u4ef6\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u6bd4\u5982\u63a7\u5236\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u6253\u5370\u673a\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u4ee5\u53ca\u63a7\u5236\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u7f51\u7edc\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u7b49\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u662f\u6307Linux c \u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7684\u4e32\u53e3\u6ce2\u7279\u7387\uff0c\u5b83\u662f\u63a7\u5236\u4e32\u53e3\u6570\u636e\u4f20\u8f93\u901f\u7387\u7684\u4e00\u79cd\u6280\u672f\u6307\u6807\uff0c\u5b83\u662f\u7531\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u901f\u7387\u51b3\u5b9a\u7684\u3002<\/strong>Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u53ef\u4ee5\u901a\u8fc7\u7a0b\u5e8f\u63a7\u5236\u6765\u8bbe\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u5907\u9a71\u52a8\u7a0b\u5e8f\u6765\u8bbe\u5b9a\u3002Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u7684\u5e38\u7528\u503c\u6709\uff1a2400bps\u30014800bps\u30019600bps\u300119200bps\u300138400bps\u300157600bps\u3001115200bps\u7b49\uff0c\u5b83\u4eec\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u6765\u9009\u62e9\u3002Linux c \u4e32\u53e3\u6ce2\u7279\u7387\u53ef\u4ee5\u7528\u4e8e\u63a7\u5236Linux c \u7a0b\u5e8f\u4e2d\u7684\u4e32\u53e3\u6570\u636e\u4f20\u8f93\u901f\u7387\uff0c\u4ece\u800c\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e32\u53e3\uff08SerialPort\uff09\u662f\u8ba1\u7b97\u673a\u7684\u4e00\u79cd\u901a\u4fe1\u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u5c06\u8ba1\u7b97\u673a\u4e0e\u5916\u90e8\u8bbe\u5907\u8fde\u63a5\u8d77\u6765\uff0c\u4f7f\u8ba1\u7b97\u673a\u80fd\u591f\u4e0e\u5916\u90e8\u8bbe\u5907\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u3002Linuxc\u4e32\u53e3\u6ce2\u7279\u7387\u662f\u6307<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[69],"class_list":["post-40867","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-cktx"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/40867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=40867"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/40867\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=40867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=40867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=40867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}