Hello i hlave question about Phase shift.i have 3 16bits timers on mega 2560 where each timer generates 2 signals od 10 to 50hz.and i wanted to ask if is it possible to shift each timer of 8ms fór example.i read that timer starts to count after cs bits are written.so if i delayed writing cs bits,will be each timer shifted?
robot_chobot:
Hello i hlave question about Phase shift.i have 3 16bits timers on mega 2560 where each timer generates 2 signals od 10 to 50hz.and i wanted to ask if is it possible to shift each timer of 8ms fór example.i read that timer starts to count after cs bits are written.so if i delayed writing cs bits,will be each timer shifted?
Each timer has a count register, TCNT1, TCNT3, TCNT4, which are 16 bits and which you can overwrite
with any value whenever you want.
But i want it at same frequency but shifted one from each other by a couple of millis.
Please post your current code.
Without seeing it, I’d guess you’d want to start by setting each of TCNTn to a different starting value corresponding to their relative phase off set. But, set all of OCRnA to the same value to provide identical terminal (TOP) count values - hence, the same frequency. Then, start the counters.
Sorry the code isnt finished yet and this is only thinking how to do it and if uts possible.yes i want same ocr values for same duty cycles and same frequency of timers. You re right about that i want start timer counting a few millis from each other.so the first timer will start generally, but second timer will be shifted and started a few millis later and third timer will start few millis after . Is it possible guys?