Hallo,
Danke für den Tip,
Habe es mit "AVR306: Using the AVR UART in C on tinyAVR and megaAVR
devices"
probiert, doch leider mache ich da was falsch.
Wo sollte mein Pin AN/Aus hin?
1 | ISR(USART_UDRE_vect)
|
2 | {
|
3 | unsigned char tmptail;
|
4 |
|
5 | /* Check if all data is transmitted */
|
6 | if ( USART_TxHead != USART_TxTail )
|
7 | {
|
8 | PORTD |= (1<<PORTD2);
|
9 | /* Calculate buffer index */
|
10 | tmptail = ( USART_TxTail + 1 ) & USART_TX_BUFFER_MASK;
|
11 | USART_TxTail = tmptail; /* Store new index */
|
12 |
|
13 | UDR0 = USART_TxBuf[tmptail]; /* Start transmition */
|
14 | }
|
15 | else
|
16 | {
|
17 | UCSR0B &= ~(1<<UDRIE0); /* Disable UDRE interrupt */
|
18 | PORTD &= ~(1<<PORTD2);
|
19 | }
|
20 | }
|
So schon mal nicht, und hier war auch ohne erfolg:
1 | void USART0_Transmit( unsigned char data )
|
2 | {
|
3 | PORTD |= (1<<PORTD2);
|
4 | unsigned char tmphead;
|
5 | /* Calculate buffer index */
|
6 | tmphead = ( USART_TxHead + 1 ) & USART_TX_BUFFER_MASK; /* Wait for free space in buffer */
|
7 | while ( tmphead == USART_TxTail );
|
8 |
|
9 | USART_TxBuf[tmphead] = data; /* Store data in buffer */
|
10 | USART_TxHead = tmphead; /* Store new index */
|
11 |
|
12 | UCSR0B |= (1<<UDRIE0); /* Enable UDRE interrupt */
|
13 | PORTD &= ~(1<<PORTD2);
|
14 |
|
15 | }
|
sorry, was mach ich da falsch?
Gruß
Oliver