Hello everyone ,
I am using an ArduinoUno and I want to generate a variable time shift of a rectangular 6kHz signal, that I use as a trigger input.
The time shift of the signal (both edges should be shifted) by 0-360 degrees (accordingly 0-166us for 6kHz) should be stable with an accuracy of <1us. With the code, that I have attached, I get a jitter on both edges of 2-5us, which is quite high. Has anybody an idea, how to generate a more stable shift.
- i want to serial communicate with the arduino to send the actual shift time
- the shift sould be stable with <1us
up to now I used the original rectangular signal as a trigger for the interrupt pin and wrote a function that is called, whenever the interrupt port changes. This function runs the delay (pause(t us)) and then inverts the output pin. The delay via the function pause(t us) is generated by a loop of NOPs.
In the loop I loook for a new parameter set by the serial port.
I attached my code below.
Thank you very much for your help and ideas in advance.
AnsteuerungLEDTreiber_ext.ino (916 Bytes)