MC_LinTableImportFromAsciFile_BkPlcMc
The function block imports a linearization table from a file in ASCI format.
Inputs
VAR_INPUT
Execute: BOOL:=FALSE;
FileName: STRING(255):=’’;
END_VAR
Name | Type | Description |
---|---|---|
Execute | BOOL | A rising edge initiates the import. |
FileName | STRING |
|
Inputs/outputs
VAR_INOUT
Axis: Axis_Ref_BkPlcMc;
END_VAR
Name | Type | Description |
---|---|---|
Axis | Axis_Ref_BkPlcMc | Here, the address of a variable of type Axis_Ref_BkPlcMc should be transferred. |
Outputs
VAR_OUTPUT
Busy: BOOL;
Done: BOOL;
Error: BOOL;
ErrorID: UDINT;
LastIdx: INT:=0;
END_VAR
Name | Type | Description |
---|---|---|
Busy | BOOL | Indicates that a command is being processed. |
Done | BOOL | This indicates successful identification. |
Error | BOOL | The occurrence of an error is indicated here. |
ErrorID | UDINT | An encoded indication of the cause of the error is provided here. |
LastIdx | INT |
|
Behavior of the function block
The function block reads the contents of the file and interprets it line by line according to the following rules:
- Leading spaces (blanks, tabs) are ignored.
- The digits 0..9 are accepted and used as digits before the decimal point for the first value.
- A point or comma is interpreted as a separator between digits before and after the decimal point.
- The digits 0..9 are accepted and used as digits after the decimal point for the first value.
- Spaces (blanks, tabs) are interpreted as separators between the first and second values.
- The digits 0..9 are accepted and used as digits before the decimal point for the second value.
- A point or comma is interpreted as a separator between digits before and after the decimal point.
- The digits 0..9 are accepted and used as digits after the decimal point for the second value.
- If unexpected characters are detected or expected elements are missing, the import is aborted with an error.
- Each pair of numbers is entered as a point in the linearization table of the axis. LastIdx is thereby incremented. After a successful import, the number of table points read is available here.
Manipulation of the file
The ASCI format makes it easy to manipulate such a file with a simple editor. This is possible, but not recommended. A deviation from the expected structure of the file makes it impossible to import it. Even with the correct formatting, however, a linearization table can inadvertently be created that makes it impossible for the system to function correctly. In addition, persons may be endangered and the products or plant may be damaged.