File_Read - Phoenix Contact ILC 330 User Manual

Inline controllers
Table of Contents

Advertisement

The Inline Controller Under PC WorX
3.5.3

FILE_READ

The FILE_READ block is used to read data from a file that was opened previously.
Figure 3-4
FILE_READ block
Assign the valid handle for the file from which data is to be read to the "Handle" input.
Create a data buffer of sufficient size for the "Buffer" output. The data buffer for the data to
be read can be declared in a number of ways. The type of data buffer can be defined by
the user, e.g., a byte array. Strings cannot be used directly as data buffers. If the data read
is to be processed further as a string, it must first be saved in an array and then converted
into a string using the BUF_TO_STRING function block.
Enter the number of bytes to be read at the "MaxLength" input.
Activate the block on a rising edge at the "Execute" input.
Execution of the function block is complete when the "Done" output is set to 1.
If an error occurred during execution, the value at the "Error" output = 1.
"ErrorID" indicates the number of the cause of the error.
Following successful execution, the data is copied to the buffer and the number of
characters read is indicated at the "LengthRead" output. The number of characters read
may be smaller than "MaxLength" if the end of the file was reached before the number of
characters indicated was processed.
3-7
6959_en_05
PHOENIX CONTACT

Advertisement

Table of Contents
loading

Table of Contents