Sorry for my late reply, just back from holiday
Thats what I mean, OR have a master timetick to update your timers.
The saving in memory comes from this:
AB timers use 3 words.
One word for the control bits .EN, .DN, .TT, and the definition of the timebase.
Two words for the .PRE and .ACC.
You must group the timers into similar types, each type must have the same setpoint (otherwise you will spend datawords for the setpoint).
You can do away with the control bits and the timebase. Alternatively, you can assign a few bits rather than a complete word for the control. You dont need to use memory fot the timebase.
If you time down to zero rather than up from zero, then .PRE and .ACC will be converted into one word.
When the timer must start, you load it with the setpoint. You update it by decrementing it (every scan, or when the timetick tells you to).
The timer is done then its value reaches zero.
In order to save code you should use indirect addressing and a for-next loop.
msinclair said:Do you mean subtracting last scan time from an integer and doing my compares that way?
Thats what I mean, OR have a master timetick to update your timers.
The saving in memory comes from this:
AB timers use 3 words.
One word for the control bits .EN, .DN, .TT, and the definition of the timebase.
Two words for the .PRE and .ACC.
You must group the timers into similar types, each type must have the same setpoint (otherwise you will spend datawords for the setpoint).
You can do away with the control bits and the timebase. Alternatively, you can assign a few bits rather than a complete word for the control. You dont need to use memory fot the timebase.
If you time down to zero rather than up from zero, then .PRE and .ACC will be converted into one word.
When the timer must start, you load it with the setpoint. You update it by decrementing it (every scan, or when the timetick tells you to).
The timer is done then its value reaches zero.
In order to save code you should use indirect addressing and a for-next loop.