www.emesystems.com has some good information (see the "app-notes" link) on the execution time of various statements. The only way to get millisecond accuracy would be to use external hardware. This scheme may be good enough for your circumstances and would give you a resolution on the order of 1ms.
timePulse:
if in0 = 0 then timePulse ' wait for the leading edge of the pulse
waitForEnd:
time = time + 1 + 0 ' the extra addition adds about 140us
if in0 = 1 then waitForEnd ' continue until the trailing edge of the pulse
return
You'd take the resulting value and apply a correction factor that you'd have to determine empirically since Tracy's website doesn't give timings for all the operations used.
Comments
You'd take the resulting value and apply a correction factor that you'd have to determine empirically since Tracy's website doesn't give timings for all the operations used.