beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 267

background image

6 Application Instructions API 00-49

DVP-PLC Application Manual

6-55

API Mnemonic

Operands

Function

38

SFWR P

Shift Register Write

Controllers

ES/EX/SS SA/SX/SC EH/SV

Bit Devices

Word Devices

Program Steps

Type

OP

X Y M S K H

KnX

KnY KnM KnS T C D E F

S

* *

*

*

*

*

*

*

*

*

*

D

*

*

*

*

*

*

n

*

*

SFWR, SFWRP: 7 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: Device of stack data written in D: Start No. of stack data n: Length of stack data

Explanations:

1. Range

of

n

: 2 ~ 512

2.

See the specifications of each model for their range of use.

3.

Flag: M1022 (carry flag)

4.

The stack data of n words starting from D are defined as “first-in, first-out” stack data and designate the first

device as the pointer. When the instruction is executed, the content in the pointer pluses 1, and the content in

the device designated by S will be written into the designated location in the “first-in, first-out” stack data

designated by the pointer. When the content in the pointer exceeds n - 1, this instruction will not process any

new value written in and the carry flag M1022 = On.

5.

This instruction adopts pulse execution instructions (SFWRP)

Program Example:

1.

Pointer D0 is reset as 0. When X0 = Off→On, the content in D20 will be sent to D1 and the content in pointer D0

becomes 1. After the content in D20 is changed, make X0 = Off→On again, and the content in D2 will be sent to

D2 and the content in D0 becomes 2.

2.

The figure below illustrates the shift and writing in 1~2 execution of the instruction.

n

The content in D20 is sent to D1.

o

The content in pointer D0 becomes 1.

X10

RST

D0

D9

D8

D7

D6

D5

D4

D3

D2

D1

D0

D20

X0

SFWRP

D20

K10

D0

pointer

n = 10 points

D0 = 3 2 1

Reset the content of D0 as 0 in advance

Remarks:

This instruction can be used together with API 39 SFRD for the reading/writing of “first-in, first-out” stack data.