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

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

Re: [avr-gcc-list] UART transmitting problem


From: Laurence Anderson
Subject: Re: [avr-gcc-list] UART transmitting problem
Date: Fri, 28 Nov 2003 12:20:45 +0000
User-agent: KMail/1.5

Hi Guys,

I've updated the program, and used the latest winavr distro, and its still see 
nothing in hyperterminal. Just to give more background, I have receiving 
working fine. Also the origional code seems to transmit ok, so I gradually 
removed parts of the code & re-tested, gradually it got more unreliable (only 
sending a message every 3 times it was turned on), then just sent one space 
instead of the message, until it did nothing, and this was just by removing 
code not relevant to transmitting! In one case removing an unsued global int 
stopped it working! What could cause something like this?

Thanks for all the help,

Laurence

#include <avr/io.h>

char *message = "Testing, testing, 1-2-3";

int main()
{
        char c, *buf = message;

        // Enable transmitting, 9600bps (clock is 4Mhz)
        UCR = _BV(TXEN);
        UBRR = 25;

        while ( ( c = *buf++ ) != '\0' ) {
                UDR = c;
                loop_until_bit_is_set( USR, UDRE );
        }

        return 0;
}



reply via email to

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