Convert / Assign

Symbol:

Description:

This function block is used to convert signals of one data type to signals of another data type.

It can also be used to assign values of a single data type (if the input and the output have the same data type).

Parameter:

The parameter dialog can be used to select the data type and the number of elements for the source and destination.

Signals:

Name

I/O

Type(s)

Function

X

I

BIT, BYTE, UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE,TEXT

Input signal

Y

O

BIT, BYTE, UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE,TEXT

Output signal

Visualization:

The color of the selected data types and the number of elements (if greater than one) will be depicted in the symbol.

Comment:

The data type of the input can be assigned by creating a new connection.

If the data type is changed by the parameter dialog all invalid connections will be deleted.

Example:

The following example shows how to convert a BIT vector into a single WORD value and back into a BIT vector.


Pin

Symbol: |
Description: | This function block can be used to provide a value of any defined data type as a signals used within the program
Parameter: | The parameter dialog can be used to select a data type.
Signals: | Name | I/O | Type(s) | Function
 | X | I | Data type independent | Input value
 | Y | O | Data type independent | Output signal
Comment: | If no connection exists another data type can be assigned by creating a new connection at the input. If the data type is changed by the parameter dialog all invalid connections will be deleted.


Structure Get

Symbol:

Description:

This function block is used to read and dissect the single items of a user defined data structure.

The data structure can be connected to the input X. The values of the items of the structure can be read at the output connectors. There can be at most eight outputs to read the values of the items.

Parameter:

In the parameter dialog the data type can be selected. By right-clicking into the dialog area, it is possible to add elements to the structure, which creates a new input for that item.

Signals:

Name

I/O

Type(s)

Function

X

I

User defined data type

Data structure

Y0 .. Y7

I

Data type independent

Items of the data structure

Visualization:

The function block changes its size according to the number of inputs. The name of the items will be displayed directly in the symbol.

Comment:

The same data structure item can be assigned to different output connectors.

Pay attention to the sequence of the block numbers.

Example:

The following example shows how a user defined data structure is created with some initial values. These values are read and displayed. After that the values of the items are overwritten. The new values are then read and displayed again.


Structure Init

Symbol:

Description:

With this function block it is possible to create a user defined data structure and make it available for further use in the program.

It allows to initialize the items of the structure and provides the complete structure as a new data type at the output Y. The single items can be accessed by the input connectors. It is possible to create up to eight input signals to set the value if the items.

Parameter:

In the parameter dialog the data type can be selected. By right-clicking into the dialog area, it is possible to add elements to the structure, which creates a new input for that item.

Signals:

Name

I/O

Type(s)

Function

X0 .. X7

I

Data type independent

Items of the data structure

Y

O

User defined data type

Data structure

Visualization:

The function block changes its size according to the number of inputs. The name of the items will be displayed directly in the symbol.

Comment:

In Online mode the items are set one by one, starting with the first one on top. If same item is defined for different inputs, the last assignment overwrites the ones before.

Pay attention to the sequence of the block numbers.

Example:

The following example shows how to create an initialize a user defined data structure which is then used by further function blocks.


Structure Set

Symbol:

Description:

This function block is used to (over)write the elements of a user defined data structure.

The data structure is connected to the input X. The new values for the items of the structure can be given by the inputs X0 to X7. After overwriting the items with a new value the data structure will be written back to the input signal X. There can be at most eight inputs to set the values of the items.

Parameter:

In the parameter dialog the data type can be selected. By right-clicking into the dialog area, it is possible to add elements to the structure, which creates a new input for that item.

Signals:

Name

I/O

Type(s)

Function

X

I/O

User defined data type

Date structure

X0 .. X7

I

Data type independent

Items of the data structure

Visualization:

The function block changes its size according to the number of inputs. The name of the items will be displayed directly in the symbol.

Comment:

In Online mode the items are set one by one, starting with the first one on top. If same item is defined for different inputs, the last assignment overwrites the ones before.

Pay attention to the sequence of the block numbers.

Example:

The following example shows how a user defined data structure is defined with the initial values 1; 10; 1; 10 and then the items are set with the new values 10; 20; 10; 20.


Vector Create

Symbol: |
Description: | This function block can be used to create a vector out of a number of single elements. The maximum number of elements that can be merged into a vector in this way is 16.
Parameter: | The parameter dialog can used to select the data type and the number of elements.
Signals: | Name | I/O | Type(s) | Function
 | X0 .. X15 | I | Data type independent | Input values
 | Y | O | Data type independent | Output vector
Visualization: | The function block changes its size according to the number of elements.
Comment: | If no connection exists another data type can be assigned by creating a new connection at an input. If the data type is changed by the parameter dialog all invalid connections will be deleted.
Example: | The following example shows how to create a BIT vector out of a number of single values. This vector will be converted into a single WORD value and back into a BIT vector.


Vector Split

Symbol: |
Description: | This function block can be used to split a vector into its sub elements. The maximum number of elements that can be accessed in this way is 16.
Parameter: | The parameter dialog can used to select the data type and the number of elements.
Signals: | Name | I/O | Type(s) | Function
 | X | I | Data type independent | Input vector
 | Y0 .. Y15 | O | Data type independent | Output value
