beautypg.com

Delta RMC151 User Manual

Page 363

background image

5 Programming

Notice that although the variable table is broken up into multiple individual files (%MD56,

%MD57, etc.), the COPY function can wrap across these file boundaries. For example,

copying 30 registers to %MD56.250 will place the first 6 items in %MD56.250 to

%MD56.255, and the last 24 items in %MD57.0 to %MD57.23.
An invalid address parameter during compile will trigger a verify error. An invalid address

parameter during runtime will trigger a program fault and stop the current task, and the

copy will not be performed. This applies to src and dst and the entire range as defined by

len.
Multiple COPY statements can be used in a single Expression (113) command, each

copying up to 32 registers. Like all assignment expressions, the COPY statement will

execute completely before going to the next assignment or copy.

Examples

For the examples that follow, use the following variable table. Notice that i and Len are

DINTs.

Variable Tag Name

Type

ProfiData

DWORD[16]

0

ProfiData[0]

DWORD

1

ProfiData[1]

DWORD

:

:

:

15

ProfiData[15]

DWORD

16

i

DINT

17

Len

DINT

18

REAL

19

Move1ReqPos

REAL

20

Move1Vel

REAL

21

REAL

CurveData

REAL[500]

22

CurveData[0]

REAL

23

CurveData[1]

REAL

24

CurveData[2]

REAL

:

:

:

521

CurveData[499] REAL

Example: Copying values

Copy two values from ProfiData[1] and ProfiData[2] to Move1ReqPos and Move1Vel:

COPY(ProfiData[1],Move1ReqPos, 2);

Example: Writing Curve Data

Writing a curve with 500 registers into CurveData via PROFIBUS. In this example, only 16

registers can be sent to the RMC at a time. A user program would do a loop that transfers

the data from ProfiData[2] through ProfiData[15] in successive copies, with some

handshaking done between each copy. The variable i must be initialized to zero before

starting this loop. The loop assumed to stop when i reaches 500:

Len := MAX(500 - i, 14);
COPY(ProfiData[2], CurveData[i], Len);
i := i + Len;

Using COPY with the ADDR_OFS Function

deltamotion.com

343

This manual is related to the following products: