Skip to main content

Posts

Showing posts from June, 2013

Generic Software Debug UART implementation for Microcontrollers.

         In this post I am giving code snippet of software debug uart implementation which can be used for any microcontroller. I did not implemented receive functionality as for debug uart it is rarely required. I will post it soon. Now understand the code details in short. What i did is you need to have start bit, a stop bit and data bits. Start bit is High to low transition for one bit period (1/baud rate) and stop bit is low to high transition for 1 bit period. and you need to shift data bits (LSB first) of a character byte in these two bits over a GPIO. For Tx configure port as Output. You can use almost any port pin for this.I have written and tested below code on atmega8 with maximum 9600 baud rate. You can use this uart for debugging purpose if your code is complicated and lengthy. softuart.h ------------------------------------------------------------------------------------------------------------ /*  * File :softuart.h  * Created on: 21-Jun-2013  * Author: Shrenik S. Shikh