Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | #ifndef _UART_H |
2 | #define _UART_H |
||
3 | |||
4 | extern unsigned volatile char SIO_Sollwert; |
||
5 | extern unsigned volatile char UebertragungAbgeschlossen; |
||
6 | extern unsigned volatile char PC_DebugTimeout; |
||
7 | extern unsigned char MeineSlaveAdresse; |
||
8 | extern int Debug_Timer; |
||
9 | extern void UART_Init (void); |
||
10 | extern int uart_putchar (char c); |
||
11 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
||
12 | extern void SendUart(void); |
||
13 | |||
14 | struct str_DebugOut |
||
15 | { |
||
16 | unsigned char Digital[13]; |
||
17 | unsigned int AnzahlZyklen; |
||
18 | unsigned int Zeit; |
||
19 | unsigned char Sekunden; |
||
20 | unsigned int Analog[8]; // Debugwerte |
||
21 | }; |
||
22 | |||
23 | extern struct str_DebugOut DebugOut; |
||
24 | //Die Baud_Rate der Seriellen Schnittstelle |
||
25 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
||
26 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
||
27 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
||
28 | |||
29 | #if X3D_SIO == 1 |
||
30 | #define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
||
31 | #else |
||
32 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
||
33 | #endif |
||
34 | |||
35 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
||
36 | #if defined (__AVR_ATmega128__) |
||
37 | # define USR UCSR0A |
||
38 | # define UCR UCSR0B |
||
39 | # define UDR UDR0 |
||
40 | # define UBRR UBRR0L |
||
41 | # define EICR EICRB |
||
42 | #endif |
||
43 | |||
44 | #if defined (__AVR_ATmega8__) |
||
45 | # define USR UCSRA |
||
46 | # define UCR UCSRB |
||
47 | # define UBRR UBRRL |
||
48 | # define EICR EICRB |
||
49 | # define INT_VEC_RX SIG_UART_RECV |
||
50 | # define INT_VEC_TX SIG_UART_TRANS |
||
51 | #endif |
||
52 | |||
53 | |||
54 | #if defined (__AVR_ATmega32__) |
||
55 | # define USR UCSRA |
||
56 | # define UCR UCSRB |
||
57 | # define UBRR UBRRL |
||
58 | # define EICR EICRB |
||
59 | # define INT_VEC_RX SIG_UART_RECV |
||
60 | # define INT_VEC_TX SIG_UART_TRANS |
||
61 | #endif |
||
62 | |||
63 | #if defined (__AVR_ATmega644__) |
||
64 | # define USR UCSR0A |
||
65 | # define UCR UCSR0B |
||
66 | # define UDR UDR0 |
||
67 | # define UBRR UBRR0L |
||
68 | # define EICR EICR0B |
||
69 | # define TXEN TXEN0 |
||
70 | # define RXEN RXEN0 |
||
71 | # define RXCIE RXCIE0 |
||
72 | # define TXCIE TXCIE0 |
||
73 | # define U2X U2X0 |
||
74 | # define UCSRB UCSR0B |
||
75 | # define UDRE UDRE0 |
||
76 | # define INT_VEC_RX SIG_USART_RECV |
||
77 | # define INT_VEC_TX SIG_USART_TRANS |
||
78 | #endif |
||
79 | |||
80 | |||
81 | #endif //_UART_H |