Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

check for stop bit on RS232

Posted on 2004-10-28
6
Medium Priority
?
369 Views
Last Modified: 2010-04-15
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.
-thefsh
0
Comment
Question by:bythefsh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12437832
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.
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 12437941
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:

000000010000000100000001000000010000000100000001

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

00000001s00000001s00000001s00000001s00000001s00000001s

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

00000001ss00000001ss00000001ss00000001ss00000001ss00000001ss

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.


Kent

0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12437987
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/
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
grg99 earned 200 total points
ID: 12438021
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.


0
 
LVL 17

Assisted Solution

by:mokule
mokule earned 200 total points
ID: 12454245
Hi,
Usually Frame error flag is set if there were no stop bit in a received sequence of bits.
0
 

Author Comment

by:bythefsh
ID: 12458641
thanks i get it now.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

636 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