Archive

Archive for the ‘The Usart Bla bla bla’ Category

A tiny printf for embedded systems

January 17th, 2011 3 comments

 


Often embedded systems have small amount of RAM and flash, so you could have the need of specifically written standard functions.

The Usart Bla bla bla: Using the Standard IO facilities #16

May 28th, 2010 No comments

 

Using the Standard IO facilities of the avr-libc 

The avr-libc gives some facilities of the standard I/O. Only a limited subset of the standard IO is implemented (refer to the <stdio.h>: Standard IO facilities section of the avr-libc manual.). The uart.c source code could be used to interface the uart device with the Standard IO. The following example from the stdio man page of avr-libc illustrates the usage of the uart library.

The Usart Bla bla bla: The command line arguments #15

May 18th, 2010 No comments

The getopt function
int getopt(int argc, char * const argv[], const char *optstring);
extern char *optarg;
extern int optind, opterr, optopt;
The getopt function is used to parse command option. The parameters argc and argv are the argument count and argument array as passed to the “command”. The argument optstring is a string of recognized option characters; if a character is followed by a colon, the option takes an argument.

The Usart Bla bla bla: The shell functions #14

May 11th, 2010 No comments

The Shell functions
The shell contains the following functions:

  • vConsoleLoop
  • vEchoff
  • vEchon
  • iGetChar
  • iPutChar
  • cGetLine

The Usart Bla bla bla: functions #13

April 27th, 2010 No comments

The Uart bla bla bla functions


NAME

uart_init  — Init the UART port.

 

SYNTAX

#include “uart.h”

 

char uart_init (unsigned long ulBaudRate,

unsigned char ucParity,

unsigned char ucDataBit,

unsigned char ucStopBit

)

The Usart Bla bla bla: My USART implementation #12

April 20th, 2010 No comments

 

My U[S]ART implementation

My USART software is based on the ATMEL application note AVR306 : Using the AVR® UART in C.

The original source code of the application note was changed to support receiver error and to support  some of the capabilities of the avr UART interface databit (5..8 ), stop bit (1-2) and parity check (none, odd and even).

The Usart Bla bla bla: Interrupt 3 #11

April 13th, 2010 No comments

UART  Data Register Empty Interrupt

As described the USART can generate interrupt if the data register is empty. The interrupt could be enabled setting the Data Register Empty Interrupt Enable(UDRIE0) . 

The USART Data Register Empty ISR will be executed until the UDRE0 is set (if the global interrupts are enabled).

The Usart Bla bla bla: Interrupt 2 #10

April 6th, 2010 No comments

Interrupt from the USART

Before to speak about the interrupts implementation of the USART, I want to say a little bit regarding the “Interrupts” and then it will follow by a description of the usage of the USART interrupts if one of the following conditions happen:

The Usart Bla bla bla: Interrupt 1 #9

March 30th, 2010 No comments

 

Frame format

The frame formats supported by the Atmega is the standard UART frame format, specifically it accepts all 30 combinations of the following as valid frame formats:

 1 start bit

 5, 6, 7, 8, or 9 data bits

 no, even or odd parity bit

The Usart Bla bla bla: Errors #8

March 23rd, 2010 No comments

Receiver’s Errors 

The USART Receiver has three Error Flags: Frame Error (FE0), Data OverRun (DOR0) and Parity Error (UPE0). All can be accessed by reading UCSR0A

Statistical data collected by Statpress SEOlution (blogcraft).