SWARM-Bot Firmware  v1.0
Mobile robot OS - Embedded C/C++
__usart__.h File Reference

Header file for pid.c. More...

#include <asf.h>
#include <stdio.h>
#include <board.h>
#include <conf_board.h>
#include <util/delay.h>
Include dependency graph for __usart__.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BAUD   57600
 
#define RX_BUFSIZE   120
 
#define BRC   ((F_CPU/(16UL*BAUD)) - 1)
 

Functions

void usart_init (void)
 

Detailed Description

Header file for pid.c.

  • File: usart.h
  • Compiler: GCC-AVR
  • Supported devices: Tested on 328p
  • AppNote: USART module driver
Author
Swarm robot graduation project workgroub
Mechatronics Program for the Distinguished
$Name$
Revision
456

$RCSfile$

Date
021-5

Definition in file __usart__.h.

Function Documentation

◆ usart_init()

void usart_init ( void  )

Initialize the USART module with

Parameters
BAUD
23 {
24  UBRR0H = (uint8_t) (BRC >> 8); // baud
25  UBRR0L = (uint8_t) BRC; // baud
26 
27  UCSR0B = (1 << TXEN0) | (1 << RXEN0); // enable rx and tx
28  UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); // clock
29  //UCSR0A |= (1 << U2X0); // double speed
30 
31  stdin = stdout = &uart_str; // link stdin and stdout to uart
32 
33 }

Referenced by board_init().

Here is the caller graph for this function: