| AVR Z-LINKŪ | |||||
Definition in file usart.h.
#include <stdbool.h>
#include <stdint.h>
#include "compiler.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.
Defines | |
| #define | DISABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B &= ~( 1 << RXCIE0 ) ) |
| #define | DISABLE_RECEIVER ( UCSR0B &= ~( 1 << RXEN0 ) ) |
| #define | DISABLE_TRANSMITTER ( UCSR0B &= ~( 1 << TXEN0 ) ) |
| #define | ENABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B |= ( 1 << RXCIE0 ) ) |
| #define | ENABLE_RECEIVER ( UCSR0B |= ( 1 << RXEN0 ) ) |
| #define | ENABLE_TRANSMITTER ( UCSR0B |= ( 1 << TXEN0 ) ) |
Enumerations | |
| enum | baudRate_t { BR_9600 = 0x33, BR_19200 = 0x19, BR_38400 = 0x0C } |
| Enumeration that defines the available baud rates for the serial interface. The values cana be found in the datasheet on page 233. More... | |
Functions | |
| void | uartInitialization (const baudRate_t rate) |
| Initialize USART0 8-N-1. | |
| void | uartSendSymbol (const uint8_t symbol) |
| Send one symbol on the serial line. | |
| #define DISABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B &= ~( 1 << RXCIE0 ) ) |
| #define DISABLE_RECEIVER ( UCSR0B &= ~( 1 << RXEN0 ) ) |
| #define DISABLE_TRANSMITTER ( UCSR0B &= ~( 1 << TXEN0 ) ) |
| #define ENABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B |= ( 1 << RXCIE0 ) ) |
Enables an interrupt each time the receiver completes a symbol.
Definition at line 41 of file usart.h.
Referenced by uartInitialization().
| #define ENABLE_RECEIVER ( UCSR0B |= ( 1 << RXEN0 ) ) |
| #define ENABLE_TRANSMITTER ( UCSR0B |= ( 1 << TXEN0 ) ) |
| enum baudRate_t |
Enumeration that defines the available baud rates for
the serial interface. The values cana be found in the datasheet on page 233.
| BR_9600 | Sets the baud rate to 9600. |
| BR_19200 | Sets the baud rate to 19200. |
| BR_38400 | Sets the baud rate to 38400. |
Definition at line 52 of file usart.h.
00052 { 00053 00054 BR_9600 = 0x33, 00055 BR_19200 = 0x19, 00056 BR_38400 = 0x0C 00057 }baudRate_t;
| void uartInitialization | ( | const baudRate_t | rate | ) |
Initialize USART0 8-N-1.
| rate | Baudrate to run the USART0 at. The tested rates are: 9600, 19200 and 38400. |
Definition at line 39 of file usart.c.
References ENABLE_RECEIVE_COMPLETE_INTERRUPT, ENABLE_RECEIVER, and ENABLE_TRANSMITTER.
Referenced by serialInterfaceInitialization().
00039 { 00040 00041 //Initialize USART module. 00042 UBRR0H = 0x00; 00043 UBRR0L = rate; 00044 00045 //Enable USART transmitter module. Always on. 00046 ENABLE_RECEIVER; 00047 ENABLE_TRANSMITTER; 00048 00049 //8-N-1. 00050 UCSR0C |= ( 1 << UCSZ01 ) | ( 1 << UCSZ00 ); 00051 00052 ENABLE_RECEIVE_COMPLETE_INTERRUPT; 00053 00054 return; 00055 }
| void uartSendSymbol | ( | const uint8_t | symbol | ) |
Send one symbol on the serial line.
This function passes one symbol (8 bits) to the USART module on the AVR.
| symbol | Symbol to be sent. |
Definition at line 66 of file usart.c.
Referenced by sendSymbol().
00066 { 00067 00068 //Wait until the USART module is ready to 00069 //transmit a new symbol. 00070 for( ; !( UCSR0A & ( 1 << UDRE0 ) ); ){ 00071 00072 ; 00073 } 00074 00075 //Put symbol in data register. 00076 UDR0 = symbol; 00077 00078 return; 00079 }
Generated on Sat Dec 2 16:05:51 2006 for AVR414 User's Guide - ATAVRRZ502 - Accessory Kit by 1.4.7
|