[Icc-avr] preprocessor problem

Johan Wallström johan at edab.nu
Thu Jan 24 04:34:55 PST 2008


> #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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080124/b9ef496d/attachment.html


More information about the Icc-avr mailing list