2 memory access through special system variables, Programming – Lenze PM94P01C User Manual
Page 41

PM94P01C
39
Programming
2.7.2 Memory Access Through Special System Variables
MEM_INDEX holds the value that will be read or written to the RAM file. MEM_INDEX points to the position in the RAM
file (0 to 32767) and MEM_INDEX_INCREMENT holds the value that MEM_INDEX is going to modify after the read or
write operation is completed.
The RAM memory access is illustrated with the example program herein.
;---------------------------------------------------------------------------
;User’s program to read/write to RAM file.
;Advance index after writing/reading by 1
;Record position error to RAM file every 100 ms for 10 seconds. 10/0.1 = 100
;locations are needed
;---------------------------------------------------------------------------
#DEFINE
IndexStart
0
#DEFINE
MemIncrement
1
#DEFINE
RecordLength
100
#DEFINE
PElimit
0.1
;0.1 user unit
VAR_MEM_INDEX = IndexStart
;set start position
VAR_MEM_INDEX_INCREMENT=MemIncrement
;set increment
;---------------------------------------------------------------------------
EVENT StorePE TIME 100
VAR_MEM_VALUE = VAR_POSERROR
;store in RAM file.
ENDEVENT
PROGRAMSTART:
EVENT StorePE ON
{
Start some motion activity….
}
;wait for data collection is over
WHILE VAR_MEM_INDEX < (IndexStart+RecordLength)
ENDWHILE
EVENT StorePE Off
;turn off storage
;Analyze data collected. If PE > PElimit then signal system has low performance…
VAR_MEM_INDEX= IndexStart
WHILE VAR_MEM_INDEX < (IndexStart+RecordLength)
IF (VAR_MEM_VALUE > PElimit)
GOTO Label_SignalBad
ENDIF
ENDWHILE
LabelSignalBad:
{
Signal that PE out of limits
…
}
END