Hallo,
ich habe einen Arduino mit einem Atmega 328 der mit 8mhz läuft, leider
kommt in meinem Terminal nur blödsinn an
"...[00]€[00][00][00]€[00][00][00][00][00][00][00][00][00]€€€€[00]€€[00]
€[00][00]€€[00]€€[00]€€€[00]€[00][00]€[00]€[00]€€€[00]€[00]€€[00]€€€€[00
]€[00]€€[00][00][00]€[00][00][00][00]€[00][00][00]€[00][00][00][00][00][
00][00]€[00][00][00][00][00][00] [00][00][00][00]...."
Ich initialisiere mit
1 | #define BAUDRATE 9600
|
2 | #define BAUD_PRESCALLER (((F_CPU / (BAUDRATE * 16UL))) - 1)
|
3 | //---------------------------------
|
4 | // initialize uart
|
5 | //---------------------------------
|
6 |
|
7 | UBRR0H = (uint8_t)(BAUD_PRESCALLER>>8);
|
8 | UBRR0L = (uint8_t)(BAUD_PRESCALLER);
|
9 | UCSR0B = (1<<RXEN0)|(1<<TXEN0);
|
10 | UCSR0C = (3<<UCSZ00);
|
Und in der Main
1 | for(uint8_t i=0; i<6; i++){
|
2 | USART_putstring("Reading channel ");
|
3 | USART_send('0' + i); //This is a nifty trick when we only want to send a number between 0 and 9
|
4 | USART_putstring(" : "); //Just to keep things pretty
|
5 | uint16_t adc_value = read_adc(i); //Read one ADC channel
|
6 | itoa(adc_value, buffer, 10); //Convert the read value to an ascii string
|
7 | USART_putstring(buffer); //Send the converted value to the terminal
|
8 | USART_putstring(" "); //Some more formatting
|
9 | _delay_ms(500); //You can tweak this value to have slower or faster readings or for max speed remove this line
|
10 | }
|
Als Serial Console nutze ich Termite3.2 (9600bps,8n1,keine)
Hab ich pin setting was falsch gemacht ?
Gruß