Programming – Lenze E94P PositionServo with MVOB User Manual

Page 42

Advertising
background image

40

L

PM94H201B_13xxxxxx_EN

Programming

In the RAM memory access program example, the values of PE (position error) are stored sequentially in the RAM
file every 100ms for 10 seconds. (100 samples). After collection is done the data is read from the file one by one and
compared with limit value set.

Variable VAR_MEM_INDEX is incremented every read or write by the value stored in VAR_MEM_INDEX_INCREMENT.
This could be any value from -32767 to 32767. This allows for decrement through storage locations in the RAM file
in addition to Increment. If the value is 0 (zero) no increment/decrement is produced. Var_Mem_Index is a modular
variable (it wraps around it maximum or minimum values). I.e. if the next increment or decrement of Var_Mem_Index
results in a value beyond the modulus (32767 or -32767) then the variable will wrap around to the opposite end of the
variable range. This allows for the creation of circular arrays. This feature can be used for diagnostics when certain
parameter(s) are stored in the memory continuously and then, if the system fails, the data array can be examined to
simplify diagnostics.

2.7.3 Memory Access Through MEMSET, MEMGET Statements

The memory access statements MEMSET and MEMGET are provided for simplified transfer of data between the RAM
memory and the user variables V0-V31. Using these statements, any combinations of variables V0-V31 can be stored/
retrieved with a single statement. This allows for efficient access to the RAM memory area. For example, reading 10
values from RAM memory and storing them in 10 user variables using the system variables would normally require 10
separate program statements (Vx = Var_Mem_Value). With the MEMGET statement all 10 user variables can be read
in one program statement. The format of MEMSET/MEMGET is as follows:
MEMSET

<offset> [ <varlist>]

MEMGET

<offset> [ <varlist>]

<offset>

any valid expression that evaluates to a number between -32767 to 32767

This specifies the offset in the RAM file where data will be stored or retrieved.

<varlist>

any combinations of variables V0-V31

Examples for <offset> expression
5 constant
10+23+1

constant expression

V0

variable

Must hold values in -32767 to 32767 range

V0+V1+3

expression

Must evaluate to -32767 to 32767 range

Example: <offset> =5

RAM file memory

0

1

2

3

4

5

6

... address increase

data

data

data

data

data

data

data

Examples for <varlist> instruction
[V0]

single variable will be stored/retreived

[V0,V3,V2]

variables V0,V3,V2 will be stored/retrieved

[V3-V7]

variables V3 to V7 inclusively will be stored/retrieved

[V0,V2,V4-V8] variables V0,V2, V4 through V8 will be stored/retrieved

Storage/Retrieval order with MEMSET/MEMGET
Variables in the list are always stored in order: the variable with lowest index first and the variables with highest index
last regardless of the order they appear in the <varlist> argument.
Example: [V0,V3, V5-V7] will be stored in memory in the order of increasing memory index as follows:

RAM file memory

V0

V3

V5

V6

V7

...

...

... index increase

For comparison: [V5-V7, V0, V3] will have the same storage order as the above list regardless of the order in which the
variables are listed.

Advertising