File Fill (FLL)
This information applies to the
CompactLogix
5370, ControlLogix
5570, Compact GuardLogix
5370, GuardLogix
5570, CompactLogix
5380, CompactLogix
5480, and ControlLogix
5580 controllers. Controller differences are noted where applicable. 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
Function Block
This instruction is not available in function block.
Structured Text
This instruction is not available in structured text.
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 tagTIP: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
Provide Feedback