Elisa3
usart.h File Reference

Usart module. More...

#include "variables.h"
#include <avr\io.h>
#include <avr\interrupt.h>

Go to the source code of this file.

Functions

void initUsart0 ()
 Configure the usart0 registers to work at 57600 baud (8-bit data, no parity, 1 stop bit). Moreover the interrupt for reception is enabled.
void initUsart1 ()
 Configure the usart1 registers to work at 57600 baud (8-bit data, no parity, 1 stop bit). Moreover the interrupt for reception is enabled.
void usart0Transmit (unsigned char data, unsigned char isBlocking)
 Transfer one byte of data; it's blocking (wait until the buffer is empty).
void usart1Transmit (unsigned char data, unsigned char isBlocking)
 Transfer one byte of data; it's blocking (wait until the buffer is empty).
void closeUsart ()
 Close the usart peripheral and disable all interrupts.
char usart0InputBufferEmpty ()
 Check whether there is something to read from usart0.
unsigned char usart0Receive ()
 Wait until a byte has been received or the timeout is expired.

Detailed Description

Usart module.

Author:
Stefano Morgani <stefano@gctronic.com>
Version:
1.0
Date:
01.02.12

The usart peripheral is used primarly for debugging purposes; it's initialized to work at 57600 baud that is the maximum throughput usable with the main clock at 8 MHz. An interrupt is generated at each character reception; a function for transfer data is also available.


Function Documentation

void closeUsart ( )

Close the usart peripheral and disable all interrupts.

Returns:
none
void initUsart0 ( )

Configure the usart0 registers to work at 57600 baud (8-bit data, no parity, 1 stop bit). Moreover the interrupt for reception is enabled.

Returns:
none
void initUsart1 ( )

Configure the usart1 registers to work at 57600 baud (8-bit data, no parity, 1 stop bit). Moreover the interrupt for reception is enabled.

Returns:
none

Check whether there is something to read from usart0.

Return values:
0input buffer not empty
1input buffer empty
unsigned char usart0Receive ( )

Wait until a byte has been received or the timeout is expired.

Returns:
byte received
void usart0Transmit ( unsigned char  data,
unsigned char  isBlocking 
)

Transfer one byte of data; it's blocking (wait until the buffer is empty).

Parameters:
datadata to be sent through usart0
Returns:
none
void usart1Transmit ( unsigned char  data,
unsigned char  isBlocking 
)

Transfer one byte of data; it's blocking (wait until the buffer is empty).

Parameters:
datadata to be sent through usart1
Returns:
none
 All Files Functions Variables Defines