| 1234567891011121314151617181920212223 |
- #include <avr/io.h>
- #include <string.h>
-
- #include "uart_debug.h"
-
- void Initialize_UART(uint16_t baudRate)
- {
- UBRR1H = (unsigned char)(baudRate>>8);
- UBRR1L = (unsigned char)baudRate;
- /* Enable receiver and transmitter */
- UCSR1B = (1<<RXEN1)|(1<<TXEN1);
- /* Set frame format: 8data, 2stop bit */
- UCSR1C = (1<<USBS1)|(3<<UCSZ10);
- }
-
- void Print_Debug_String(char * debugString)
- {
- for (uint8_t i = 0; i < strlen(debugString); i++)
- {
- while ( !( UCSR1A & (1<<UDRE1)));
- UDR1 = debugString[i];
- }
- }
|