Giter Club home page Giter Club logo

usart0-m328p's Introduction

-ATmega328p USART0 8-bit Asynchronous, TX RX library

#WARNING:

  • If you make optimization (OPTIMIZE == 1) of this code, it will uses ~500bytes, but you will not be able to write baud rate(9600, 115200, ETC) value in 'usart_init();' because in this case baud rate to UBRRn converter is disabled, so you would write directly UBRRn(103, 8, ETC) value(check in ATmega328p datasheet).

Baud rate -> UBRRn (UX2n == 0): 9600 -> 103 38400 -> 25 115200 -> 8

  • Of this library target is small memory usage and fast execution.

  • In code are preprocesors where user is able active or deactive some modes:

  1. Active or deactive ISR by change value of ISR_EN (Default value is 1 as activated);

  2. user can change memory usage by changeing value of OPTIMIZE (Default value is 0 as disabled);

#Functions:

  • void usart_init(uint32_t baud, uint8_t speed);
  • void usart_sendChar(char acter);
  • void usart_sendStr(char *str);
  • char usart_getChar(void);
  • uint8_t usart_getStr(void);
  • void usart_clear(void);

#libraries

  • #include <avr/io.h>
  • #include <avr/interrupt.h>

#variables

  • volatile static char RECEIVED_CHAR = '\0';
  • volatile static char RECEIVED_BUFFER[_BUFFER_SIZE] = {0};
  • volatile static uint16_t RX_COUNT0 = 0;
  • volatile static uint8_t TX_READY = 1;

#ISR

  • USART_RX_vect
  • USART_TX_vect

#Configurations

  • #define OPTIMIZE 0

  • #define ISR_EN 1

#Hardware requirements

  • ATmega328p

#Software requirements

  • AVR-GCC
  • AVR-OBJCOPY
  • AVRDUDE
  • AVR-SIZE
  • MAKE

=========================================

#About developer

usart0-m328p's People

Contributors

developer328 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.