[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

building a software UART

Posted on 2004-11-12
3
Medium Priority
?
194 Views
Last Modified: 2013-12-09
ok brainy low level c guys.
     how difficult is it to write a software uart, as opposed to adding an actual Hardware UART to my board? and what are the typical first timer mistakes i need to look out for?
0
Comment
Question by:bythefsh
3 Comments
 
LVL 11

Accepted Solution

by:
griessh earned 75 total points
ID: 12570184
Hi bythefsh,

A UART is the chip that actually converts a serial bit stream into a byte values. It will scan input ports according to a defined baud rate, check for framing information and may have to deal with handshake lines. This is done for incoming and outgoing information.

Now I am not sure what hardware you are on, but dealing with serial I/O on that level might take up quite some resources fro your CPU.


======
Werner
0
 
LVL 22

Assisted Solution

by:grg99
grg99 earned 75 total points
ID: 12571452
I wouldnt recommend a software UART, especially if the CPU has any other real-time things to respond to.

If you must, the most efficient way is to set up a timer interrupt at 16x the baud rate, then on each interrupt you can check to see if the start bit has begun.  Then skip 8 counts and sample again, you shoul dnow be in the middle of the start bit.  Then skip 16 counts and sample the 8 bits every 16 counts.  then check for the stop bit.  Not too hard if you're used to interrupt routines.

That's for receiving, for sending you just do the opposite, send one bit at each timer interrupt.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12575350
Feasibility will depend on Platform & Operating System.
If you are working with a Windows/Intel OS/Platform, then will be a little hard to ensure proper timing because windows does some task simultaneously that can consume system resources avoiding you to transmit in proper time.
If you are working with a non-multitasking operating system like DOS, this could be done succefully using many techniques, polled or interrupted, as proposed by grg99.
If you are working with a microcontroller, it could be done also without problems, there are many ways to do it and is very popular in PicMicro microcontrollers, because most of them didn't use to have a real UART.
But notice that, depending on technique choosen you will be able or not to do full-duplex communication.

Please specify Platform and OS.

Good luck,
Jaime.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Memory (not to be confused with Hard Drive Space) can greatly increase the performance of a computer. Each version of Window has greater demands on memory. My personal recommendation to get decent performance out of a machine is as follows: Windows…
A little history Back in 1997 when I built my first custom computer using the revolutionary Gateway website I didn’t have much to choose from except for the CPU. The race between computer manufacturers was held back by processor manufacturers. They…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question