Synchronise timer of arduino

Hello everyone,
I use pwm pins of arduino mega to generated a pwm for a project. Arduino mega have five timers, where every timer control a specfic pin like timer 2 control pin 9.and 10. I need to use three timers. I want a code to synchronise the three timers. Is it possible?

You can set all the timers to use a common clock source and common clock divider. They will stay in sync if you put a bit of effort into starting them in sync.

If you're doing 3-phase PWM, there's even special hardware functions for that.

Unfortunately reading the datasheet takes a lot of time to understand what hardware supports your needs.

"You can set all the timers to use a common clock source and common clock divider. They will stay in sync if you put a bit of effort into starting them in sync."

Can you explain the way?

"If you're doing 3-phase PWM, there's even special hardware functions for that.

Unfortunately reading the datasheet takes a lot of time to understand what hardware supports your needs."

No, I want to generate different five pulses for a single phase inverter. I use pin 2,3,7,8, and 44. Can you send me the data sheet?

In the ATmega2560 datasheet read up on the GTCCR register. It can be used to synchronize Timers 0,1,3,4 & 5.

Firas-Fadhil:
No, I want to generate different five pulses for a single phase inverter.

Please elaborate. What pulses exactly? What timing? An image would help a lot here.

An inverter implies 50/60 Hz. That's so slow even bitbanging will do just fine.

Or if using timers just set them at the same prescaler, then reset the counters themselves one by one and not worry about the 1-2 clock cycles you're off (as that's less than 10 ppm).

Can you send me the data sheet?

Datasheet - because you're too lazy.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you tell us what you are trying to accomplish?
What is the application?

Thanks.. Tom.. :slight_smile: