Re: [avr-gcc-list] light up and led

2005-10-07 Thread Patrick Blanchard
On Fri, 2005-10-07 at 17:52 +1000, Timothy Smith wrote: ok i understand about interupts. you register an interupt() for the specific event and when it happens it interupts the ic and runs it. the timer stuff is still a little confusing, all the abreviations are unintuitive. is there a

Re: [avr-gcc-list] light up and led

2005-10-07 Thread Joerg Wunsch
On Fri, 2005-10-07 at 17:52 +1000, Timothy Smith wrote: the timer stuff is still a little confusing, all the abreviations are unintuitive. You mean the bit names? They come straight from Atmel's datasheet. Usually, with a bit of phantasy, you could guess what they mean. /* tmr1 is

[avr-gcc-list] light up and led

2005-10-06 Thread Timothy Smith
#include avr/io.h int main(void){ DDRA |= 1PA0; while (1) { PORTA = !(1PA0); }; } i want the following code to light the led connected to porta pin0, it should work? ___ AVR-GCC-list mailing list

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Bernard Fouché
Timothy Smith wrote: i want the following code to light the led connected to porta pin0, it should work? I don't think so. Try: main() { DDRA|= 1PA0; PORTA|=1PA0; } Bernard ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Timothy Smith
Joerg Wunsch wrote: Timothy Smith [EMAIL PROTECTED] wrote: while (1) { PORTA = !(1PA0); ! is the Boolean negation. You want bitwise negation, operator ~. ok i made it turn on. now i've attempted to make it blink, unsuccessfully. the light just stays off now. also, is

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Vincent Trouilliez
ok i made it turn on. now i've attempted to make it blink, unsuccessfully. the light just stays off now. unsigned char i; DDRA |= 1PA0; while (1) { for (i=0; i2; i++) wait(); PORTA |= 1PA0; That's normal I think. You turn the LED on when i reaches 20,000,

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Joerg Wunsch
Timothy Smith [EMAIL PROTECTED] wrote: also, is there a more elegant way of doing time delays? Yes, use a hardware timer. ;-) That's what they are made for. Otherwise, have a look at the functions in avr/delay.h. -- Jorg Wunsch Unix support engineer

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Daniel Mayo
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

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Timothy Smith
Daniel Mayo wrote: 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

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Patrick Blanchard
On Thu, 2005-10-06 at 21:59 +0200, Joerg Wunsch wrote: Patrick Blanchard [EMAIL PROTECTED] 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.

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Timothy Smith
Patrick Blanchard wrote: On Thu, 2005-10-06 at 21:59 +0200, Joerg Wunsch wrote: Patrick Blanchard [EMAIL PROTECTED] 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;

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Patrick Blanchard
On Fri, 2005-10-07 at 09:54 +1000, Timothy Smith wrote: so if i was to use the PWM in an avr i could time events without holding up the rest of the program? this is a little important for my appliaction because i need to run multiple outputs at once, each being timed individually You