Dynamic Char Array for RecipeQueryGetData

Dynamic Char Array for RecipeQueryGetData https://forum.weintekusa.com/uploads/db0776/original/2X/b/b1e82b0a5c994806f1120cb17bc6629a47520fcd.png
none 0.0 0

@cncgeorge,

As a simple workaround, I would recommend the following solution:

  1. Enable “Bulk Transfer” to send recipe data to a local HMI address within the “Transfer” tab of the recipe database:

  2. Then, configure a macro to read from the address specified wihtin the bulk transfer. Here is an example:

macro_command main()
	short transfer = 5 // Recipe transfer command
	unsigned short sPos[6] = {0, 0, 0, 0, 0, 0} // The data type used in the recipe database is 16-bit Unsigned
	short result = 0
	
	SetData(transfer, "Local HMI", RECIPE, "positions.Command") // Transfer recipe data to an LW memory
	GetData(result, "Local HMI", RECIPE, "positions.Result") // Check if the command is finished
	
	while result == 0 // Wait for command execution to finish
		DELAY(20)
		GetData(result, "Local HMI", RECIPE, "positions.Result")
	wend
	
	if result == 1 then // Execution success
		GetData(sPos[0], "Local HMI", LW, 0, 6) // Retrieve postion data as an array
		result = 0
		SetData(result, "Local HMI", RECIPE, "positions.Result") // Reset result
	else
		// Command failed
	end if
end macro_command
1 Like