FileWriteBinData

PLCopen motion icon

 Function Block - Write binary data to a file.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

0 to 1

N/A

No default

On the rising edge, write binary data to a file.

ID

UDINT

N/A

N/A

No default

The ID of the open file.

Frame

USINT[ ]

N/A

N/A

No default

The array of binary data to write.

FrameSize

DINT

N/A

N/A

No default

Number of bytes to write from the Frame array.

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

 

 

If TRUE, the command completed successfully.

Error

BOOL

 

 

If TRUE, an error has occurred.

ErrorID

DINT

 

 

Indicates the error if Error output is TRUE.

See the table in File and TCP/IP Function Block ErrorIDs.

Remarks

Before using FileWriteBinData, use SerializeOut to copy variable data to a binary frame.

Figure 1: FileWriteLine

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* 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;

See Also