"# AV\u8f93\u5165\u63a7\u4ef6\uff08M\u7cfb\u5217\uff09\u5982\u4f55\u4f7f\u7528\uff1f\n\n> 2022-03-21 | 2026-07-01\n> https:\/\/www.modbus.cn\/en\/7157.html\n\n**\u57fa\u7840\u63a7\u4ef6\u6587\u6863, \u89e6\u63a7\u5c4f\u5f00\u53d1\u6587\u6863**\n\n---\n\n## \u4ec0\u4e48\u662f\u89c6\u9891AV\u63a7\u4ef6\uff1f\n\n\u5e26AV\u6444\u50cf\u5934\u8f93\u5165\u7684\u7269\u8054\u578b\u4e32\u53e3\u652f\u6301AV\u4fe1\u53f7\u8f93\u5165\u663e\u793a\uff0c\u5e38\u7528\u4e8e\u7f8e\u5bb9\u4eea\u884c\u4e1a\u7684\u76ae\u80a4\u62a4\u7406\u3001\u5934\u53d1\u68c0\u6d4b\u7b49\n\n![Video01](https:\/\/image.modbus.cn\/wp-content\/uploads\/2022\/03\/Video01-2.png)\n\n\u9488\u5bf9M\u578b\u7cfb\u5217\u7684\u89c6\u9891\u64ad\u653e\/AV\u8f93\u5165\u529f\u80fd\u65f6\uff0c\u89c6\u9891\u56fe\u5c42\u4f1a\u4e00\u76f4\u663e\u793a\u5728\u6700\u4e0a\u5c42\uff0c\u6b64\u65f6\u5982\u679c\u6211\u4eec\u5c06\u6587\u5b57\u7b49\u5176\u4ed6\u56fe\u5f62\u53e0\u52a0\u653e\u5728\u89c6\u9891\u63a7\u4ef6\u4e0a\u663e\u793a\u65f6\uff0c\u89c6\u9891\u56fe\u5c42\u4f1a\u5c06\u5176\u4ed6\u56fe\u5f62\u90fd\u8986\u76d6\uff0c\u5bfc\u81f4\u53ea\u80fd\u663e\u793a\u51fa\u89c6\u9891\uff0c\u800c\u65e0\u6cd5\u663e\u793a\u89c6\u9891\u4e0a\u53e0\u653e\u7684\u5176\u4ed6\u6587\u5b57\u548c\u56fe\u5f62\u3002\u4e3a\u6b64\uff0c\u6211\u53f8\u9488\u5bf9\u6709\u6b64\u7c7b\u9700\u6c42\u7684\u5ba2\u6237\u5f00\u53d1\u4e86\u5bf9\u5e94\u7684M\u7cfb\u5217\u89c6\u9891\u5e95\u5c42\u64ad\u653eAPI\u63a5\u53e3\uff0c\u6765\u6ee1\u8db3\u6b64\u7c7b\u5ba2\u6237\u7684\u9700\u6c42\uff0capi\u51fd\u6570\u63a5\u53e3\u5982\u4e0b\u6240\u793a\n\n#### set_color_key(Min_Color,Max_Color,Match)\n\n\u51fd\u6570\u8bf4\u660e\uff1a\n\n- Min_Color\uff1a24\u4f4dRGB\u989c\u8272\u8303\u56f4\u7684\u6700\u5c0f\u503c\uff0c\u4f8b\u59820x00BFBFBF\uff0cR-BF\/G-BF\/B-BF\uff1b- Min_Color\uff1a24\u4f4dRGB\u989c\u8272\u8303\u56f4\u7684\u6700\u5927\u503c\uff0c\u4f8b\u59820x00C8C8C8\uff0cR-C8\/G-C8\/B-C8\uff1b- Match\uff1a6\u4f4d\u7684\u6bd4\u8f83\u89c4\u5219101010(2A)\uff1b10-R\/10-G\/10-B\uff0c\u4ee3\u8868\u989c\u8272\u8303\u56f4\u57280x00BFBFBF\u20140x00C8C8C8\u4e4b\u95f4\u7684\u989c\u8272\u503c\u7ecf\u8fc7\u6bd4\u8f83\u540e\u4f1a\u88ab\u8fc7\u6ee4\u3002(0x00BFBFBF &lt;= color &lt;= 0x00C8C8C8\u4e4b\u95f4\u7684\u989c\u8272\u4f1a\u88ab\u8fc7\u6ee4\uff0c\u5176\u4ed6\u989c\u8272\u4f1a\u663e\u793a\u51fa\u6765)\n\n```\nfunction on_init()\n\u3000\u3000\u3000\u3000set_color_key(0x00BFBFBF,0x00C8C8C8,0x0000002A)\nend\n```\n\n\u6ce8\uff1aset_color_key(Min_Color,Max_Color,Match)\uff0c\u6b64API\u63a5\u53e3\u51fd\u6570\u5fc5\u987b\u8981\u653e\u5728on_init()\u7cfb\u7edf\u521d\u59cb\u5316\u51fd\u6570\u4e2d\u4f7f\u7528\uff0c\u9ed8\u8ba4\u5728\u521d\u59cb\u65f6\u914d\u7f6e\u7684\u5c5e\u6027\n\n\u9002\u7528\u8303\u56f4\uff1aM\u7cfb\u5217\n\n\u76f8\u5173\u4f8b\u7a0b\u4e0b\u8f7d\u94fe\u63a5\uff1a\n\n- \u300aM\u7cfb\u5217 AV\u8f93\u5165\u300b(\u70b9\u51fb\u8df3\u8f6c)\n\n## 20.1 \u89c6\u9891AV\u63a7\u4ef6\u5c5e\u6027\u4ecb\u7ecd\n\n![AV01](https:\/\/image.modbus.cn\/wp-content\/uploads\/2022\/03\/AV01.png)\n\n#### \u7528\u9014\n\n\u9009\u4e2d\u89c6\u9891\u63a7\u4ef6\uff0c\u5728\u5c5e\u6027\u7a97\u53e3\u4e2d\u9009\u62e9\u201c\u64ad\u653eAV\u8f93\u5165\u201d\n\n## 20.2 AV\u8f93\u5165\u5750\u6807\u663e\u793a\n\n\u3010AV\u8f93\u5165\u5750\u6807\u663e\u793a\u3011\u753b\u9762\uff0c\u4ecb\u7ecd\u914d\u7f6eLUA\u811a\u672c\u7684AV\u5e94\u7528\uff0c\u7ed3\u5408\u6309\u94ae\u4e0a\u4e0b\u5de6\u53f3\u79fb\u52a8\uff0c\u663e\u793a\u2018\u5341\u5b57\u7ebf\u2019\n\n![AV05](https:\/\/image.modbus.cn\/wp-content\/uploads\/2022\/03\/AV05.png)\n\n#### \u5c5e\u6027\u914d\u7f6e\n\n\u89c6\u9891\u63a7\u4ef6\u914d\u7f6e\n\n\u89c6\u9891\u63a7\u4ef6\u914d\u7f6e\u62d6\u52a8\u9009\u62e9\u89c6\u9891\u63a7\u4ef6\uff0c\u7528\u9014\u9009\u62e9\u64ad\u653eAV\u8f93\u5165\uff0c\u5982\u4e0b\u6240\u793a\n\n![AV01](https:\/\/image.modbus.cn\/wp-content\/uploads\/2022\/03\/AV01.png)\n\n\u6309\u94ae\u914d\u7f6e\n\n\u6309\u94ae\u63a7\u4ef6\u4e0a\uff08\u63a7\u4ef6ID6\uff09\uff1a\u63a7\u5236\u5341\u5b57\u5149\u6807\u663e\u793a\u5750\u6807y\u51cf\n\n\u6309\u94ae\u63a7\u4ef6\u4e0b\uff08\u63a7\u4ef6ID8\uff09\uff1a\u63a7\u5236\u5341\u5b57\u5149\u6807\u663e\u793a\u5750\u6807y\u52a0\n\n\u6309\u94ae\u63a7\u4ef6\u5de6\uff08\u63a7\u4ef6ID7\uff09\uff1a\u63a7\u5236\u5341\u5b57\u5149\u6807\u663e\u793a\u5750\u6807x\u51cf\n\n\u6309\u94ae\u63a7\u4ef6\u53f3\uff08\u63a7\u4ef6ID9\uff09\uff1a\u63a7\u5236\u5341\u5b57\u5149\u6807\u663e\u793a\u5750\u6807x\u52a0\n\n\u5c5e\u6027\u914d\u7f6e\u5982\u4e0b\u6240\u793a\n\n![AV06](https:\/\/image.modbus.cn\/wp-content\/uploads\/2022\/03\/AV06.png)\n\nLUA\u811a\u672c\u63a7\u5236\n\n## 20.3 LUA\u811a\u672c\u903b\u8f91\u5b9e\u73b0\n\nLUA\u811a\u672c\u914d\u7f6e\u5b9e\u73b0\u4ee3\u7801\uff1a\n\n```\n-- \u5341\u5b57\u5149\u6807\u5750\u6807\u663e\u793a\u70b9 \nlocal LineH_Y = 263                             --\u5341\u5b57\u663e\u793a\u5149\u6807\u70b9y\u5750\u6807\nlocal LineV_X = 240                             --\u5341\u5b57\u663e\u793a\u5149\u6807\u70b9x\u5750\u6807 \nlocal TextH_X = LineV_X + 5                        --\u5750\u6807text\u663e\u793a\u7684\u5750\u6807\u4f4d\u7f6e\nlocal TextH_Y = LineH_Y - 40 \nlocal TextV_X = LineV_X + 5\nlocal TextV_Y = LineH_Y - 20\nfunction on_init()                             --\u521d\u59cb\u5316\n    set_color_key(0x00BFBFBF,0x00C8C8C8,0x0000002A)             --\u8bbe\u7f6e\u989c\u8272\u8fc7\u6ee4\u5c5e\u6027\uff08\u5fc5\u987b\u5728on_init()\u4e2d\u914d\u7f6e\uff09\nend\n\nfunction on_draw(screen)                          --\u754c\u9762\u5237\u65b0\u56de\u8c03\u51fd\u6570\uff0c\u5177\u4f53\u4f7f\u7528\u8bf4\u660e\u53c2\u8003\u300aLUA\u811a\u672cAPI\u300b\n    if screen == 1 then\n        set_pen_color(0x3666)                        --\u8bbe\u7f6e\u753b\u7b14\u989c\u8272  \n        draw_line(40,LineH_Y,440,LineH_Y,1)                 --\u753b\u5341\u5b57\u7ebf  \n        draw_line(LineV_X,63,LineV_X,440,1)\n        local text_h = \"LineH_Y:\"..LineH_Y\n        local text_v = \"LineV_X:\"..LineV_X\n        draw_text(text_h,TextH_X,TextH_Y,90,20,4,0x3666,4)         --\u753b\u5750\u6807text\u663e\u793a\n        draw_text(text_v,TextV_X,TextV_Y,90,20,4,0x3666,4)\n    end \nend\n\nfunction on_control_notify(screen,control,value)              --\u89e6\u6478\u63a7\u4ef6\u56de\u8c03\u51fd\u6570\n    if screen == 1 then\n        if control == 6 then --\u4e0a\n            if value == 1 then\n                LineH_Y = LineH_Y - 1\n                if LineH_Y &lt; 63 then\n                    LineH_Y = 63\n                end\n            elseif value == 2 then\n                LineH_Y = LineH_Y - 5\n                if LineH_Y &lt; 63 then\n                    LineH_Y = 63\n                end\n            end\n        elseif control == 7 then --\u4e0b\n            if value == 1 then\n                LineV_X = LineV_X - 1\n                if LineV_X &lt; 63 then\n                    LineV_X = 63\n                end\n           elseif value == 2 then\n                LineV_X = LineV_X - 5\n                if LineV_X &lt; 63 then\n                    LineV_X = 63\n                end\n          end\n\n        elseif control == 8 then --\u5de6\n            if value == 1 then\n               LineH_Y = LineH_Y + 1\n               if LineH_Y &gt; 440 then\n                   LineH_Y = 463\n               end\n            elseif value == 2 then\n                LineH_Y = LineH_Y + 5\n                if LineH_Y &gt; 440 then\n                    LineH_Y = 463\n                end\n            end\n        elseif control == 9 then --\u53f3\n            if value == 1 then\n                LineV_X = LineV_X + 1\n                if LineV_X &gt; 440 then\n                    LineV_X = 440\n                 end\n            elseif value == 2 then\n                LineV_X = LineV_X + 5\n                if LineV_X &gt; 440 then\n                    LineV_X = 440\n                end\n            end\n        end\n        follow_pos(LineV_X,LineH_Y) --text\u663e\u793a\u5750\u6807\u4f20\u5165\n        redraw()\n    end\nend\n\nfunction on_press(state,x,y) --\u89e6\u6478\u5c4f\u70b9\u51fb\u56de\u8c03\u51fd\u6570                   \n    if get_current_screen() == 1 then\n        if state == 1 or state == 2 then\n            if x &gt;= 40 and x &lt;= 440 then\n                if y &gt;= 63 and y &lt;= 463 then\n                    follow_pos(x,y)\n                    LineV_X = x\n                    LineH_Y = y\n                    redraw()\n                end\n            end\n        end \n    end\nend\n\nfunction follow_pos(p_x,p_y) --text\u5750\u6807\u663e\u793a\n    if p_x &lt; 240 and p_y &lt; 263 then\n        TextV_X = p_x + 5\n        TextH_X = p_x + 5\n        TextV_Y = p_y + 5\n        TextH_Y = p_y + 25\n     elseif p_x &lt; 240 and p_y &gt; 263 then\n        TextV_X = p_x + 5\n        TextH_X = p_x + 5\n        TextV_Y = p_y - 40\n        TextH_Y = p_y - 20\n    elseif p_x &gt;= 240 and p_y &lt;= 263 then\n        TextV_X = p_x - 85\n        TextH_X = p_x - 85\n        TextV_Y = p_y + 5\n        TextH_Y = p_y + 25\n    elseif p_x &gt; 240 and p_y &gt; 263 then\n        TextV_X = p_x - 85\n        TextH_X = p_x - 85\n        TextV_Y = p_y - 40\n        TextH_Y = p_y - 20\n    end\nend\n```\n\n## 20.4 \u4e24\u8defAV\u5207\u6362\n\n#### \u6307\u4ee4\u5207\u6362\n\nM\u7cfb\u5217\u5e26\u4e24\u8defAV\u7684\u53ef\u4ee5\u652f\u6301\u6765\u56de\u5207\u6362\uff0c\u6307\u4ee4\u5982\u4e0b\u6240\u793a\n\n\u5e27\u5934\u7ec4\u6001\u6307\u4ee4\u529f\u80fd\u7801-AV\u901a\u9053\u5207\u6362\u753b\u9762ID\u63a7\u4ef6ID\u901a\u9053\u5e27\u5c3eEEB17700 0000 0100\/01FF FC FF FF\n\n\u5f53\u901a\u9053\u4e3a00\uff0c\u8868\u793a\u5207\u6362\u5230\u901a\u90530\u7684AV\u4fe1\u53f7\u8f93\u5165\uff0c\u5f53\u524d\u901a\u9053\u4e3a0x01\uff0c\u8868\u793a\u5207\u6362\u5230\u901a\u90531\u7684AV\u4fe1\u53f7\u8f93\u5165\n\n#### LUA API\u5207\u6362\n\nset_av_channel(channel)\n\n\u5207\u6362AV\u901a\u9053\uff0c\u4ec5M\u7cfb\u5217\u652f\u6301\n\n- channel = 0\uff0c\u5207\u6362\u5230\u901a\u90530- channel= 1\uff0c\u5207\u6362\u5230\u901a\u90531\n\n---\n*modbus.cn*\n"