Function BlockFileWriteBinDataPLCopen motion icon

Description

This function block writes binary data to a file. Before using FileWriteBinData, you may use SerializeOut to copy variable data to a binary frame.

Figure 7-214: The FileWriteLine Function Block

Related Functions

FileClose, FileEOF, FileOpenA, FileOpenR, FileOpenW, FileReadBinData, FileReadLine, FileSeek, FileWriteLine

See also: File Management

Arguments

Input

Execute Description On the rising edgeClosedA rising edge is the transition of a digital signal from low to high. It is also called positive edge write binary data to a file.
  Data Type BOOL
  Range 0, 1
  Unit N/A
  Default
ID Description ID of the open file.
  Data Type UDINT
  Range N/A
  Unit N/A
  Default
FrameClosedIn networking dialect, a message is called a frame Description The array of binary data to write
  Data Type USINT[]
  Range N/A
  Unit N/A
  Default
FrameSize Description Number of bytes to write from the Frame array.
  Data Type DINT
  Range N/A
  Unit N/A
  Default

Output

Done Description If TRUE, then the command completed successfully
  Data Type BOOL
Error Description If TRUE, an error has occurred
  Data Type BOOL
ErrorID Description Indicates the error if Error output is set to TRUE. See the table in Search IndexFile and TCP/IP Function Block ErrorID Output
  Data Type DINT

Example

Structured Text

(* FileWriteBinData example *)
CASE StepCounter OF
0:
  Inst_FileWriteBinData(TRUE, MyOutputFileID, OutputFrame, 128);
  StepCounter := StepCounter + 1;
1:
  Inst_FileWriteBinData(TRUE, MyOutputFileID, OutputFrame, 128);
  IF Inst_FileWriteBinData.Done THEN
     Inst_FileWriteBinData(FALSE, 0, OutputFrame, 0);
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;