I try to create periodic pulse train for the clock signal in application. I use an arduino nano board. But I noticed in scopes I see flickering pulse train behaviour. It is very hard to explain this by text, so I have uploaded to YouTube:
https://www.youtube.com/watch?v=G51mplB87Cw
As you can see in the video, the pulse train is not very stable it is flickering randomly. When I save the data as CSV or stop the screen I get the following pulse train sometimes I can catch it like below:
So at this particular point above scope shows some pulses are missing.
Here is the code I use to produce the pulses:
const int CLOCK_PIN = 5;
void setup() {
pinMode(CLOCK_PIN, OUTPUT);
}
void loop() {
for (int i=0; i<25; i++) {
//digitalWrite(CLOCK_PIN,LOW);
PORTD &= ~(1 << 5); // clock pin goes low
delayMicroseconds(2);
//digitalWrite(CLOCK_PIN,HIGH);
PORTD |= (1 << 5); // lock pin goes high
delayMicroseconds(2);
}
delay(50);
}
I couldn't figure out whether this is scope artefact or related to the code. What could be the reason for this? This is happening both in Auto and Normal trigger mode.