广州大彩串口屏论坛_大彩开发者交流论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3040|回复: 2

Screen as Modbus slave, how to get access to register via LUA

[复制链接]

20

主题

53

帖子

268

积分

中级会员

Rank: 3Rank: 3

积分
268
发表于 2024-10-16 22:52:57 | 显示全部楼层 |阅读模式
Like in topic,
1. I need to create variable in VisualStudio only or I can made some struct from LUA level?
2. Mainly I need to operate at this variable from lua
回复

使用道具 举报

0

主题

759

帖子

2208

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2208
发表于 2024-10-17 11:08:31 | 显示全部楼层
1. Hello, as you said, after creating a variable in VisualStudio, it can be directly bound to the control, or you can use the logical processing in the protocol and variable to automatically handle the relationship between the variable and the control. To do so, you can refer to the Configuring Controls tutorial in the online documentation at https://doc.gz-dc.com/Modbus/Ctrls/01_Mb_basic.html
2. If you need to operate on the created variables in lua, you need to understand the API interface functions of lua, and use get_variant (name) to get the numeric value of the protocol variable. name: variable name. Use set_variant (name, value) to set the value of the protocol variable. Alternatively, you can use the encapsulated MB function to read and write the modbus registers directly. The website address is: https://doc.gz-dc.com/LUA/000_lu ... E%E8%AE%BF%E9%97%AE
Attached is a screenshot of the function:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

64

主题

252

帖子

6172

积分

版主

大彩爱好者Q群14769485

Rank: 7Rank: 7Rank: 7

积分
6172
QQ
发表于 2024-10-17 21:07:56 | 显示全部楼层
Sorry, my friend, I can't help you because I can't read English, but I sincerely wish you an early solution.
大彩爱好者Q群14769485
点我下载→TFT【易模块】封装好的函数库
点我下载→TFT屏可中文lua编辑器【好用】
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|广州大彩串口屏论坛_大彩开发者交流论坛

GMT+8, 2025-8-30 13:25 , Processed in 0.049208 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表