22: DUAL / TEACHING TIMER INSTRUCTIONS« FC4A MICRO SMART USER ’S MANUAL » 22-3TTIM (Teaching Timer)Applicable CPU ModulesValid OperandsFor the valid operand number range, see page 6-2.Destination operand D1 (measured value) uses 3 data registers starting with the operand designated as D1. Data registersD0 through D1297 and D2000 through D7997 can be designated as D1. Subsequent two data registers starting with desti-nation operand D1+1 are used for a system work area. Do not use these two data registers for destinations of otheradvanced instructions, and do not change values of these data registers using the Point Write function on WindLDR. If thedata in these data registers are changed, the teaching timer does not operate correctly.The teaching timer instruction cannot be used in an interrupt program. If used, a user program execution error will result,turning on special internal relay M8004 and the ERR LED on the CPU module.Examples: TTIMThe following example demonstrates a program to measure the ON duration of input I0 and to use the ON duration as apreset value for 100-ms timer instruction TIM.FC4A-C10R2/C FC4A-C16R2/C FC4A-C24R2/C FC4A-D20K3/S3 FC4A-D20RK1/RS1 & FC4A-D40K3/S3— — — — XOperand Function I Q M R T C D ConstantD1 (Destination 1) Measured value — — — — — — D0-D7997 —While input is on, the ON duration is measured in units of 100 ms and the measuredvalue is stored to a data register designated by destination operand D1.The measured time range is 0 through 6553.5 sec.TTIM D1*****I0D1D100When input I0 is turned on, TTIM resets data register D100 to zero and starts to store theON duration of input I0 to data register D100, measured in units of 100 ms.When input I0 is turned off, TTIM stops the measurement, and data register D100 main-tains the measured value of the ON duration.TTIMD100 ValueI0 ONOFF1500 ms0 15I0D1D100While input I0 is on, TTIM measures the ON duration of input I0and stores the measured value in units of 100 ms to data regis-ter D100.When input I0 is turned off, MOV(W) stores the D100 value todata register D0 as a preset value for timer T0.When input I1 is turned on, 100-ms timer T0 starts to operatewith a preset value stored in data register D0.TTIMI1TIMD0 T0I0SOTD REPS1 –D100 D1 –D0MOV(W)