Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
/ uartSerial Public archive

Universal Serial Library for ATmel microcontroller using embedded C

Notifications You must be signed in to change notification settings

hainayanda/uartSerial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

uartSerial

UART universal library for ATmel Microcontroller

Synopsis

This is simple universal library for UART Serial communication using Atmel Microcontroller. This code is written in C and compatible with Atmel Studio 6. it using most common protocol in UART Serial, feel free to edit the code when you needed

Code Example

Using the code is very simple. Just create the struct using uartInit function and pass the address of UART register you want (UBRR, UCSR and UDR) and you are good to go.

//create default serial port with no configuration at serial port 0
SerialPort serial = uartInit(&UBRR0L, &UBRR0H, &UCSR0A, &UCSR0B, &UCSR0C, &UDR0);

//create default serial port with default config and baud rate 19200 bps at serial port 1
SerialPort serial1 = uartInit(&UBRR1L, &UBRR1H, &UCSR1A, &UCSR1B, &UCSR1C, &UDR1);
uartStandardInit(&serial1, 19200);

//send char
uartSendChar(&serial, 'a');

//send string
uartPrint(&serial, "Hello World");

//get char
char character = uartGetChar(&serial);

//get string
char[100] string;
int read = uartScan(&serial, &string, 100);

//flush UDR
uartFlush(&serial);

Motivation

This is my personal library to use serial pin for Atmel Microcontroller. I think its a good thing if I share it for someone who need it

About

Universal Serial Library for ATmel microcontroller using embedded C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages