[Icc-avr] preprocessor problem

John Baraclough j_baraclough at zetnet.co.uk
Thu Jan 24 05:16:27 PST 2008


Almost, but the opening parenthesis is in the wrong position and ideally 
the division should be prioritised. It should be:

#define T0BRR1 (T0BRR + (T0BRR/3))    //Timer-Load für Baudrate nach Int0

John


Johan Wallström wrote:
>
> > #define T0BRR1 T0BRR+ T0BRR/3 //Timer-Load für Baudrate nach Int0
> > TCNT0 = 256-T0BRR1; // Here is a wrong value 0xD4
>
> You should change the first define to
> #define (T0BRR1 T0BRR+ T0BRR/3) //Timer-Load für Baudrate nach Int0
>
> otherwise the second formula becomes
> TCNT0 = 256 - T0BRR + T0BRR/3; // Here is a wrong value 0xD4
> instead of
> TCNT0 = 256 - (T0BRR + T0BRR/3); // Here is a wrong value 0xD4
>
> cheers
> Johan Wallström
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
>   



More information about the Icc-avr mailing list