-2
\$\begingroup\$

What is the best way to generate 5 PWM signals in range of 10 KHz with AVR ATMega16?

I am thinking about a few possibilities:

1- Does AVR generate any PWM signal automatically on any of it ports? (I need 5 separate PWM signals)

2- Connecting AVR to any other IC which generate PWM. Is there any IC suitable for that purpose?

3- Direct connection of AVR to the opto-coupler gates and generating PWM by rudimentary ways which wastes time of AVR for doing other operations to handle 5 different PWM signals.

Or is there any other suggestion?

Update

I use a 2 row microcontroller which can be placed on bread-board. Also, I use 5 pins of Port A for ADC purpose. The frequency I use is 16 MHz. I use many ports for connecting to LCD so I cannot switch to a microcontroller which has less than 4 ports.

\$\endgroup\$
0
\$\begingroup\$

Every Output Compare output is capable of generating a PWM signal via hardware. The total number of Output Compare outputs for a AVR device is given on the first page of its datasheet as "PWM channels".

The ATmega16 has 4 Output Compare outputs, and the fifth can be generated in software using timer interrupts. On the other hand the ATmega168PA has 6, if there is still room in the design for change.

\$\endgroup\$
  • \$\begingroup\$ which ports are used for pwm generation? \$\endgroup\$ – barej Mar 15 '15 at 1:44
  • \$\begingroup\$ Like the datasheet says, there is 1 on port B and 3 on port D. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 15 '15 at 1:45
  • \$\begingroup\$ So as you said i should switch from ATmega16 to ATmega168PA to have 5 PWM output. Then does ATmega168PA have all other functionalities of ATmega16? or I may miss a few things such as high frequency, ADC or ...? \$\endgroup\$ – barej Mar 15 '15 at 1:47
  • \$\begingroup\$ The full set of differences can be determined from the datasheets. But the '168PA has no port A and is missing the high bit from port C, and has fewer pins in general. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 15 '15 at 1:51
  • \$\begingroup\$ thank you. I made an update. So, according to my case, what is your suggestion? \$\endgroup\$ – barej Mar 15 '15 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.