Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

Chapter 9 Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU)

FIFO Load (FFL)

The FFL instruction copies the Source value to the FIFO.

Operands:

Relay Ladder

Operand

Source

FIFO

Control

Length

Position

Type

SINT

INT

DINT

Format

immediate tag

Description

data to be stored in the FIFO

REAL string structure

The Source converts to the data type of the array tag. A smaller integer converts to a larger integer by sign-extension.

SINT array tag FIFO to modify specify the first element of the FIFO

do not use CONTROL.POS in the subscript

INT

DINT

REAL string structure

CONTROL

DINT

DINT tag control structure for the operation typically use the same CONTROL as the associated FFU immediate maximum number of elements the FIFO can hold at one time immediate next location in the FIFO where the instruction loads data initial value is typically 0

If you use a user-defined structure as the data type for the Source or FIFO operand, use the same structure for both operands.

394

Publication 1756-RM003K-EN-P - July 2008

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

Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU) Chapter 9

Mnemonic

.EN

.DN

.EM

.LEN

.POS

CONTROL Structure

Data Type

BOOL

BOOL

BOOL

DINT

DINT

Description

The enable bit indicates that the FFL instruction is enabled.

The done bit is set to indicate that the FIFO is full (.POS = .LEN). The .DN bit inhibits loading the FIFO until .POS < .LEN.

The empty bit indicates that the FIFO is empty. If .LEN

.DN bit are set.

The length specifies the maximum number of elements the FIFO can hold at one time.

The position identifies the location in the FIFO where the instruction will load the next value.

Description:

Use the FFL instruction with the FFU instruction to store and retrieve data in a first-in/first-out order. When used in pairs, the FFL and FFU instructions establish an asynchronous shift register.

Typically, the Source and the FIFO are the same data type.

When enabled, the FFL instruction loads the Source value into the position in the FIFO identified by the .POS value. The instruction loads one value each time the instruction is enabled, until the FIFO is full.

IMPORTANT

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

The FFL instruction operates on contiguous memory. In some cases, the instruction loads data 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.

Arithmetic Status Flags:

not affected

Fault Conditions:

A Major Fault Will Occur If

(starting element + .POS) > FIFO array size

Fault Type

4

Fault Code

20

Publication 1756-RM003K-EN-P - July 2008

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

395

Chapter 9 Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU)

Condition

prescan

.EN bit is set to prevent a false load when scan begins

Execution:

Relay Ladder Action

.LEN < 0 no yes

.POS < 0

.EM is cleared no yes

.EM is set

.POS = 0 no yes

.EM is set

.POS

.LEN

yes no

.DN is set rung-condition-out is set to

false

end

396

Publication 1756-RM003K-EN-P - July 2008

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

Condition

rung-condition-in is false

.EN bit is cleared

.LEN < 0 no yes

.POS < 0

.EM is cleared no yes

Relay Ladder Action

Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU) Chapter 9

.EM is set

.POS = 0 no yes

.EM is set

.POS

.LEN

yes no

.DN is set rung-condition-out is set to

false

end

Publication 1756-RM003K-EN-P - July 2008

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

397

Chapter 9 Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU)

Relay Ladder Action Condition

rung-condition-in is true examine .EN bit

.EN = 0

.EN = 1

.LEN < 0 no yes

.POS < 0 yes no

.EM bit is cleared

.EN bit is set

.EM bit is set

.LEN < 0 yes no

.POS < 0 yes no

.EM bit is cleared

.DN is cleared

.POS = 0 no yes

.EM bit is set

.POS

.LEN

yes no

.DN bit is set

.POS

.LEN

yes no

.DN bit is set

.POS or

.LEN > size of array yes no major fault

.POS > .LEN

yes no

.POS = .POS - 1

FIFO[.POS - 1] = source

.EM bit is set rung-condition-out is set to

true

end

The rung-condition-out is set to false.

postscan

398

Publication 1756-RM003K-EN-P - July 2008

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

Array (File)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU) Chapter 9

Example:

When enabled, the FFL instruction loads value_1 into the next position in the

FIFO, which is array_dint[5] in this example.

array_dint[0] array_dint[5]

before FIFO load

00000

11111

22222

33333

44444

00000

00000

00000

00000

00000

control_1.pos = 5

value_1 = 55555 after FIFO load

00000

11111

22222

33333

44444

55555

00000

00000

00000

00000

control_1.pos = 6

Publication 1756-RM003K-EN-P - July 2008

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

399

advertisement

Related manuals

advertisement

Table of contents