{"id":43679,"date":"2023-09-29T15:28:02","date_gmt":"2023-09-29T07:28:02","guid":{"rendered":"\/\/www.dealsbon.com\/?p=43679"},"modified":"2023-09-29T15:28:02","modified_gmt":"2023-09-29T07:28:02","slug":"syldgcjdz","status":"publish","type":"post","link":"\/\/www.dealsbon.com\/blog\/43679.html","title":{"rendered":"\u4f7f\u7528libmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740"},"content":{"rendered":"
Libmodbus\u662f\u4e00\u4e2a\u5f00\u6e90\u7684Modbus\u901a\u4fe1\u5e93\uff0c\u7528\u4e8e\u5728Linux\u548cWindows\u7cfb\u7edf\u4e0a\u5b9e\u73b0Modbus RTU\u548cTCP\u534f\u8bae\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4ece\u673a\u548c\u4e3b\u673a\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u4ece\u800c\u5e2e\u52a9\u7528\u6237\u8f7b\u677e\u5b9e\u73b0\u7269\u8054\u7f51\u5e94\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecdlibmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5982\u4f55\u5b9e\u73b0\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u57fa\u672c\u529f\u80fd\u3002<\/p>\n
\u4ece\u673a\u5730\u5740\u662fModbus\u534f\u8bae\u4e2d\u7528\u4e8e\u6807\u8bc6\u4ece\u673a\u7684\u4e00\u4e2a\u6570\u5b57\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u6807\u8bc6\u4ece\u673a\u7684\u8bbe\u5907\u7c7b\u578b\u3001\u529f\u80fd\u548c\u578b\u53f7\u7b49\u4fe1\u606f\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u4ece\u673a\u5730\u5740\u662f\u4e00\u4e2a\u4ece0\u5230247\u7684\u6570\u5b57\uff0c\u5176\u4e2d0\u8868\u793a\u4e3b\u673a\uff0c1\u8868\u793a\u4ece\u673a1\uff0c2\u8868\u793a\u4ece\u673a2\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n
\u9996\u5148\uff0c\u4f7f\u7528libmodbus\u5e93\uff0c\u9700\u8981\u5148\u5bf9libmodbus\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u8fd9\u6837\u624d\u80fd\u591f\u4f7f\u7528libmodbus\u8fdb\u884cModbus\u901a\u4fe1\u3002libmodbus\u7684\u521d\u59cb\u5316\u5305\u62ec\uff1a\u521b\u5efamodbus_t\u7ed3\u6784\u4f53\uff0c\u8bbe\u7f6eModbus\u534f\u8bae\u7c7b\u578b\uff0c\u8bbe\u7f6eModbus\u4ece\u673a\u5730\u5740\uff0c\u4ee5\u53ca\u8bbe\u7f6eModbus\u901a\u4fe1\u53c2\u6570\u7b49\u3002<\/p>\n
\u5728libmodbus\u4e2d\uff0c\u4f7f\u7528modbus_set_slave()\u51fd\u6570\u53ef\u4ee5\u8bbe\u7f6elibmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740\u3002\u6b64\u51fd\u6570\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff1amodbus_t\u7ed3\u6784\u4f53\u548c\u4ece\u673a\u5730\u5740\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a\u4ece\u673a\u5730\u5740\uff0c\u6bcf\u4e2a\u5730\u5740\u4e4b\u95f4\u7528\u9017\u53f7\u9694\u5f00\u3002<\/p>\n
\u4f7f\u7528libmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4ece\u673a\u548c\u4e3b\u673a\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u4ece\u800c\u5b9e\u73b0\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u57fa\u672c\u529f\u80fd\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u53ef\u4ee5\u4f7f\u7528modbus_read_registers()\u51fd\u6570\u4ece\u4ece\u673a\u8bfb\u53d6\u5bc4\u5b58\u5668\u6570\u636e\uff0cmodbus_write_registers()\u51fd\u6570\u53ef\u4ee5\u5411\u4ece\u673a\u5199\u5165\u5bc4\u5b58\u5668\u6570\u636e\uff0cmodbus_read_bits()\u51fd\u6570\u53ef\u4ee5\u4ece\u4ece\u673a\u8bfb\u53d6\u4f4d\u6570\u636e\uff0cmodbus_write_bits()\u51fd\u6570\u53ef\u4ee5\u5411\u4ece\u673a\u5199\u5165\u4f4d\u6570\u636e\uff0cmodbus_report_slave_id()\u51fd\u6570\u53ef\u4ee5\u4ece\u4ece\u673a\u8bfb\u53d6\u4ece\u673aID\uff0cmodbus_send_raw_request()\u51fd\u6570\u53ef\u4ee5\u53d1\u9001\u539f\u59cbModbus\u8bf7\u6c42\u7b49\u3002<\/p>\n
\u672c\u6587\u4ecb\u7ecd\u4e86libmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5982\u4f55\u5b9e\u73b0\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u57fa\u672c\u529f\u80fd\u3002<\/strong>\u4ece\u673a\u5730\u5740\u662fModbus\u534f\u8bae\u4e2d\u7528\u4e8e\u6807\u8bc6\u4ece\u673a\u7684\u4e00\u4e2a\u6570\u5b57\uff0c\u4f7f\u7528libmodbus\u591a\u4e2a\u4ece\u673a\u5730\u5740\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4ece\u673a\u548c\u4e3b\u673a\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u4ece\u800c\u5b9e\u73b0\u591a\u4e2a\u4ece\u673a\u5730\u5740\u7684\u57fa\u672c\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" Libmodbus\u662f\u4e00\u4e2a\u5f00\u6e90\u7684Modbus\u901a\u4fe1\u5e93\uff0c\u7528\u4e8e\u5728Linux\u548cWindows\u7cfb\u7edf\u4e0a\u5b9e\u73b0ModbusRTU\u548cTCP\u534f\u8bae\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4ece\u673a\u548c\u4e3b\u673a\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u4ece\u800c\u5e2e\u52a9<\/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":[78],"class_list":["post-43679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-m-3"],"_links":{"self":[{"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/posts\/43679"}],"collection":[{"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/comments?post=43679"}],"version-history":[{"count":0,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/posts\/43679\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/media?parent=43679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/categories?post=43679"},{"taxonomy":"post_tag","embeddable":true,"href":"\/\/www.dealsbon.com\/wp-json\/wp\/v2\/tags?post=43679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}