On Fri, Jan 04, 2008 at 03:09:07PM -0800, Rick Altherr wrote:
> If your switch is betwen PD0 and +5V, why do you need the pullups enabled?  
> That would make it always be +5V since when the switch is off, it would be 
> pulled up by the pull-ups.

Reading the datasheet, setting PORTD to zero should disable the pullups.
To be sure, I tried adding a line to force it:

MCUCR = _BV(PUD);

This makes no difference.

So, either I am not setting the pin's up properly. OR, I am not reading
from them correctly. Or both.

> So, every iteration through the loop, PD0 is checked to see if it is
> 1.
> Because of the above, it always is.  Then, it toggles PC4.  Depending
> on
> how fast the clock is going, this could easily be toggling at a rate
> that
> the naked eye cannot see.  For a 1MHz part, it could take 4 cycles to
> run
> an iteration of the loop, so the LED would be toggling at 250KHz, or
> stated
> another way, would have a 50% duty cycle at 125KHz.

That makes sense. Sticking a delay in the loop just makes it sit there
and flash.

J



_______________________________________________
AVR-chat mailing list
AVR-chat@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to