Problem mit RS232 AtMega 128 RIBU-Board

OP (Firma: TGM) #1672444
Lesenswert?

HI!

Ich habe das Problem, dass trotz, meiner Meinung nach, voll 
funktionstüchtigen Quellcodes, nichts über die RS232 übertragen wird. 
Hab ihr vl eine Lösung für mein Problem. Eine Vermutung von mir ist, 
dass es am RIBU-Board liegt.
Ich will mich schon mal für alle Hilfestellungen im Vorhinein bedanken.

Lg Oliver
1
#include <avr/io.h>
2
#include <util/delay.h>
3
#include <avr/interrupt.h>
4

5

6

7
#define PROZESSORTAKT  16000000
8

9
#define UART_BAUDRATE  9600
10
#define UART_SETTING  ((PROZESSORTAKT)/((UART_BAUDRATE)*16l)-1)
11

12

13
void USART_Init( unsigned int ubrr ) {
14
  /* Set baud rate */ 
15
  UBRR0H = (unsigned char)(ubrr>>8); 
16
  UBRR0L = (unsigned char)ubrr; 
17
  /* Enable receiver and transmitter */ 
18
  UCSR0B = (1<<RXEN0)|(1<<TXEN0); 
19

20
  /* Set frame format: 8data, 1stop bit */ 
21
  UCSR0C =(1<<UCSZ01)|(1<<UCSZ00);
22
}
23

24
void USART_Transmit( unsigned char data ) {
25
  /* Wait for empty transmit buffer */ 
26
    while ( !( UCSR0A & (1<<UDRE0)) )
27
    ; /* Put data into buffer, sends the data */ 
28
  UDR0 = data;
29

30
}
31

32
void USART_Transmit_String( char* databuffer )
33
{
34
  while (*databuffer!=0)
35
  {
36
    USART_Transmit(*databuffer);
37
    databuffer++;
38
  }
39

40
  USART_Transmit(0x0D);
41
  USART_Transmit('\n');
42
  
43
}
44

45

46
/*SIGNAL(USART0_RX_vect) 
47
{
48
  // UDR0;
49
}*/
50

51

52

53
int main () {
54
  sei();  
55

56
  // Usart
57
  USART_Init(UART_SETTING);
58

59
  
60
  for(;;) 
61
  {
62
    USART_Transmit_String("abc");
63
  }
64

65

66
  return 0;
67
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren