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

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

[avr-gcc-list] Re: avr-gcc-list digest, Vol 1 #222 - 4 msgs


From: Dean Ferreyra
Subject: [avr-gcc-list] Re: avr-gcc-list digest, Vol 1 #222 - 4 msgs
Date: Thu, 08 Nov 2001 13:25:13 -0800

Patrick,

There are a lot of things that need fixing in your code.  For starters, I
suggest you read Rich Neswold's excellent document at
http://www.enteract.com/~rneswold/avr.

You seem to be confusing the purpose of outp().  It sets all eight bits to
the value you pass it.  If you want to twiddle a single bit, use the sbi()
and cbi() macros.  So to enable the timer overflow, you have

>   outp(TOIE0, TIMSK);         // enable TCNT0 overflow

which sets all the bits in TIMSK to zero.  Instead, use

    sbi(TIMSK, TOIE0);

Also, this line

>  outp(CS02 && CS00,TCCR0);   //

sets all the bits in TCCR0 to zero (or two if you change the "&&" to "&").
Instead, use

    outp(5, TCCR0);

or

    sbi(TCCR0, CS00);
    sbi(TCCR0, CS02);

These changes are a start.  You may even see some flashing LEDs!

Dean Ferreyra




reply via email to

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