MC_AxTableToAsciFile_BkPlcMc (from V3.0)
The function block writes the contents of a table to a text file.
Inputs
VAR_INPUT
Execute: BOOL:=FALSE;
pTable: POINTER TO LREAL:=0;
LowIdx: INT:=0;
HighIdx: INT:=0;
FileName: STRING(255):='';
END_VAR
Name | Type | Description |
---|---|---|
Execute | BOOL | The writing process is initiated by a rising edge at this input. |
pTable | POINTER TO LREAL | This parameter is used to transfer the address of an ARRAY[nFirstIdx..nLastIdx,1..2]. |
LowIdx | INT | This parameter is used to transfer the lower index of the ARRAY, whose address is transferred as pTable. |
HighIdx | INT | This parameter is used to transfer the upper index of the ARRAY, whose address is transferred as pTable. |
FileName | STRING | This parameter can be used to specify a file name. |
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;
END_VAR
Name | Type | Description |
---|---|---|
Busy | BOOL | Indicates that a command is being processed. |
Done | BOOL | Successful processing of the homing is indicated here. |
Error | BOOL | The occurrence of an error is indicated here. |
ErrorID | UDINT | An encoded indication of the cause of the error is provided here. |
Behavior of the function block
A rising edge at Execute causes the function block to check the transferred parameters. A number of problems can be detected and reported during this process:
- If LowIdx is negative the system responds with Error and ErrorID=dwTcHydErrCdTblEntryCount.
- If pTable=0 the system responds with Error and ErrorID=dwTcHydErrCdTblEntryCount.
- If LowIdx and HighIdx describe a table with less than five rows the system responds with Error and ErrorID=dwTcHydErrCdTblEntryCount.
If these checks were performed without problems, the write operation is started. Busy is TRUE for the duration of the operation. This can lead to some further problems, which are indicated by various error codes. Successful writing of the file is indicated with Done.
A falling edge at Execute clears all the pending output signals. If Execute is set to FALSE while the process is still active, the process that had started continues unaffected. The signals at the end of the process (Error, ErrorID, Done) are made available for one cycle.
If a FileName is specified, it must be complete (including the drive letter and the path, if applicable, always including the file type), since it is used by function block without any further modification or amendment.
If no FileName is specified, the function block uses the path and the file name, which were specified through the MC_AxUtiStandardInit_BkPlcMc function block. File type TXT is used here, to distinguish from the parameter file with file type DAT.
The file contents can be read or modified with an ASCII editor. Changes of the content can make correct reading or the intended use impossible or change the effect of the table in a way that is difficult to trace. Manual changes should therefore be implemented very carefully, if at all, and only by competent persons. |