On Wed, 30 Nov 2005 10:54, Mike Young wrote:
>     // Set baud rate
>
>     UBRRH = (unsigned char)(baudrate>>8);
>
>     UBRRL = (unsigned char)baudrate;
>
>     // Enable 2x speed
>
>     UCSRA = (1<<U2X);
>
>     // Enable receiver
>
>     UCSRB = (1<<RXEN)|(0<<TXEN)|(0<<RXCIE)|(0<<UDRIE);

This line turns the transmitter off..
I'm not sure why you have 0<<TXEN and others. I would write it as..
      UCSRB = _BV(RXEN);

>     // Async. mode, 8N1
>
>     UCSRC = (0<<UMSEL)|(0<<UPM0)|(0<<USBS)|(3<<UCSZ0)|(0<<UCPOL);

This line has the same issue as the previous one, plus if you actually want to 
modify UCSRC and not UBRRH (they are at the same address - at least on 
ATMega32's) you need to set the MSB (URSEL), eg

      UCSRC = _BV(URSEL) | _BV(UCSZ0) | _BV(UCSZ1);



-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: pgpmPlqYhOAo2.pgp
Description: PGP signature

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to