|
From: | Mike Young |
Subject: | Re: [avr-gcc-list] Butterfly RS232? |
Date: | Tue, 29 Nov 2005 18:24:36 -0600 |
The gcc-port code looks as follows. Connection settings on the PC are 19200, 8N1, no handshake. Receive works just fine, else I wouldn't be bothering you with it. I know for certain the code gets to the _Tx function when it should. It hits breakpoints in the debugger, and I've added that annoying PlayClick in the callers.
void USART_Init(unsigned int baudrate) { // 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); // Async. mode, 8N1 UCSRC = (0<<UMSEL)|(0<<UPM0)|(0<<USBS)|(3<<UCSZ0)|(0<<UCPOL); } void Usart_Tx(char data) { while (!(UCSRA & (1<<UDRE))); UDR = data; } char Usart_Rx(void) { while (!(UCSRA & (1<<RXC))); return UDR; }----- Original Message ----- From: "Steve Franks" <address@hidden>
To: "'Mike Young'" <address@hidden> Sent: Tuesday, November 29, 2005 5:50 PM Subject: RE: [avr-gcc-list] Butterfly RS232?
Mike,I've done it, seems to work fine for me. Hooked up DB9 directly to the pinson the butterfly. Will try to remember to send code when home this eve. Steve-----Original Message----- From: Mike Young [mailto:address@hidden Sent: Tuesday, November 29, 2005 1:15 PM To: address@hidden Subject: [avr-gcc-list] Butterfly RS232? Looking at the schematic for the Butterfly, it's not readily apparent how it manages to translate levels for outbound data. The docs seem to say it's supposed to work, but my primitive understanding of electronics matches the results: non-receipt of "transmitted" data. It could also be my primitive understanding of the mega169's usart that's at fault. Is the ported gcc Butterfly usart code supposed to work? Many thanks. Mike.
[Prev in Thread] | Current Thread | [Next in Thread] |