VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing

freeFree Technical Resource

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

Recipe: A set of product parameters (temperature, time, speed, etc.) is packaged into a single record, allowing for one-click loading when switching products, eliminating the need to manually change each parameter individually. Up to 10 recipes, each containing 1000 sets of parameters and 2000 ingredients, cover most production line changeover scenarios.

1. Recipe Settings

Project → Recipe Settings, core fields:

FieldDescription
Recipe NameNotes (optional)
Number of Recipe IngredientsNumber of Parameters, up to 2000
Data TypeINT16/INT16/INT32/INT32/INT64/INT64/FLOAT/DOUBLE
Number of Recipe RecordsRecord count, max 1000
Recipe record nameAssociated tags, separated by semicolons, such as "Recipe 1; Recipe 2; Recipe 3"
Name lengthN bytes occupied per recipe
Recipe index addressControl address, with the index value followed by the data of each component
Recipe write PLC addressTarget device starting address, continuously issued when the index changes
Recipe control addressWrite 1=Write to PLC / 2=Modify and save / 3=Save file / 4=Delete selected row / 5=Modify without saving and reset

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图

2. Application: Recipe selection and switching

The text control is bound to display the name (GBK encoding, high and low byte swapped) of "Recipe Index Address + 1". The two-character setting button is used for index increment/decrement (step size 1, looping, range 0~5). When switching indexes, the underlying system automatically loads the corresponding data from the recipe file to refresh the control.

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图1

3. Save while changing.

After modifying the parameters, write "Recipe Control Address=2" to save. In LUA, triggering the component register will automatically save:

function on_update(slave,vtype,addr)
  if vtype == VT_LW then
    if addr >= 0x1201 and addr <= 0x1206 then  -- 配方数据寄存器
      set_uint16(VT_LW, 0x1300, 2)  -- 配方控制地址写2
      update_system()               -- 立刻写入系统参数
    end
  end
end

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图2

4. Issue to PLC and display in file.

Write "Recipe Control Address=1" to issue LW1201~1206 to LW1400~1405 of the PLC. The recipe file can also be directly displayed and edited in the data record control table (select "Recipe Data" as the data source and select the corresponding recipe as the index).

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图3

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图4

VisualHMI Recipe Application: Ingredient Record Management and One-click Switching and Issuing插图5

Three common mistakes in recipes:① The component register is continuously arranged from "Index Address + 1", not from the index address itself; ② To save while changing in LUA, remember to judge the address range; ③ When the PLC addresses are not continuous, automatic issuance cannot be relied on, and LUA must be used to read the recipe values and write them separately..

Compiled from VisualHMI development documentation of Guangzhou Dacai Technology (hmi-doc.gz-dc.com) and other technical tutorials on "Recipe Application". 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 *.