50 Publication 1756-PM004C-EN-P - October 2009
Chapter 2 Organize Tags
The following example loads a series of preset values into a timer, one value
(array element) at a time.
Step through an array.
The timer_presets array stores a series of preset values for the timer in the next rung. The north_tank.step tag points to
which element of the array to use. For example, when north_tank.step equals 0, the instruction loads timer_presets[0]
into the timer (60,000 ms).
When north_tank.step_time is done, the rung increments north_tank.step to the next number and that element of the
timer_presets array loads into the timer.
When north_tank.step exceeds the size of the array, the rung resets the tag to start at the first element in the array. (The
array contains elements 0…3.)
42358
Move
Source timer_presets[north_tank.step]
60000
Dest north_tank.step_time.PRE
60000
MOV
/
north_tank.step_time.DN
EN
DN
Timer On Delay
Timer north_tank.step_time
Preset 60000
Accum 0
TON
north_tank.step_time.DN
Add
Source A 1
Source B north_tank.step
0
Dest north_tank.step
0
ADD
Equal
Source A north_tank.step
0
Source B 4
EQU
Move
Source 0
Dest north_tank.step
0
MOV