Rev 39 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 39 | Rev 127 | ||
---|---|---|---|
1 | #ifndef _UART_H |
1 | #ifndef _UART_H |
2 | #define _UART_H |
2 | #define _UART_H |
3 | 3 | ||
4 | #define MAX_SENDE_BUFF 150 |
4 | #define MAX_SENDE_BUFF 150 |
5 | #define MAX_EMPFANGS_BUFF 150 |
5 | #define MAX_EMPFANGS_BUFF 150 |
6 | - | ||
7 | void BearbeiteRxDaten(void); |
- | |
8 | 6 | ||
9 | extern unsigned char DebugGetAnforderung; |
7 | extern unsigned char DebugGetAnforderung; |
10 | extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
8 | extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
11 | extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
9 | extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
12 | extern unsigned volatile char UebertragungAbgeschlossen; |
10 | extern unsigned volatile char UebertragungAbgeschlossen; |
13 | extern unsigned volatile char PC_DebugTimeout; |
11 | extern unsigned volatile char PC_DebugTimeout; |
14 | extern unsigned volatile char NeueKoordinateEmpfangen; |
12 | extern unsigned volatile char NeueKoordinateEmpfangen; |
15 | extern unsigned char MeineSlaveAdresse; |
13 | extern unsigned char MeineSlaveAdresse; |
16 | extern unsigned char PcZugriff; |
14 | extern unsigned char PcZugriff; |
17 | extern int Debug_Timer; |
15 | extern int Debug_Timer; |
18 | extern void UART_Init (void); |
16 | extern void UART_Init (void); |
19 | extern int uart_putchar (char c); |
17 | extern int uart_putchar (char c); |
20 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
18 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
21 | extern void DatenUebertragung(void); |
19 | extern void DatenUebertragung(void); |
22 | extern void DecodeNMEA(void); |
20 | extern void DecodeNMEA(void); |
23 | extern unsigned char MotorTest[4]; |
21 | extern unsigned char MotorTest[4]; |
24 | struct str_DebugOut |
22 | struct str_DebugOut |
25 | { |
23 | { |
26 | unsigned char Digital[13]; |
24 | unsigned char Digital[13]; |
27 | unsigned int AnzahlZyklen; |
25 | unsigned int AnzahlZyklen; |
28 | unsigned int Zeit; |
26 | unsigned int Zeit; |
29 | unsigned char Sekunden; |
27 | unsigned char Sekunden; |
30 | unsigned int Analog[16]; // Debugwerte |
28 | unsigned int Analog[16]; // Debugwerte |
31 | }; |
29 | }; |
32 | 30 | ||
33 | extern struct str_DebugOut DebugOut; |
31 | extern struct str_DebugOut DebugOut; |
34 | 32 | ||
35 | struct str_Debug |
33 | struct str_Debug |
36 | { |
34 | { |
37 | unsigned char Digital[2]; |
35 | unsigned char Digital[2]; |
38 | unsigned char RemoteTasten; |
36 | unsigned char RemoteTasten; |
39 | unsigned int Analog[4]; |
37 | unsigned int Analog[4]; |
40 | }; |
38 | }; |
41 | extern struct str_Debug DebugIn; |
39 | extern struct str_Debug DebugIn; |
42 | 40 | ||
43 | struct str_VersionInfo |
41 | struct str_VersionInfo |
44 | { |
42 | { |
45 | unsigned char Hauptversion; |
43 | unsigned char Hauptversion; |
46 | unsigned char Nebenversion; |
44 | unsigned char Nebenversion; |
47 | unsigned char PCKompatibel; |
45 | unsigned char PCKompatibel; |
48 | unsigned char Rserved[7]; |
46 | unsigned char Rserved[7]; |
49 | }; |
47 | }; |
50 | extern struct str_VersionInfo VersionInfo; |
48 | extern struct str_VersionInfo VersionInfo; |
51 | 49 | ||
52 | //Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
50 | //Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
53 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
51 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
54 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
52 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
55 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
53 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
56 | //#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
54 | //#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
57 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
55 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
58 | 56 | ||
59 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
57 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
60 | #if defined (__AVR_ATmega128__) |
58 | #if defined (__AVR_ATmega128__) |
61 | # define USR UCSR0A |
59 | # define USR UCSR0A |
62 | # define UCR UCSR0B |
60 | # define UCR UCSR0B |
63 | # define UDR UDR0 |
61 | # define UDR UDR0 |
64 | # define UBRR UBRR0L |
62 | # define UBRR UBRR0L |
65 | # define EICR EICRB |
63 | # define EICR EICRB |
66 | #endif |
64 | #endif |
67 | 65 | ||
68 | #if defined (__AVR_ATmega32__) |
66 | #if defined (__AVR_ATmega32__) |
69 | # define USR UCSRA |
67 | # define USR UCSRA |
70 | # define UCR UCSRB |
68 | # define UCR UCSRB |
71 | # define UBRR UBRRL |
69 | # define UBRR UBRRL |
72 | # define EICR EICRB |
70 | # define EICR EICRB |
73 | # define INT_VEC_RX SIG_UART_RECV |
71 | # define INT_VEC_RX SIG_UART_RECV |
74 | # define INT_VEC_TX SIG_UART_TRANS |
72 | # define INT_VEC_TX SIG_UART_TRANS |
75 | #endif |
73 | #endif |
76 | 74 | ||
77 | #if defined (__AVR_ATmega644__) |
75 | #if defined (__AVR_ATmega644__) |
78 | # define USR UCSR0A |
76 | # define USR UCSR0A |
79 | # define UCR UCSR0B |
77 | # define UCR UCSR0B |
80 | # define UDR UDR0 |
78 | # define UDR UDR0 |
81 | # define UBRR UBRR0L |
79 | # define UBRR UBRR0L |
82 | # define EICR EICR0B |
80 | # define EICR EICR0B |
83 | # define TXEN TXEN0 |
81 | # define TXEN TXEN0 |
84 | # define RXEN RXEN0 |
82 | # define RXEN RXEN0 |
85 | # define RXCIE RXCIE0 |
83 | # define RXCIE RXCIE0 |
86 | # define TXCIE TXCIE0 |
84 | # define TXCIE TXCIE0 |
87 | # define U2X U2X0 |
85 | # define U2X U2X0 |
88 | # define UCSRB UCSR0B |
86 | # define UCSRB UCSR0B |
89 | # define UDRE UDRE0 |
87 | # define UDRE UDRE0 |
90 | # define INT_VEC_RX SIG_USART_RECV |
88 | # define INT_VEC_RX SIG_USART_RECV |
91 | # define INT_VEC_TX SIG_USART_TRANS |
89 | # define INT_VEC_TX SIG_USART_TRANS |
92 | #endif |
90 | #endif |
93 | 91 | ||
94 | 92 | ||
95 | #endif //_UART_H |
93 | #endif //_UART_H |
96 | 94 |