Navigation:  Equipments (Devices) > PLC200 > Program > Data Transfer >

ReadRecipe

Leitor de Dados de Receita

Previous pageReturn to chapter overviewNext page

Block that gets the recipe from a recipe file and sends it to a variable.

 

Ladder Representation

 

READRECIPE_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

Execute

BOOL

Block enabling

FILENAME#

STRING

Name of the recipe file

INDEX

WORD UINT

Recipe index to be read

VAR_OUTPUT

Q

BOOL

End of operation

ERROR

BOOL

Error occurrence flag

ERRORID

BYTE USINT

Identifier of the occurred error

DST

STRUCT

Variable where the data read will be saved

VAR

READRECIPE_INST_0

READRECIPE

Instance of access to block structure

 

Operation

 

When this block identifies a leading edge in Execute, it gets the data from the selected recipe by the INDEX index in the # FILENAME file and sends them to the DST. If everything goes successfully, Q receives TRUE and remains so while Execute is TRUE.

 

wpshelp_common_fig_note

NOTE!

Recipes stored in RAM is identified by 'RECIPE_NAME'. Recipes stored on the SD card are identified by 'RECIPE_NAME.CSV'.

 

When Execute has FALSE value, DST remains unchanged.

 

If there is any error in the execution, the Error output is activated and ErrorID displays an error code according to the table below.

 

Code

Description

1

Incomplete recipe

2

Invalid structure

3

Nonexistent recipe

4

Invalid file

5

Invalid file or nonexistent SD card

6

SD card blocked for writing

7

SD card busy (log or other use)

 

Block Flowchart

 

READRECIPE_flowchart

 

Example in Ladder

 

READRECIPE_example01

 

The above example searches the index 3 of the recipe file stored in RAM 'RECIPE_RAM'. The block does not find the specified file, enabling the ERROR output with ERRORID with value 5 and disabling the Q output.

 

READRECIPE_example02

 

The above example searches the index 3 of the recipe file stored in RAM 'RECIPE_RAM'. The block finds the specified file, but does not find the index 3, enabling the ERROR output with ERRORID with value 3 and disabling the Q output.

 

READRECIPE_example03

 

The above example searches the index 3 of the recipe file stored in RAM 'RECIPE_RAM'. The block finds the file and the specified index, stores values in DST, disables the ERROR output and enables Q output.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   DST : STRUCT_RECIPE;

   READRECIPE_INST_0 : FB_ReadRecipe;

END_VAR

 

READRECIPE_INST_0.Execute := DI1;

READRECIPE_INST_0(FILENAME:='RECIPE_RAM', INDEX:=3, DST=>DST);

DO1 := READRECIPE_INST_0.Q;