{"id":51601,"date":"2026-08-04T21:03:28","date_gmt":"2026-08-04T13:03:28","guid":{"rendered":"https:\/\/www.modbus.cn\/51601.html"},"modified":"2026-08-04T21:03:28","modified_gmt":"2026-08-04T13:03:28","slug":"visualhmi-%e5%b1%8f%e5%b9%95%e6%97%8b%e8%bd%ac%ef%bc%9aset_lcd_rotate-%e4%b8%8e%e5%a4%9a%e6%96%b9%e5%90%91-bin","status":"publish","type":"post","link":"http:\/\/www.modbus.cn\/en\/51601.html","title":{"rendered":"VisualHMI \u5c4f\u5e55\u65cb\u8f6c\uff1aset_lcd_rotate \u4e0e\u591a\u65b9\u5411 bin"},"content":{"rendered":"<p>\u8fd0\u884c\u671f\u6574\u4f53\u65cb\u8f6c UI\uff080\u00b0\/90\u00b0\/180\u00b0\/270\u00b0\uff09\uff0c\u624b\u6301\u5668\u3001\u7ad6\u88c5\u673a\u67dc\u90fd\u9002\u7528\u3002\u4e00\u5957 Lua \u9002\u914d\u6240\u6709\u59ff\u6001\uff0cDX \u7cfb\u5217\u4e13\u5c5e\u3002<\/p>\n<h2>1. Lua \u63a7\u5236\u65cb\u8f6c<\/h2>\n<pre style=\"background:#f5f5f5;padding:10px;border-radius:4px\">set_lcd_rotate(angle)  -- angle: 0~3 (0=0\u00b0,1=90\u00b0,2=180\u00b0,3=270\u00b0)\n\nfunction on_init()\n  local angle = get_uint16(VT_RW, 0x0001)  -- \u4eceFlash\u8bfb\u65cb\u8f6c\u65b9\u5411\n  angle = (angle &lt; 0 or angle &gt; 3) and 0 or angle\n  set_lcd_rotate(angle)\n  set_uint16(VT_LW, 0x8888, angle)\nend\n\nfunction on_update(slave,vtype,addr)\n  if vtype == VT_LW and addr == 0x8888 then\n    local val = get_uint16(VT_LW, 0x8888)\n    set_uint16(VT_RW, 0x0001, val)  -- \u5b58\u65cb\u8f6c\u65b9\u5411\n    set_lcd_rotate(val)\n  end\nend<\/pre>\n<p><!-- MISSING ot09_Screen_Rotate_1.png --><\/p>\n<h2>2. \u751f\u6210\u591a\u65b9\u5411\u6587\u4ef6<\/h2>\n<p>\u6a2a\u5c4f\u5de5\u7a0b\uff080\u00b0\/180\u00b0\uff09\u7f16\u8bd1\u4e24\u6b21\uff1a0\u00b0 \u4fdd\u7559\u9ed8\u8ba4 image.bin\/project.bin\uff1b180\u00b0 \u91cd\u547d\u540d\u4e3a image180.bin\/project180.bin \u653e\u8fdb private\u3002\u7ad6\u5c4f\u5de5\u7a0b\uff0890\u00b0\/270\u00b0\uff09\u540c\u7406\u751f\u6210 image90\/image270 \u653e\u5165 private\u3002private \u76ee\u5f55\u6700\u7ec8\u542b 8 \u4e2a\u6838\u5fc3\u6587\u4ef6\uff0c\u542f\u52a8\u65f6\u9ed8\u8ba4\u52a0\u8f7d 0\u00b0\uff0c\u8fd0\u884c\u65f6\u5207\u65b9\u5411\u81ea\u52a8\u52a0\u8f7d\u5bf9\u5e94 bin\u3002<\/p>\n<p><!-- MISSING ot09_Screen_Rotate_2.png --><\/p>\n<p><!-- MISSING ot09_Screen_Rotate_3.png --><\/p>\n<div class=\"tip\" style=\"border-left:4px solid #f7941e;padding:10px 14px;background:#fff8ef;margin:14px 0\">\u5c4f\u5e55\u65cb\u8f6c\u6ce8\u610f\uff1a<strong>\u6a2a\u5c4f\u548c\u7ad6\u5c4f\u7684 Lua \u811a\u672c\u903b\u8f91\u5b8c\u5168\u4e00\u81f4<\/strong>\uff0c\u5dee\u5f02\u53ea\u5728\u7f16\u8bd1\u51fa\u7684 bin \u6587\u4ef6\uff08imageXXX.bin\/projectXXX.bin\uff09\u3002\u5f00\u53d1\u8005\u53ea\u7ef4\u62a4\u4e00\u5957\u5de5\u7a0b\uff0c\u6309\u65b9\u5411\u7f16\u8bd1\u56db\u6b21\u547d\u540d\u597d\u4e22\u8fdb private \u5373\u53ef\u3002DX \u7cfb\u5217\u4e13\u5c5e\u3002<\/div>\n<p style=\"color:#888;font-size:13px\">\u6574\u7406\u81ea \u5e7f\u5dde\u5927\u5f69\u79d1\u6280 VisualHMI \u5f00\u53d1\u6587\u6863\uff08hmi-doc.gz-dc.com\uff09\u5176\u4ed6\u6280\u672f\u6559\u7a0b\u300c\u5c4f\u5e55\u65cb\u8f6c\u300d\uff0c\u7248\u6743\u5f52\u5927\u5f69\u79d1\u6280\u6240\u6709\u3002<\/p>\n<span id=\"magicpostMarker\"><\/span>","protected":false},"excerpt":{"rendered":"<p>\u8fd0\u884c\u671f\u6574\u4f53\u65cb\u8f6c UI\uff080\u00b0\/90\u00b0\/180\u00b0\/270\u00b0\uff09\uff0c\u624b&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[3126,3132],"tags":[3422,3425,3415,3424,3134,3423],"class_list":["post-51601","post","type-post","status-publish","format-standard","hentry","category-hmi-dev","category-hmi-other","tag-dx","tag-imagexxx-bin","tag-private","tag-set_lcd_rotate","tag-visualhmi","tag-3423"],"_links":{"self":[{"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/posts\/51601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/comments?post=51601"}],"version-history":[{"count":0,"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/posts\/51601\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/media?parent=51601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/categories?post=51601"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.modbus.cn\/en\/wp-json\/wp\/v2\/tags?post=51601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}