{"id":42033,"date":"2023-10-05T14:05:26","date_gmt":"2023-10-05T06:05:26","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=42033"},"modified":"2023-10-05T14:05:26","modified_gmt":"2023-10-05T06:05:26","slug":"edqfds","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/42033.html","title":{"rendered":"EasyModbus\u8bfb\u53d6\u6d6e\u70b9\u6570"},"content":{"rendered":"
EasyModbus\u662f\u4e00\u79cd\u8f6f\u4ef6\u5e93\uff0c\u53ef\u7528\u4e8e\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u548c\u5199\u5165\u6570\u636e\u3002\u5b83\u53ef\u4ee5\u8bfb\u53d6\u548c\u5199\u5165\u5e03\u5c14\u503c\u3001\u5b57\u8282\u3001\u5b57\u3001\u53cc\u5b57\u3001\u6d6e\u70b9\u6570\u548c\u957f\u6574\u6570\u3002\u672c\u6587\u5c06\u8ba8\u8bba\u5982\u4f55\u4f7f\u7528EasyModbus\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u6d6e\u70b9\u6570\u3002<\/p>\n
\u6d6e\u70b9\u6570\u662f\u4e00\u79cd\u6570\u5b57\u683c\u5f0f\uff0c\u7528\u4e8e\u8868\u793a\u5e26\u5c0f\u6570\u7684\u6570\u5b57\u3002\u5b83\u7531\u4e00\u4e2a\u6574\u6570\u90e8\u5206\u548c\u4e00\u4e2a\u5c0f\u6570\u90e8\u5206\u7ec4\u6210\uff0c\u4f7f\u7528\u79d1\u5b66\u8ba1\u6570\u6cd5\u8868\u793a\u3002\u6d6e\u70b9\u6570\u7684\u4f18\u70b9\u662f\u5b83\u4eec\u53ef\u4ee5\u8868\u793a\u6bd4\u6574\u6570\u66f4\u7cbe\u786e\u7684\u6570\u5b57\uff0c\u4f46\u662f\u5b83\u4eec\u7684\u7f3a\u70b9\u662f\u5b83\u4eec\u66f4\u5bb9\u6613\u51fa\u9519\uff0c\u56e0\u4e3a\u5b83\u4eec\u7684\u5c0f\u6570\u90e8\u5206\u53ef\u80fd\u4f1a\u88ab\u820d\u5165\u6216\u8005\u4e22\u5931\u3002<\/p>\n
EasyModbus\u53ef\u4ee5\u7528\u4e8e\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u6d6e\u70b9\u6570\u3002\u5b83\u53ef\u4ee5\u4f7f\u7528Modbus\u534f\u8bae\u8bfb\u53d6\u548c\u5199\u5165\u6d6e\u70b9\u6570\uff0c\u5b83\u7684\u8bfb\u5199\u64cd\u4f5c\u90fd\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u53ef\u4ee5\u5728\u591a\u7ebf\u7a0b\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u3002<\/p>\n
\u4f7f\u7528EasyModbus\u8bfb\u53d6\u6d6e\u70b9\u6570\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n
\u4ee5\u4e0b\u662f\u4f7f\u7528EasyModbus\u8bfb\u53d6\u6d6e\u70b9\u6570\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n
\/\/ \u521b\u5efaEasyModbus\u5b9e\u4f8b EasyModbus modbus = new EasyModbus();<\/p>
\/\/ \u8fde\u63a5\u5230Modbus\u8bbe\u5907<\/p>
modbus.connect(\"127.0.0.1\", 502);<\/p>
\/\/ \u8bfb\u53d6\u6d6e\u70b9\u6570<\/p>
float value = modbus.readFloat(0);<\/p>
\/\/ \u5173\u95ed\u8fde\u63a5<\/p>
modbus.disconnect();<\/p><\/code><\/pre>\n
\u603b\u7ed3<\/h2>\n
\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528EasyModbus\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u6d6e\u70b9\u6570\u7684\u65b9\u6cd5\u3002<\/strong>EasyModbus\u53ef\u4ee5\u7528\u4e8e\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u6d6e\u70b9\u6570\uff0c\u5b83\u7684\u8bfb\u5199\u64cd\u4f5c\u90fd\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u53ef\u4ee5\u5728\u591a\u7ebf\u7a0b\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u3002\u4f7f\u7528EasyModbus\u8bfb\u53d6\u6d6e\u70b9\u6570\u7684\u6b65\u9aa4\u662f\u5b89\u88c5EasyModbus\u5e93\u3001\u521b\u5efa\u4e00\u4e2aEasyModbus\u5b9e\u4f8b\u3001\u4f7f\u7528EasyModbus\u5b9e\u4f8b\u8fde\u63a5\u5230Modbus\u8bbe\u5907\u3001\u4f7f\u7528EasyModbus\u5b9e\u4f8b\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u6d6e\u70b9\u6570\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"EasyModbus\u662f\u4e00\u79cd\u8f6f\u4ef6\u5e93\uff0c\u53ef\u7528\u4e8e\u4eceModbus\u8bbe\u5907\u8bfb\u53d6\u548c\u5199\u5165\u6570\u636e\u3002\u5b83\u53ef\u4ee5\u8bfb\u53d6\u548c\u5199\u5165\u5e03\u5c14\u503c\u3001\u5b57\u8282\u3001\u5b57\u3001\u53cc\u5b57\u3001\u6d6e\u70b9\u6570\u548c\u957f\u6574\u6570\u3002\u672c\u6587\u5c06\u8ba8\u8bba\u5982\u4f55\u4f7f\u7528EasyModbus\u4ece<\/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-42033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-m-3"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/42033","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=42033"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/42033\/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=42033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=42033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=42033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}