9 bit data, mark space parity

The Atmega supports 9 bit data, but the Arduino library doesn’t. Your only option using it (at least currently) is odd or even parity for the 9th data bit, there is no mark of space parity made available in via the library. This is a problem when communicating on say RS485 busses where mark and […]

Read More

UART RX

Clearing the incoming Serial buffer The flush() method only clears the transmit buffer, it has no effect on the rx buffer. This code will clear the receive buffer:

Read More

UART TX

Waiting for TX to complete – Flush When you issue a Serial.print() or Serial.write() , the function returns almost immediately. Instead of waiting until the string or data has been transmitted, it sets up a buffer for the data which is then transmitted via interrupts one byte at a time. I.e., your program to keep […]

Read More

BAUD Rate

Atmega BAUD Rates The baud rate on the Atmega is generated by dividing the system clock. This table from the datasheet shows the register values and error percentages for a 16 MHz clock (e.g. for Arduino Uno):

Read More

SoftwareSerial Library

Allows normal IO pins to be used as bit bashed UART pins Resources https://www.arduino.cc/en/Reference/SoftwareSerial http://arduiniana.org/libraries/newsoftserial/ Example Usage Receiving Data Note you can define unlimited software serial ports, but only 1 can be set to receive at a time. Using only 1 pin Using for RX only Defining both pins as PA5 on an ATtiny841 and using to […]

Read More

Serial Port (UART)

Arduino Serial Ports UART0 is the default serial port which is used for serial programming. Some arduino’s have more than one serial port and these are called Serial1, Serial2, etc Setup Serial Port Sending ASCII Text Sending Variables As ASCII Others see here. Write Binary Data Receive Binary Data

Read More