Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uart_debug.c 500B

1234567891011121314151617181920212223
  1. #include <avr/io.h>
  2. #include <string.h>
  3. #include "uart_debug.h"
  4. void Initialize_UART(uint16_t baudRate)
  5. {
  6. UBRR1H = (unsigned char)(baudRate>>8);
  7. UBRR1L = (unsigned char)baudRate;
  8. /* Enable receiver and transmitter */
  9. UCSR1B = (1<<RXEN1)|(1<<TXEN1);
  10. /* Set frame format: 8data, 2stop bit */
  11. UCSR1C = (1<<USBS1)|(3<<UCSZ10);
  12. }
  13. void Print_Debug_String(char * debugString)
  14. {
  15. for (uint8_t i = 0; i < strlen(debugString); i++)
  16. {
  17. while ( !( UCSR1A & (1<<UDRE1)));
  18. UDR1 = debugString[i];
  19. }
  20. }