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

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

[avr-gcc-list] furthermore UART problems


From: Carsten Scharfenberg
Subject: [avr-gcc-list] furthermore UART problems
Date: Wed, 7 Nov 2001 12:33:51 +0100

Hi,
first of all I want to thank Dean. He was absolutly right with his proposal 
of using SIGNAL instead of INTERRUPT.
My problem: I have an AVR-software that should send "hello" through UART. And 
I'm using minicom to receive the string. But what I actually get is crap - 
though the number of received bytes is ok.
This is my transmit code:

typedef struct
{
    char    *data, size, counter;
} serialTransmitInfo;

static serialTransmitInfo   transmitInfo;

SIGNAL( SIG_UART_DATA )
{
    /*
     * last byte to send? - disable UDR interrupt
     */
    if( transmitInfo.counter+1 == transmitInfo.size )
        cbi( UCR, UDRIE );

    /*
     * transmit byte and increase counter
     */
    outp( transmitInfo.data[transmitInfo.counter], UDR );
    transmitInfo.counter++;
}


void serialTransmit( char *data, char size )
{
    transmitInfo.data       = data;
    transmitInfo.size       = size;
    transmitInfo.counter    = 1;
    
    /*
     * enable UDR interrupt if more than one byte is to be sent
     */
    if( size > 1 )
        sbi( UCR, UDRIE );
    
    /*
     * transmit first byte
     */
    outp( data[0], UDR );
}

what is received by minicom is:
..'î.7.

There's no communication problem with two PCs using minicom.

I'm using a mega103L with 4MHz. These are my initial UART settings:
    outp( 0x25, UBRR );
    outp( 0x08, UCR );
with minicom I'm using 9600 8N1 with no flow control.

Carsten



reply via email to

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