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: Russell Shaw
Subject: Re: [avr-gcc-list] UART transmitting problem
Date: Sat, 29 Nov 2003 00:26:21 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030311 Debian/1.2.1-10

Laurence Anderson wrote:
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;
}

Can't remember if this is needed, but have you set the TXD pin
as an output? What does a CRO show?



reply via email to

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