Hallo Zusammen,
als Mikrocontroller- Neuling habe ich mich an UART ran gewagt. Seit
Tagen versuch ich es schon, aber irgend etwas läuft schief. Alle
Beispiele die ich bis her gefunden habe funktionieren nicht richtig. Ich
bekomme im Terminal immer irgend welche Sonderzeichen, obwohl dich die
richtige Baudrate eingestellt habe.
Ich habe einen atmega644 ohne Quarz an meinem Pollin Board hängen.
Das ist mein Code:
1 | #define UART_BAUD_RATE 4800
|
2 |
|
3 |
|
4 | int main(void)
|
5 | {
|
6 | uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
|
7 | sei();
|
8 | while(1)
|
9 | {
|
10 | uart_puts( "Hallo " );
|
11 | }
|
12 |
|
13 | return 0;
|
14 | }
|
Das hier ist der Anfang meines Makefiles:
1 | # MCU
|
2 | MCU = atmega644
|
3 |
|
4 | # Main Oscillator Frequency
|
5 | # This is only used to define F_OSC in all assembler and c-sources.
|
6 | F_OSC = 3686400
|
7 |
|
8 |
|
9 | # Processor frequency.
|
10 | # This will define a symbol, F_CPU, in all source code files equal to the
|
11 | # processor frequency. You can then use this symbol in your source code to
|
12 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
13 | # automatically to create a 32-bit value in your source code.
|
14 | F_CPU = 1000000
|
15 |
|
16 |
|
17 |
|
18 | # Output format. (can be srec, ihex, binary)
|
19 | FORMAT = ihex
|
20 |
|
21 |
|
22 | # Target file name (without extension).
|
23 | #TARGET = test_uart
|
24 | TARGET = main
|
25 |
|
26 | # List C source files here. (C dependencies are automatically generated.)
|
27 | SRC = $(TARGET).c uart.c
|
28 |
|
29 | .....
|
Könnte mir jemand einen Tipp geben ???
Danke