1

Arduino pins can be used as UART using the SoftwareSerial.h library. Is there any alternative for AVR?

I need more than one serial port on a ATmega328P, but i don't use Arduino.

SoftwareSerial.h is tied to Arduino.h and Arduino pins. I do not use Arduino, i use avr-gcc with atmega328p and atmega8.

2
  • Sorry my english
    – Avelino
    May 24, 2015 at 0:23
  • Software serial should only be used as an absolute last resort. If you are having to look at using it then you aren't using the right microcontroller. Don't just use a certain microcontroller "because you always have", or "because the arduino uses it" - use the right one for that job, and if you need multiple serial connections then choose one that has multiple serial ports in it. There's plenty to choose from, even within the same family of chips, that provide more than one serial port, so would require minimal changes to your project to use them.
    – Majenko
    May 24, 2015 at 10:06

1 Answer 1

2

AVR274 describes a single-wire, half-duplex software UART.

AVR304 describes a half-duplex, interrupt-driven software UART, and AVR305 describes a polled alternative.

AVR307 describes implementing a half-duplex UART using a USI.

All code associated with each app note can be downloaded from Atmel's website.

2
  • where can I download them?
    – Avelino
    May 24, 2015 at 0:28
  • Do a search on the app note handle. May 24, 2015 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.