Skip to main content
Topic: Delay time inaccurate (Read 1448 times) previous topic - next topic

Delay time inaccurate

I want to create a slow pulse signal. 100 ms on, 50ms off, 30ms on , 30ms off etc.
I tried the AUX pin and the delay function % and & in 2-wire or 3-wire mode.
With something like A%:100a%:50A%:30a%30
But the timing I get is completely out.
Something like: 130ms, 68ms, 44ms

When using the & (us) delay it's even worse. a on off sequence with one & takes about 1.5ms instead of 1us.
How can I generate an accurate pulse train?

Sorry if that question has been asked before, just couldn't find anything in the posts.

Re: Delay time inaccurate

Reply #1
the delay is (a bit) accurate, however there is overhead to parse the command, read in the next, print the status, housekeeping, etc.

Unfortunately it is near impossible to get it right in all cases... In fact I'm surprized that it is this 'accurate' :)

Re: Delay time inaccurate

Reply #2
Thanks for the answer.
Is there any other way then to generate an accurate pulse? Does the 'binary' interface work any more predictable? I can adjust if there is some known processing delay, but so far it all looks a bit random.
Is there any way to get the parsing done upfront?

Re: Delay time inaccurate

Reply #3
I would say a 1ms delay with repeat would have an overhead of 30-ish %. Perhaps if we change the source to make a ms .75ms it would be a bit more perfect. Note the bit part ;)

Dunno about the binary interface, but i _assume_ it is a bit better :)


Re: Delay time inaccurate

Reply #4
I think what won't work much. Assuming the command parsing is constant then the time is: parse time + 1 real ms + repeat time.
So some kind of fixed offset to each use.
I'll play a bit with it if I can figure out the various processing times. The last test came up with fairly random offsets. But I'll try again.