• C

check for stop bit on RS232

How does one check for a stop bit in .c?
i want:
on rx (check input FIFO for data)
        if in data not stop-bit
           then append to a char_array/string
        else reset timer to check again.

#1 can someone verify that a Stop-bit comes across as a NULL character?

..... actually, if that is the case i guess that makes my question NULL :)
thanks for the quick answer.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
There is not a standard software way to detect stop bit. Because stop bit is not designed originally to do what you want to do.
Any alternative is highly system dependent and extremely unportable.
Kent OlsenData Warehouse Architect / DBACommented:
Hi bythefsh,

Stop bits are really timing bits so they have no meaning in a data sense.  They are simply place holders on a serial line so that data arrives at the correct time.

Assume that you wanted to send a string of several ASCII code 0x01s (8-bit integer 1).  Conceptually, the string of bits looks like:


But the protocol may have stop bits defined.  If one stop bit is defined, then the string of bits more closely resembles


If two stop bits are define, then the string of bits resembles:


The stop bits merely align the data stream so that the start of each byte is received at the proper time.  The stop bits have no meaning as data.


Jaime OlivaresSoftware ArchitectCommented:
As an alternative, you can use a special character, to acomplish what you want to do.
Maybe some one of low ascii character codes like ASCII 22 (SYNC)
Have a look to traditional ascii code usage at: http://www.asciitable.com/
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

It's not your job to look for the stop bit, the UART does this for you.

Once it's gotten all the data bits in a byte and sees the proper stop bit, the UART raises a flag saying "The latest charafcter has all arrived".  

It's your job to keep looking for that "data ready" bit and when you see it, read the data byte.

See your UART spec sheets for more info.


There are some poverty-stricken computers that have to look for the stop bit, but they also have to look for the start bit and the data bits too.   Hope this isnt your case.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Usually Frame error flag is set if there were no stop bit in a received sequence of bits.
bythefshAuthor Commented:
thanks i get it now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.