The write value is interpreted in milliseconds and requires an integer, so scale the seconds value before converting it.
Why 0.001 becomes zero
Converting the real value 0.001 directly to an integer produces 0 because the value is less than one. The TOF then receives a zero-millisecond delay. Manual entry in the TOF properties follows a different representation path, which explains why entering 0.001 there can appear to work.
Convert seconds to milliseconds
Apply the conversion in this order: multiply first, then convert to an integer.
delay_ms := INT(delay_seconds * 1000)
Write_to_FB(TOF1, delay_ms)
The code is implementation-neutral pseudocode because the evidence does not identify a manufacturer, programming package, or exact block interface. Confirm the target integer type and accepted range in the actual project.
Account for timer-property behavior
In the described configuration, installing the Write to FB block causes timer parameters entered in the TOF properties to be ignored, while the write path supplies the value in milliseconds.
Verify the achievable delay
The minimum effective timing resolution is constrained by the program execution cycle, which depends on program complexity.
FAQ
Why does a 0.001-second TOF value become zero?
The real value was converted to an integer before scaling.
Send the integer value 1 because the described Write to FB path writes timer parameters in milliseconds.
Not necessarily.