[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

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.
-thefsh
0
bythefsh
Asked:
bythefsh
2 Solutions
 
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.
0
 
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:

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
 
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/
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
grg99Commented:
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
 
mokuleCommented:
Hi,
Usually Frame error flag is set if there were no stop bit in a received sequence of bits.
0
 
bythefshAuthor Commented:
thanks i get it now.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now