Visualization: | The function block changes its size according to the number of elements.
Comment: | If no connection exists another data type can be assigned by creating a new connection at the input. If the data type is changed by the parameter dialog all invalid connections will be deleted.
Example: | The following example shows how a BIT vector is converted to a single WORD value and back to a BIT Vector. This vector is then split into its sub elements and these single elements are visualized.


user defined data structure

Converter

User defined data structures

The concept user defined data structure enables the bundling of different or multiple data to a single object. In this way complex data can be used and displayed more easily. The data structure can be uses as a new data type within a program.

In the following an example is given to create a data structure called LRECT, which contains four LONG values. This data structure represents a rectangle defined by two points.

The rectangle forms a logical unit of the four LONG values. Because all four values are needed every time, when dealing with the rectangle, a user defined data structure is the best way to handle it. In doing so, you can handle data efficiently and reduce failures like forgetting one of the values.

To use user defined data structure they have to be defined, created and introduced to the graphical programming system. A step by step tutorial with this example structure can be found here: Create a user defined data structure.


create_user_data_structure

Converter > User defined data structures

Create a user defined data structure

The following example shows how to create a user defined data structure. We use a structure called “LRECT” containing four LONG values that describe the coordinates of a rectangle. Please pay attention to the correct numeration and the case sensitivity.

Steps:

1. Create the file "PROJEKTNAME“.IADTINI

Use the file "iadvdatatypesbsp.ini“ as a template. This file can be found the "bin" directory. Copy that file to the project folder and rename it. If file already exist in the project directory go to step 2.

2. Modification of the file „PROJEKTNAME“.IADTINI

This file contains a list of all used data types. They can be found under "List of defined data types“. A new entry for the user defined data structure has to be created here. This will introduce the new data type to the programming system and it will be able to provide connectors for this data type. The first value is the counter for the list items (A) followed by the name of structure (B). The third and fourth entries are IDs for Data data type (C) and Parameter data type (D). They can be chosen freely 10000 and 32767. Don’t use IDs multiple. The IDs from 0 to 9999 are reserved and must not be used.

This file also contains additional attribute definitions for the data types, like parameter dialog or the depiction of the connection line. Go to the end of the file and expand the list with new entries like shown in the following figure. First enter the type ID in squared bracket. Remaining attributes are:

NAME Internal identifier of the data data type or parameter data type

LCOLOR Line color of the connection; RGB formatted

LSTYLE Line style of the connection (SOLID, DASH, DOT, …)

LWIDTH Width of the connection in pixel

TYPE Number of inputs connected with an output (MULTIPLE_INPUTS vs. SINGLE_INPUT)

In addition for parameter data type:

INPPARADLL Name of the parameter dialog DLL

INPPARAFUNC Name of the export function for the parameter dialog in the DLL

3. Create the file "PROJEKTNAME“.STDMEMXML

Use the file "iStdInpPara.xml“ as a template. It can be found in the "bin" directory. Copy that file to the project folder and rename it. If file already exist in the project directory go to step 4.

4. Modification of the file "PROJEKTNAME“.STDMEMXML

The entries "TypeList" and "MemoryList" of this file have to be extended for the new data structure.

In the list of data types ("TypeList") the new data type has to be entered with its name and additionally with a comment and its base type set to "Strctured". Within this type entry the items of the structure have to be defined with an Item tag. The example includes four LONG values which represents the coordinates of points that define a rectangle.

Textfeld: <TypeList> … <Type Name="LRECT" Comment="structured data type for rectangle" BaseType="Structured"> <Item Name="Rect_X0" Type="LONG"/> <Item Name="Rect_X1" Type="LONG"/> <Item Name="Rect_Y0" Type="LONG"/> <Item Name="Rect_Y1" Type="LONG"/> </Type> </TypeList>

In the memory list (“MemoryList”) the new memory type will be published to the system. The comment contains the name of the parameter data type.

Textfeld: <MemoryList> … <Memory ID="10001" Type="LRECT" Comment="LRECTPARA"/> </MemoryList>

5. Modification of the resource file for the target system

Finally the target systems have to get information about the new data type. The resource allocation file is located in the "Device" directory. In the case of the simulation system it is the file VICK_SIMUL.res. Enter a successive number in the square brackets at the end of the file and input entries according the following figure.

Name Name of the parameter data type or of the data data type

Num Number of elements allocated for this type

Size Size of memory in bytes needed for one element

Option Characteristics of the memory

The data structure in our example contains of four LONG values and so needs 16 bytes of memory.

“Option” is depend of the target system. The simulation and other implemented systems use the following options that can be combined with OR operation.

01H Stand data type

02H Parameter memory

04H Bit

08H Copy memory to log file

10H Remanent memory

The data data type has to be defined first.

Textfeld: ;rectangle [44] Name=LRECTDATA Num=100 Size=16 Option=00H [45] Name=LRECTPARA Num=100 Size=16 Option=12H


Data data type

A data data type is located in temporary memory (i.e. RAM). Therefore this data gets lost after restarting the target system because this type of memory doesn’t store data permanently. The most variable data values are of this kind of data type. They are used for any calculation during the program execution and nor meant to be persistent beyond the end of a program.


Parameter data type

A parameter data type is located in no temporary memory (like FLASH). The data don’t get lost after restarting the target system. Therefore you can use the same values in every program execution.