Rbergman:
When you write the program you enter a value for a timer preset. However, this does not mean it is hard coded. That value can be changed at any time by your program or by an HMI by just writing to TimerName.PRE The only way to hard code a PRE is to do something like
MOV 1000 TimerName.PRE 'Move a hard coded constant into the preset
TON TimerName 'Execute the timer.
This isn't really necessary though as you design your HMI to only access the timers you want it to access.
In a SLC you could create a timer file and make all the timers in it STATIC, that way it can't be changed online.
A DINT is a 32 bit integer, the default integer size of the CLX. When you create a SINT or an INT, 4 bytes of memory are still allocated and little is gained unless you create an array or data structure; the CPU still reads memory in 32 bit gulps.
The timer PRE is the CLX is in milliseconds. It is a 32 bit word, so even in milliseconds you can still time continuously for about 25 days. Your operator is probably going to enter time in some unit other than milliseconds, so its a good idea to write that to a seperate tag and then move it to the PRE with a math operation.
You might consider creating a UDT like this one to keep the timer and the tag to which you write your actual time in seconds (or whatever units) from the HMI.
MyTimerUDT
PRE_Seconds DINT
TimerTag TIMER
Then create a tag
TIMER1 of type MyTimerUDT
Then you write your seconds from the HMI to Timer1.PRE_Seconds,
then in your program you do a
MUL Timer1.PRE_Seconds 1000 Timer1.TimerTag.PRE
TON Timer1.TimerTag.
OkiePC
A negative PRE will cause a major fault in a timer. However I believe a negative PRE is allowed in a counter in the SLC, PLC/5, and CLX - I've never tried it though.
(edit) OK, I tried it real quick with a ML1000 I have at my desk; a negative PRE is OK in a counter.