avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] PWM newbie problem


From: Richard Urwin
Subject: Re: [avr-gcc-list] PWM newbie problem
Date: Thu, 18 Mar 2004 23:11:32 +0000
User-agent: KMail/1.5.3

On Thursday 18 Mar 2004 10:29 pm, Steve Turner wrote:
> Hi everyone,
>     I am just starting with the AVR's. I have a program to control an
> LED using PWM with 2 switches (4 possible values). I am using the
> STK-500. I can't seem to find any problems with the program, but the
> LED appears to be fully lit no matter what I press. Any observations
> would be appreciated.

Off the top of my head:

  switch (PINC & 3)

I don't know what your hardware is though, so your code might be right.

Even better would be:

  thistogs = PINC
  if (thistogs != oldtogs)
  {
   oldtogs = thistogs; //save toggle switch value
   switch (thistogs)

You can get strange race effects if PINC changes halfway through the 
code. I don't think they would cause what you're seeing now though.

-- 
Richard Urwin

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]