Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

File Fill (FLL)

Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE) Chapter 8

Operands:

The FLL instruction fills elements of an array with the Source value. The

Source remains unchanged.

Relay Ladder

Operand

Source

Type

SINT

INT

DINT

REAL

Destination

SINT

Length

INT

DINT

REAL

structure

DINT

Format:

immediate tag

Description

element to copy

Important: the Source and Destination operands should be the same data type, or unexpected results may occur tag initial element to be overwritten by the Source

Important: the Source and Destination operands should be the same data type, or unexpected results may occur

The preferred way to initialize a structure is to use the COP instruction.

immediate number of elements to fill

Structured Text

Structured text does not have an FLL instruction, but you can achieve the same results using a SIZE instruction and a FOR...DO or other loop construct.

SIZE(destination,0,length);

FOR position = 0 TO length-1 DO destination[position] := source;

END_FOR;

See Appendix C, Structured Text Programming for information on the syntax of constructs within structured text.

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

361

Chapter 8 Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)

Description:

The number of bytes filled is:

Byte count = Length

(number of bytes in the Destination data type)

IMPORTANT

You must test and confirm that the instruction doesn’t change data that you don’t want it to change.

The FLL instruction operates on contiguous data memory. In some cases, the instruction writes past the array into other members of the tag. This happens if the length is too big and the tag is a user-defined data type.

If the tag is

user-defined data type

NOT user-defined data type

Then

If the Length is too big, the instruction writes past the end of the array into other members of the tag. It stops at the end of the tag. No major fault is generated.

If the Length is too big, the instruction stops at the end of the array. No major fault is generated.

The Length is too big if it is more than the total number of elements in the

Destination array.

For best results, the Source and Destination should be the same type. If you want to fill a structure, use the COP instruction (see example 3 on page 359).

If you mix data types for the Source and Destination, the Destination elements are filled with converted Source values.

If The Source Is

SINT, INT, DINT, or REAL

SINT, INT, DINT, or REAL

SINT, INT, DINT, or REAL

SINT, INT, DINT, or REAL

SINT

INT

DINT

REAL

And The Destination Is The Source Is

Converted To

SINT SINT

INT

DINT

REAL structure

INT

DINT

REAL

SINT (not converted) structure structure structure

INT (not converted)

DINT (not converted)

REAL (not converted)

Arithmetic Status Flags:

not affected

Fault Conditions:

none

362

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE) Chapter 8

Execution:

Condition

prescan rung-condition-in is false rung-condition-in is true

Relay Ladder Action

The rung-condition-out is set to false.

The rung-condition-out is set to false.

end_address = start_address + (Length

∗ number of bytes in a destination element)

end_address > end of destination array yes no

end_address = end of destination array

source_address = Source postscan

destination_address =

end_address

yes no copy data in source_address to destination

_address

destination_address =

destination_address + 1 rung-condition-out is set to

true

end

The rung-condition-out is set to false.

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

363

Chapter 8 Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)

Example:

The FLL instruction copies the value in value_1 into dest_1

Relay Ladder

Source (value_1)

Data Type

Source (value_1)

Value

SINT

DINT

SINT

REAL

SINT

16#80 (-128)

16#1234 5678

16#01

2.0

16#01

Destination

(dest_1) Data Type

DINT

SINT

REAL

INT

TIMER

Destination

(dest_1) Value

After FLL

16#FFFF FF80 (-128)

16#78

1.0

16#0002

16#0101 0101

INT

DINT

16#0001

16#0000 0001

TIMER

TIMER

16#0101 0101

16#0101 0101

16#0001 0001

16#0001 0001

16#0001 0001

16#0000 0001

16#0000 0001

16#0000 0001

Structured Text

dest_1 := value_1;

364

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

advertisement

Related manuals

advertisement

Table of contents