VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display

freeFree Technical Resource

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

The numeric control is the most core input/display control in HMI: displaying register values, popping up a keyboard for input, converting engineering quantities, and providing over-limit alarms. This article will thoroughly discuss data types, scaling, range limits, warning colors, and password display.

1. Core Capabilities

  • Data Types: INT16/INT32/INT64, INT16/INT32/INT64, FLOAT (32-bit IEEE754)/DOUBLE (64-bit)
  • Input and Display: Directly changing values using the on-screen keyboard; linear scaling y=ax+b for engineering quantity conversion; invalid value handling (0 can be displayed as blank/—)
  • Over-limit Alarms: The numeric value automatically changes color/flashes when it exceeds the range, supporting multi-level thresholds (warning zone/alarm zone)

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图

2. Function Settings

2.1 Input and Keyboard

AttributesDescription
Enable inputWhether the keyboard can be inputted through the keyboard type/screen
Keyboard type/screenPop-up keyboard; keyboard location screen
Keyboard positionComponent top/bottom/left/right side, screen top/bottom/left/right side, centered, custom coordinates
Keyboard initial valueWhether the keyboard has an initial value
Prompt informationAssociated text label, keyboard screen control associated with $SysKBTipInfo to display prompts

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图1

2.2 Address and data type

  • Read address / write address: Can be the same (read and write to the same address) or different (read A and write B)
  • Number of integer digits: Number of integer parts, which can be padded with zeros
  • Number of decimal digits: Integer type used to express decimals (original value 1234 set to display 12.34 with 2 decimal places); floating-point type retains decimal places (123.4 set to display 123.4 with 1 decimal place)
  • Special conversion: Actual value = original value × scaling + offset
  • Additional unit: Value followed by a unit, up to 4 bytes, can be displayed compactly without spaces
  • Password display: Display numbers as *

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图2

⚠️ When only scaling (such as 0.01) is set without specifying the number of decimal digits for special conversion, the display will be rounded to the nearest integer - the original value 456 will be displayed as 5 after scaling. To display decimals, it must be accompanied by a 'Number of decimal digits' set to 2, which will then display 4.56. The scaling factor must be used in conjunction with the number of decimal digits.

2.3 Range Limit and Warning Color

AttributesDescription
Range LimitNone / Fixed Range (Lower Limit + Upper Limit) / Variable Range (Lower Limit Address + Upper Limit Address, dynamically changed during runtime)
Warning ColorColor used for text or background; Lower Limit Color/Flashing (Value < Lower Limit); Upper Limit Color/Flashing (Value > Upper Limit)
Out-of-Range Value DisplayNormal Display / #### / * / ---- / Blank
Keyboard Input Out-of-RangeDisable Setting / Set as Boundary Value / Cancel Setting

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图3

2.4 Control Address (Style dynamically changed during runtime)

Dynamically set font, foreground color, and background color through continuous addresses:

  • Control address +0 (e.g. LW1000): High 8 bits = font number, low 8 bits = font size
  • Control address +1 (LW1001): foreground color, 16-bit RGB565
  • Control address +2 (LW1002): background color, 16-bit RGB565

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图4

3. Application Cases

3.1 Fixed Range + Warning Color

ReadLW1001(UINT16), range 0~1000, warning color for background: lower limit yellow (255;255;0) flashing, upper limit red (255;0;0) flashing, normal display when out of range, keyboard out-of-range setting prohibited. PLC transmits value out of range, background immediately turns yellow/red.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图5

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图6

3.2 Variable Range

ReadLW1002(INT16), lower limit addressLW2000, upper limit addressLW2001(Keyboard input change boundary). Set upper limit to 1 and lower limit to -100: The text changes to orange when the value is out of range (<-100) or red when it is >1. If the keyboard input exceeds the boundary, "Cancel setting" will retain the original value.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图7

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图8

3.3 Display decimal (32-bit integer)

ReadLW1003(UINT32), with 2 decimal places. PLC transmits 3660(0x0D20) and displays 36.6; keyboard input 12.3, and writes back 0x04CE(1230) to PLC.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图9

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图10

3.4 Change control address style

Control addressLW2002: LW2002=0x0132(306) indicates font 1, size 50; LW2003=0xF800(63488) red foreground; LW2004=0xFFE0(65504) yellow background. PLC can dynamically change the style by modifying these three addresses.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图11

3.5 Special conversion + unit

ReadLW1021(UINT16), with scaling of 0.1, offset of 0, 2 decimal places, and unit V. The original value 123 is converted to 12.3 and displayed as 12.30V.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图12

3.6 Password display

ReadLW1022Check the password display. Both keyboard input and PLC value transmission are displayed as **, with the number of characters depending on the actual number of characters.

VisualHMI numerical control: data type/scaling conversion/range limitation/warning color/password display插图13

The numerical control does not work. Triple check:① Is the data type correct (PLC is INT16, but you selected UINT16, which is directly incorrect for negative values)? ② Are the decimal places and scaling matched? ③ Are the range limits and warning colors correctly identifying normal values as out-of-range?. Especially for issues like "display -1 changes to 65535", 99% of the time it's due to a wrong symbol type selection.

Compiled from Guangzhou Dacai Technology VisualHMI development documentation (hmi-doc.gz-dc.com) configuration control tutorial "Numerical Control", 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 *.