
PM94H201B_13xxxxxx_EN L 39
Programming
2.7.2 Memory Access Through Special System Variables
VAR_MEM_VALUE holds the value that will be read or written to the RAM file. VAR_MEM_INDEX points to the position
in the RAM file (0 to 32767) that data will be read from or written to, and VAR_MEM_INDEX_INCREMENT holds the
value that will be modified 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 le.
;Advance index after writing/reading by 1
;Record position error to RAM le 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 le.
ENDEVENT
PROGRAMSTART:
EVENT StorePE ON
{
Start some motion activity….
}
;wait until 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
Kommentare zu diesen Handbüchern