|
From: | Daniel Mayo |
Subject: | Re: [avr-gcc-list] light up and led |
Date: | Thu, 06 Oct 2005 16:56:17 -0500 |
User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
A hardware clock is different than a hardware timer.Look at the datasheet for the AVR you are using. The hardware timer is built into the AVR, and if all you want to do is flash an LED, like the previous poster wrote, you would find that it's really easy to place such a routine in a timer function of a controller. (of course, if all you want to do is flash an led, and that's it, sure a hardware solution alone would be much easier and cheaper).
Dan Timothy Smith wrote:
Joerg Wunsch wrote:Patrick Blanchard <address@hidden> wrote:Yes, use a hardware timer. ;-) ...Otherwise, have a look at the functions in <avr/delay.h>.FWIW using the delay.h made more sense for me; easier code to follow.It eats up your CPU. Even if you don't have any other work for your CPU while waiting, with a hardware timer, you could at least reduce the overall power consumption by putting the CPU to sleep. Sure, for really short delays, a spin-loop makes sense, but when you want your LED to blink, just use it as a good example to get acquainted with hardware timers (even though obviously, conserving energy isn't the most important feature of a LED blinker ;-). It's for some reason that even the very simple demo.c that accompanies avr-libc uses a hardware timer.ok, my controller board has a hardware clock on it i'll use it _______________________________________________ AVR-GCC-list mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
-- Daniel Mayo Design Engineer (Test) DICKEY-john Corporation 5200 DICKEY-john Road Auburn, IL 62615 (217) 438-2437 (phone) address@hidden
[Prev in Thread] | Current Thread | [Next in Thread] |