I am designing an interface board based on a single UART 8051 family microcontroller.The interface needs two serial port;one for system serial bus and another for networking through a serial-ethernet converter.Is it possible to implement a software UART using two normal pin of micro?Is there any way to share the single UART of the micro for the two puposes? Any solution will be appreciated.
Even if that's possible, it's likely a waste of effort. Why not simply choose a different 8051 variant that has 2 serial ports? Much less hassle, and considerably higher efficiency.
Dear Rahim, Regards, You answer is "Yes" I have seen this technique in some industrial boards . You must simulate pulse width on the port bit that you want to use serial exactly. Your pulse width is based on your desired baud rate and start bit and stop bit must be applied . You must use Interrupt and Timers for this reason .
Please write Mr. Broeker's answer on the blackboard 1000 times or until you have successfully implemented the "software uart". Engineering experience and common sense dictate that if your system requires two uarts then use two hardware uarts, don't try to hammer a square peg into a round hole.
dear Mr. Broeker, Many thanks for your description; i am consulting for choosing the best solution.Till now,i found two good fit: 1) the network microcontroller of DS80C400(3 UART+TCP/IP stack) from Dalas/Maxim 2) the network microcontroller of uPSD3254(2 UART+Dual flash bank:32KB,256KB+32KB of RAM) from ST. I will use the first solution because of the networking advantage. Any further recommendation will be appreciated. Best regards, R. Soleimani
I will use the first solution because of the networking advantage. Go ahead and use a soft UART and see the whole kit and kaboodle blow up in your face. A soft UART basically takes ALL resources and how your networking is going to behave under such circumstances is: NOT. E.g. Philips has some wonderful UARTs with FIFOs that you can use. Another possibility is to use a "throwaway chip" such as a Philips LPC and connect to the main via hardware IIC or SPI. Erik
Erik, I think when he said "the first solution," he was referring to the first of the two dual-UART chips he had listed. He's taking everyone's advice and not disregarding it. By "networking advantage" he just means that the first chip he listed comes with a TCP/IP stack.
A software implementation of a UART on GPIO pins is fairly common. One set of example code can be found at: http://www.programmersheaven.com/zone5/cat27/2369.htm (The number two link on google was http://www.embeddedlogic.com/embarchives/805X/ which error leads to trying http://www.embeddedlogic.com/ Perhaps this is a warning of the fate of anyone that dares to attempt a product without hardware support for all the UARTs?)