Quote Originally Posted by LinkMTech View Post
Hello everyone,
2. Scope screen shot of ouput signal with ON time delayed and with unwanted jitter at opposite end. If I turn the pot CCW from center, the output turn ON delay is increased from 0 to 500us.
3. Scope screen shot of ouput signal with OFF time delayed and with unwanted jitter at opposite end. If I turn the pot CW from center, the output turn OFF delay is increased from 0 to 500us.
The top trace (Yellow) is the input, bottom trace (Blue) is the output.
Input signal is 5V with 2.5ms LOW pulse and 20K pull up, pot is a 5K from 5V to GND. Output driving a current limited LED at the moment.
At first glance, your loops take different paths at different times, therefore, different numbers of instruction cycles. Look at your .lst file, count them up for the different if/then possibilities. You might need to throw a @nop in here or there to keep the timing correct.
Your 'jitter' is 500ns, which happens to be one instruction cycle at 8Mhz (2Mhz instruction rate). Which also happens to be the difference between a NOP (one cycle) and a GOTO (2 cycles).