FB_BinaryWriter - General Information
Type: |
Function block |
Available as of: |
V1.0.3.0 |
Inherits from: |
- |
Implements: |
- |
Versions: |
Current version |
Efficient writing of any data structures into a binary file.
The function writes the number of bytes specified in i_diBufferSize from the memory at address i_dwBufferAdr into a file. Sufficient memory must be reserved at the position of i_dwBufferAdr. If i_etMode ET_WriteMode.Create mode is chosen, the file will be created anew. If a file with the same name already exists, it will be overwritten. If ET_WriteMode.Append mode is chosen, the new data will be appended to the existing file.
Writing is started with a positive edge at i_xExecute and stopped after an error is detected or after all data has been written successfully. During writing, no parameter (other than i_xExecute) may be changed. Also, that memory area which i_dwBufferAdr points to may not be written to.
Input |
Data type |
Description |
---|---|---|
i_xExecute |
BOOL |
FALSE -> TRUE: POU is activated. The writing procedure begins. |
i_sFileName |
STRING[80] |
Name of the text file where the variable should be written to. |
i_diBufferSize |
DINT |
Number of bytes to be written |
i_dwBufferAdr |
DWORD |
Address of the array where the data is read. The respective amount of memory must be reserved. |
i_etMode |
If ET_WriteMode.Create mode is chosen, the file will be created anew. If a file with the same name already exists, it will be overwritten. If ET_WriteMode.Append mode is chosen, the new data will be appended to the existing file. |
Output |
Data type |
Description |
---|---|---|
q_xBusy |
BOOL |
TRUE: The POU is active and has to be executed further. FALSE: The POU is inactive. |
q_xDone |
BOOL |
TRUE: The POU is ready to operate and can accept user commands. FALSE: The POU is not ready to accept user commands. |
q_etDiag |
General library-independent statement on the diagnostic. A value not equal to ET_Diag.Ok corresponds to an diagnostic message. |
|
q_etDiagExt |
POU-specific output on the diagnostic. q_etDiag = ET_Diag.Ok -> Status message q_etDiag <> ET_Diag.Ok -> Diagnostic message |
q_etDiag |
q_etDiagExt |
Enumeration value |
Description |
---|---|---|---|
OK |
128 |
Version |
|
OK |
180 |
Wait for execution. |
|
FileHandlingInvalid |
112 |
The file cannot be opened. |
|
FileHandlingInvalid |
105 |
Too many files are opened. |
|
InputParameterInvalid |
111 |
The Mode is indeterminable. |
|
UnexpectedProgramBehavior |
1 |
An unintended detected error occurred during execution. |
Enumeration name: |
CanNotOpenFile |
Enumeration value: |
112 |
Description: |
The file cannot be opened. |
Issue |
Cause |
Solution |
---|---|---|
- |
The file i_sFileName could not be opened. |
Verify whether the file called i_sFileName is stored on the data carrier. Verify data carrier for defects. |
Enumeration name: |
Executing |
Enumeration value: |
128 |
Description: |
Version |
Data are being written.
Enumeration name: |
TooManyFilesOpen |
Enumeration value: |
105 |
Description: |
Too many files are opened. |
Issue |
Cause |
Solution |
---|---|---|
- |
Too many files are opened. |
Close files that are no longer needed using SystemInterface.FC_CloseFile. |
Enumeration name: |
UnexpectedFeedback |
Enumeration value: |
1 |
Description: |
An unintended detected error occurred during execution. |
Issue |
Cause |
Solution |
---|---|---|
- |
An error occurred in the internal execution. |
An error occurred in the internal execution. |
Enumeration name: |
UnknownMode |
Enumeration value: |
111 |
Description: |
The Mode is indeterminable. |
Issue |
Cause |
Solution |
---|---|---|
- |
At the input i_etMode, an invalid value has been applied. |
At the input i_etMode, an element of the enumeration ET_WriteMode must be applied. |
Enumeration name: |
WaitForExecute |
Enumeration value: |
180 |
Description: |
Wait for execution. |
The function block is ready. As reaction to a positive edge from i_xExecute, the data is written.