File Fill (FLL)

The FLL instruction fills a block of memory with the provided source value. The Source remains unchanged.
If the destination array is SINT, INT, DINT, or REAL, and the type of source value is different, the source value will be converted to the destination type before it is stored. Smaller integer types will be converted to large ones by sign-extension.
If the destination array is a structure, the source value will be written without conversion.
Available Languages
Ladder Diagram
Ladder_FIle Fill(FLL)_v1
Operands
IMPORTANT: Unexpected operation may occur if:
  • Output tag operands are overwritten.
  • Members of a structure operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand
Data Type
Format
Description
Source
SINT
INT
DINT
REAL
immediate
tag
Element to copy
Destination
SINT
INT
DINT
REAL
structure
tag
Initial element to be overwritten by the Source.
Length
DINT
INT
SINT
immediate
tag
Number of destination elements to fill.
The number of bytes filled is the smaller of:
  • Requested amount = Length x (number of bytes in a destination element)
  • The number of bytes in the destination tag
TIP: The end of the destination tag is defined as the last byte of the base tag. If the tag is a structure, the end of the tag is the last byte of the last element of the structure. This means the FLL instruction could write past the end of a member array, but will never write past the end of the base tag. Test and confirm that the FLL instruction does not change data that should not be changed.
For best results, the Source and Destination should be the same type. Use FLL to fill a structure with a constant, such as 0s.
If initializing a structure, be sure to have one instance containing the initial values, and use COP to replicate it. FLL can be used, for example, zero out the entire structure.
If the Source is:
And the Destination is:
The Source is converted to:
SINT, INT, DINT, or REAL
SINT
SINT
SINT, INT, DINT, or REAL
INT
INT
SINT, INT, DINT, or REAL
DINT
DINT
SINT, INT, DINT, or REAL
REAL
REAL
Conversion from larger integers to smaller integers will result in truncation (the high bits are discarded). Once the source is converted, it is written to the destination N times, where N = byte count. Sign extension results when converting from smaller integers to larger integers. REAL numbers will be rounded when converted to integers.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
N/A
Rung-condition-in is true
The instruction fills the memory.
Postscan
N/A
Example
The FLL instruction copies number of destination elements specified by the Length from the DINT_src type source operand into a REAL_dest type destination.
Ladder Diagram
FTStudio-FLL-LD-EX-V1
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.