Also am Code kann es meiner Meinung nach wie gesagt nicht liegen.
Das Schema meiner Schaltung:
Atmega8 in STK500 mit externem 16Mhz Quarz und die beiden Pins PD0 und
PD1 sind überkreuzt mit dem FTDI Modul verbunden.
Solls noch genauer sein? Dann müsste ich die Modul Schematic posten!
<code>
/***********************************************************************
**
Title: example program for the Interrupt controlled UART library
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
File: $Id: test_uart.c,v 1.4 2005/07/10 11:46:30 Peter Exp $
Software: AVR-GCC 3.3
Hardware: any AVR with built-in UART, tested on AT90S8515 at 4 Mhz
DESCRIPTION:
This example shows how to use the UART library uart.c
************************************************************************
*/
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/pgmspace.h>
#include "lcd.h"
#include "uart.h"
#include "adc.h"
/* define CPU frequency in Mhz here if not defined in Makefile */
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
/* 19200 baud */
#define UART_BAUD_RATE 19200
int main(void)
{
unsigned int c;
char buffer[7];
uint16_t muh;
muh = ReadChannel(0);
/*
* Initialize UART library, pass baudrate and AVR cpu clock
* with the macro
* UART_BAUD_SELECT() (normal speed mode )
* or
* UART_BAUD_SELECT_DOUBLE_SPEED() ( double speed mode)
*/
uart_init( UART_BAUD_SELECT_DOUBLE_SPEED(UART_BAUD_RATE,F_CPU) );
sei();
/*
* Transmit string to UART
* The string is buffered by the uart library in a circular
buffer
* and one character at a time is transmitted to the UART using
interrupts.
* uart_puts() blocks if it can not write the whole string to the
circular
* buffer
*/
uart_puts("-USB-Messeinheit loading..."); uart_putc('\r');
uart_puts("-Version 0.9"); uart_putc('\r');
uart_puts("--------"); uart_putc('\r');
uart_puts("-now waiting for input"); uart_putc('\r');
uart_putc('\r');
for(;;)
{
c = uart_getc();
if ( c & UART_NO_DATA )
{
}
else
{
/*
* new data available from UART
* check for Frame or Overrun error
*/
if ( c & UART_FRAME_ERROR )
{
/* Framing Error detected, i.e no stop bit detected */
uart_puts_P("UART Frame Error: ");
}
if ( c & UART_OVERRUN_ERROR )
{
/*
* Overrun, a character already present in the UART UDR
register was
* not read by the interrupt handler before the next
character arrived,
* one or more received characters have been dropped
*/
uart_puts_P("UART Overrun Error: ");
}
if ( c & UART_BUFFER_OVERFLOW )
{
/*
* We are not reading the receive buffer fast enough,
* one or more received character have been dropped
*/
uart_puts_P("Buffer overflow error: ");
}
/*
* send received character back
*/
switch (c)
{
case '0': uart_puts_P("r_initialisieren...");
uart_putc('\r'); break;
case '1':uart_puts_P("r_>data<"); uart_putc('\r'); break;
case '2': uart_puts_P("t_timesync"); uart_putc('\r');
break;
case '3': uart_puts_P("..."); uart_putc('\r'); break;
case '4': uart_puts_P("..."); uart_putc('\r'); break;
}
//uart_putc( (unsigned char)c );
}
}
}
</code>