For an assignment for my embedded systems course we were required to write our own bit bang serial driver for an Arduino Uno. As the assignment progressed, more and more requirements were added. The final driver consists of:
2400 Baudrate generated by timer interrupt
1 start bit, 8 data bits, 2 stop bits, no parity
Circular buffer for data input
Circular buffer for data output
State machine to reduce CPU load
Final result. Channel 1 is used to measure CPU execution time.