printf() funktioniert schon mal.
Die Ausgabe ist schneller als SerWrite(), aber hat einen grösseren Overhead zu folge.
Code:
/******************************************************************************
Beschreibung: stdio.h
Datum: 2005-09-20
Autor: Winold Doege
Email: winne123@web.de
Font: Courier / Size: 12
******************************************************************************/
#include <stdio.h>
#include "asuro.h"
int usart_putchar( char data )
{
UCSRB = 0x08; /* enable transmitter */
while ( !( UCSRA & (1<<UDRE)) ); /* Wait for empty transmit buffer */
UDR = (unsigned char) data; /* char send */
if (data == '\n') /* new Line */
usart_putchar('\r'); /* cr */
return 0; /* Put data into buffer, sends the data */
}
int usart_getchar( void )
{
UCSRB = 0x10; /* enable receiver */
while ( !(UCSRA & (1<<RXC)) ); /* Wait for data to be received */
return (int) UDR; /* Get and return received data from buffer */
}
int main(void)
{
Init();
fdevopen(usart_putchar,usart_getchar, 0);
for(;;)
printf("\ntest");
while(1); //Endlosschleife
return(0);
}
Lesezeichen