Subversion Repositories BL-Ctrl

Rev

Rev 73 | Details | Compare with Previous | 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);
63 hbuss 13
extern void DatenUebertragung(void);
1 ingob 14
 
15
struct str_DebugOut
16
{
72 hbuss 17
 unsigned char Digital[2];
73 hbuss 18
 unsigned int Analog[8];    // Debugwerte
1 ingob 19
};
20
 
21
extern struct str_DebugOut    DebugOut;
22
//Die Baud_Rate der Seriellen Schnittstelle 
23
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
24
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
25
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
26
 
27
#if X3D_SIO == 1
28
 #define BAUD_RATE 38400                //Baud Rate für die Serielle Schnittstelle      
29
#else
30
 #define BAUD_RATE 57600                //Baud Rate für die Serielle Schnittstelle      
31
#endif
32
 
33
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
34
#if defined (__AVR_ATmega128__)
35
#       define USR UCSR0A
36
#       define UCR UCSR0B
37
#       define UDR UDR0
38
#       define UBRR UBRR0L
39
#       define EICR EICRB
40
#endif
41
 
42
#if defined (__AVR_ATmega8__)
43
#       define USR UCSRA
44
#       define UCR UCSRB
45
#       define UBRR UBRRL
46
#       define EICR EICRB
47
#   define INT_VEC_RX  SIG_UART_RECV
48
#   define INT_VEC_TX  SIG_UART_TRANS
49
#endif
50
 
51
 
52
#if defined (__AVR_ATmega32__)
53
#       define USR UCSRA
54
#       define UCR UCSRB
55
#       define UBRR UBRRL
56
#       define EICR EICRB
57
#   define INT_VEC_RX  SIG_UART_RECV
58
#   define INT_VEC_TX  SIG_UART_TRANS
59
#endif
60
 
61
#if defined (__AVR_ATmega644__)
62
#       define USR  UCSR0A
63
#       define UCR  UCSR0B
64
#       define UDR  UDR0
65
#       define UBRR UBRR0L
66
#       define EICR EICR0B
67
#   define TXEN TXEN0
68
#   define RXEN RXEN0
69
#   define RXCIE RXCIE0
70
#   define TXCIE TXCIE0
71
#   define U2X  U2X0
72
#   define UCSRB UCSR0B
73
#   define UDRE UDRE0
74
#   define INT_VEC_RX  SIG_USART_RECV
75
#   define INT_VEC_TX  SIG_USART_TRANS
76
#endif
77
 
78
 
79
#endif //_UART_H