VisualHMI control permissions: conditional display, hiding, enabling, and disabling

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

Control permission: Display/Touchable only when conditions are met, with a maximum of two condition combinations (AND/OR). Much cleaner than overlaying controls on each screen one by one.

1. Attribute

FieldDescription
Condition AddressJudgment Register
Comparison==, !=, <=, >=, <, >, IN (within range including boundaries), OUT (outside range excluding boundaries)
ValueComparison value; for IN/OUT, lower limit + upper limit are required to be filled in
Additional conditionAND/OR, second condition
When no permissionHidden control / No touch allowed

VisualHMI control permissions: conditional display, hiding, enabling, and disabling插图

2. Single/Double conditions

Single condition: Display if LW1000 == 1. Double condition AND: Display if LW1000 == 1 and LW1001 == 1. Double condition OR: Display if LW1000 == 1 or LW1002 == 1 and touchable.

VisualHMI control permissions: conditional display, hiding, enabling, and disabling插图1

VisualHMI control permissions: conditional display, hiding, enabling, and disabling插图2

VisualHMI control permissions: conditional display, hiding, enabling, and disabling插图3

3. Multiple conditions (more than 2)

Permissions can have up to 2 conditions. For more than 2 conditions, use Lua to calculate the multiple conditions into a single result and write it back to a certain register. The control permissions are determined by this register:

function on_run()
  local v1 = get_uint16(VT_RW, 0x1000)
  local v2 = get_uint16(VT_RW, 0x1001)
  local v3 = get_uint16(VT_RW, 0x1002)
  if v1 == 1 and v2 == 1 and v3 == 1 then
    set_uint16(VT_RW, 0x1100, 1)
  else
    set_uint16(VT_RW, 0x1100, 0)
  end
end

VisualHMI control permissions: conditional display, hiding, enabling, and disabling插图4

Control permissions can have up to 2 conditions - don't think about configuring 3 AND conditions in the interface. If there are more, use Lua to calculate and write back to a register in on_run, and the control permissions are determined by that register. Note that on_run is a periodic callback, so the logic should be light.

Compiled from Guangzhou Dacai Technology VisualHMI development documentation (hmi-doc.gz-dc.com) and other technical tutorials "Control Permissions", copyright belongs to Dacai Technology.

Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.