Author Topic: [Solved] Atmega168 - PWM Question  (Read 1330 times)

0 Members and 1 Guest are viewing this topic.

Offline ksquaredTopic starter

  • Jr. Member
  • **
  • Posts: 45
  • Helpful? 0
[Solved] Atmega168 - PWM Question
« on: December 28, 2010, 04:02:10 PM »
Edit: My own lack of attention to detail is what caused this.  Sorry... I did this on a breadboard with the LED in the right place (ie, on a PWM pin) and when I did this on my permanent $50 dollar bot board, I didn't realize I had moved the L.E.D. on my breadboard.

BTW, thanks, that was the answer I was looking for anyhows...

I was trying to program some PWM for the first time in a long time (although I thought I had it working earlier this year.)

Some pins seem designated PWM; some pins do not.  Try:

or just use the reference sheet from this tutorial: http://www.societyofrobots.com/member_tutorials/node/233

However this tutorial http://www.societyofrobots.com/member_tutorials/node/226 has a subroutine that goes starts like this:

void pwmInit56(void)  {    // Pin 6 is channel A and Pin 5 is channel B

Which seems to imply that hardware PWM can be put on Pin 6, for example, which does not seem to be a PWM pin. Is this true?  Are there limitations to this?  I'm actually pretty confused; I couldn't find anything in that code which would seem to change the pins around.

Oh, and thanks in Advance for any help!
« Last Edit: December 29, 2010, 10:13:46 PM by ksquared »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: Atmega168 - PWM Question
« Reply #1 on: December 28, 2010, 05:20:02 PM »
The picture you linked is the Arduino pin mappings, so is this a generic AVR PWM question or a Arduino pin question?

The Atmega only has 6 pins available for hardware PWM, via the 2 channels of 3 timers. PD3,6,7 and PB1,2,3. 


Get Your Ad Here