VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation

freeFree Technical Resource

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

The data recording control combines multiple register values under the same timestamp into one rowCombine multiple register values under the same timestamp into one rowand dynamically appends them to the table - similar to a database log. It supports up to 1000 channels (columns), retains data in case of power loss, and supports paging, clearing, and CSV export.

1. Core Capabilities

  • Multi-channel synchronous recording: Each record can include up to 1000 channels, with each channel bound to a register
  • Time-aligned sampling: All channels are read at the same time
  • Real-time table: New records are automatically appended and can be scrolled through
  • Persistence: Stored in Flash, retains data in case of power loss; supports paging/clearing/CSV export

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图

2. Attribute Introduction

2.1 Basic Settings

AttributesDescription
Data SourceData Collection (from the same register at different times) / Recipe Data (display of recipe content)
String TableCheck when the data collection type is STRING, and display as a string
Time SortingTime Sequence / Reverse Order
Date/TimeDisplay Time / Date / Time and Date
Recipe Data Index / Direct EditingSelect Recipe Set; After selecting, click on the table parameters to directly modify
Number of ChannelsNumber of Data Channels
Table SettingsTitle, Text Width; Automatic Column Width (proportional) or Fixed Pixels
Fixed ColumnsNone (fully scrollable) / 1 Column (fixed sequence number) / 2 Columns (fixed sequence number + time)
Rows per Page / Scrollbar / Gesture SwipingPagination Display; Vertical Scrollbar; Gesture Swiping

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图1

Page Turning Control(Starting from Addr): Addr+0 to turn pages (1 for up/2 for down/3 for first page/4 for last page); Addr+1 to read feasibility (BIT1~4); Addr+2~3 to locate timestamps (UINT32, with a dropdown to locate by day); Addr+4~5 to notify selected rows (UINT32, with selected row numbers starting from 0).

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图2

2.2 Appearance Settings

Font/Size/Color/Alignment, Title (including Title Text Color), Grid (Grid/Border Color), Background (Title Background/Content Background), Odd/Even Line Break (Background Color 2).

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图3

3. Application Cases

3.1 Data Acquisition (100 Channels)

Data Collection: Describe "Historical Data", scheduled sampling, 2000 entries, cycle 1 second, data addressLW1010, INT16, number of data 100, control addressLW1001, sampling controlLW1000OFF→ON. Data recording control: Data source data collection (index [0]), channel 100, time in reverse order, fixed column 2, 5 rows per page, scroll bar + gesture sliding, page turning controlLW1004, allow page turningLW1005, timestampLW1006, selected rowLW1008.

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图4

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图5

Sampling Enable: Bit Status Light BindingLW1000(ON to start/OFF to stop); Clear/Export: The word button is bound toLW1001Write 85 (Clear)/1 (Export); Page turning: 4 buttons are bound toLW10041/2/3/4 + PermissionLW1005.1/.2.

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图6

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图7

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图8

Time stamp positioning: The dropdown menu is bound to0xA000Option content = historical data date (data sampling index [0]), select a specific day to locate the first record of that day.

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图9

3.2 Special application: Address discontinuity/Different types (String table + LUA)

When the register addresses are discontinuous and the data types are inconsistent (such as voltage 4x0000 UINT32, current 4x0007 UINT32, load rate 4x0015 UINT16, harmonic 4x0021 INT16, power factor 4x0026 UINT32...), the string table scheme is used: data collection data addressLW2000, type STRING, quantity 100; LUA reads values from each register in on_run, concatenates the strings, and writes them to LW2000, with each column separated by a semicolon (;)

function on_init()
  set_run_cycle(1000)
  start_read(0, VT_4x, 0, 80)   -- 读从站1保持寄存器 0x0000~0x0050
end
function on_run(screen)
  if (get_uint16(VT_LW, 0x01A3) & 0x0001) == 0x01 then  -- 从机在线
    select_slave(0)
    local vol = get_uint32(VT_4x, 0x0000)  -- 电压
    local cur = get_uint32(VT_4x, 0x0007)  -- 电流
    -- ... 读其它寄存器
    local rcrd = string.format("%0.2f", vol/100)..";"..
                 string.format("%0.2f", cur/100)..";"..
                 -- ... 拼接所有列
    set_string(VT_LW, 0x2000, rcrd)  -- 写到 LW2000
  end
end

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图10

VisualHMI data recording: 1000-channel table, timestamp positioning, and string concatenation插图11

Data sampling requirementsRegister addresses must be continuous and data types must be consistent. Do not perform hard sampling when addresses are discontinuous/types are mixed - use the string table scheme: LUA reads values → concatenates strings (separated by semicolons) → writes to the data sampling address, with the control selecting the string table to display by column. String encoding uses GB CODE.

Compiled from the "Data Recording" tutorial in the VisualHMI development documentation of Guangzhou Dacai Technology (hmi-doc.gz-dc.com), copyright reserved by 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 *.