?
Solved

Serial communications

Posted on 2004-04-20
19
Medium Priority
?
2,014 Views
Last Modified: 2008-02-01
From device communication protocol:
The controller UART is configured to use the standard 4800 bps communication speed using 1 startbit, 8 databits, 1 even parity bit and 1 stopbit (lsbit first).

I am trying to talk with this device using COM terminal program (for now, unsuccessful). All COM terminals contain standard COM port parameters like speed, databits, patity, stopbit. But I don't understand two parameters from this protocol: "1 startbit" and "lsbit first". What does this mean?
0
Comment
Question by:AlexFM
[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
  • 8
  • 3
  • 2
  • +4
19 Comments
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10869335
lsbit first means least significatnt bit first.
0
 
LVL 46

Assisted Solution

by:Kent Olsen
Kent Olsen earned 400 total points
ID: 10869341
Hi Alex,

start/stop bits are really just "timing" bits that occur in the bitstream.

SSSDDDDDDDDPsssss


In the imaginary sequence above, SSS indicates that there are three start bits, and sssss indicates that there are 5 stop bits.  (Just an example -- you wouldn't do this in real life.)  Identifying the number of start/stop bits tells the UART where in the bitstream the data lies.

lsbit is short for Least Significant Bit.


Kent
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10869351
the data field is flanked on either side by startbit and stopbit.

1 startbit means 1 bit will be used to demarcate the start of the frame.
0
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.

 
LVL 2

Assisted Solution

by:anupvijay
anupvijay earned 200 total points
ID: 10869452
Hi AlexFM,

1 start bit means that the start of transmission is indicated by a bit '0' and similarly stop bit would be '1' which indicates stop
of data transmission.

lsbit first means that the LSB bit is transmitted first. This is similar to the little endian system I guess.
Does it make sense ? Other experts please correct me if I am wrong. If I am correct then does this point towards any
thing that tells you why your communication is not working ?
All the best.

Cheers.
0
 
LVL 48

Author Comment

by:AlexFM
ID: 10869458
What is interesting for me now - I am trying to talk with this device, and all terminal programs I try don't have such settings. I don't know whether I am OK or not, this may be also hardware problem which should be solved by HW engineers. For example, I run Windows Hyperterminal, and see speed, databits, patity and stopbit options. But I don't see "1 startbit" and "lsbit first" options. Can I be sure that I am OK? Are these parameters supposed to have such values in any standard COM terminal?
0
 
LVL 2

Expert Comment

by:anupvijay
ID: 10869464
Before submitting there were no other comments.....sorry if my answer is a repetition.....
The net age :-)
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 10869526
Hi Alex,

The UART should "hide" most of the data formatting issues from your application.  By telling the UART the number of start/stop bits, parity, etc you're pushing all of the I/O and timing related issues to the hardware, microcode, BIOs, etc levels.

I'm not familiar with a UART differentiates between LSB and MSB.  (They may well exists -- I just don't know about them.)  As long as both devices are using LSB or MSB it shouldn't matter.


As an aside, I once dealt with a device that used 1.5 stop bits.  I didn't know this when I first started coding for it and blame it for much of my hair loss.  :)


Kent
0
 
LVL 9

Assisted Solution

by:ankuratvb
ankuratvb earned 400 total points
ID: 10869606
Hi Alex,

I dont know how much of this would be useful for you but

http://www.beyondlogic.org/serial/serial.htm

has an excellent description of serial communicationa and its nuances.

0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10869620
Hey Kent,

I just noticed that in hyperterminal settings as well.
Indeed surprising.
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10869663
I actually can understand the logic of allowing to set the length of the stop bit and not allowing to change the length of the start bit. As is the case with Hyperterminal

Either you allow both or you dont allow both.

0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10869682
>I actually can

I actually can't.


0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10869786
Hi Alex,
Please have a look to this nice tool
http://www.experts-exchange.com/Q_20957961.html
0
 
LVL 11

Assisted Solution

by:griessh
griessh earned 400 total points
ID: 10869860
Alex

some more info:

RS232 serial communication is an asyncronous communication, that means the receiver does not know about the number of data bits sent. But both transmitter and receiver know (through the setup) about some frame information.
- There is 1 start bit which is always 0
- There is a defined number of stop bits (1, 1 1/2, 2)
- There is a (possible) parity bit
- The LSB (least signifiacnt bit) is send first
When the receiver 'sees' a start bit it knows that a new 'word' is to be transmitted. With the baud rate the time of 1 bit is specified. Once the line is in a 'mark' state created by the stop bit the receiver can wait for a new star-bit. The time between 'words' is not defined.
That should answer your question about start bit and LSB first.

======
Werner
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10870342
>There is 1 start bit which is always 0

If that is the case,why is it that we can change the start bit's length using code(for some device) but not using hyperterminal.

0
 
LVL 11

Expert Comment

by:griessh
ID: 10870747
A UART is hardware and can be configured to all kinds of settings (for example: nobody forces a UART to only support the standard transmission speeds) and has a superset of functions of what is needed for 'standard' serial communication.
RS232 communication is a defined way to communicate and specifies 1 start bit.

Check the datasheet of any 16550 derivate and you will be able to learn more about UARTS. I have no idea what UART Alex is using, but none of the 'standard' UARTS offer that startbit option.

=====
Werner
0
 
LVL 48

Author Comment

by:AlexFM
ID: 10871365
Thanks for the answers. Can I make conclusion from this that setting of speed, databits, patity, stopbit is enough, I don't need to care about startbit and lsbit settings, because they are always default, and if device doesn't answer, this is probably hardware program?
0
 
LVL 22

Accepted Solution

by:
grg99 earned 600 total points
ID: 10871416
I've never heard of having more than one start bit, one and only one is the standard way to go.

The old 1940's teletypes needed 1.5 stop bits, as they were purely mechanical devices, with the receiving end perhaps running a few percent slower than the sending end.  The extra .5 stop bit would allow the receiver some breathing room to catch up.

When computers got into the act, the early UARTS couldnt do 1.5 stop bits, so 2 stop bits was a common option.

But I've never seen any choices in start bits!      It *may* be part of some of those new serial protocols used between chips.   See i2C and other two-wire and one-wire serial protocols.

If you're getting absolutely NOTHING, not even garbage, you probably need to do one or more of the below:

(1)  Strap the handshaking lines to their opposite friends.

(2)  Strap some lines HIGH.

(3)  Swap send and receive lines (2 and 3).

Many an afternoon I've wasted doing just the above.

Nowadays you can buy a $9.95 RS-232 "breakout box", which has nice wires and pins and LED's to indicate what's going on.
You'll probably need one of these if you're not quickly lucky just swapping 2 and 3.




0
 
LVL 11

Expert Comment

by:griessh
ID: 10873064
Alex

The breakout box grg99 is  alife saver if you do that kind of work more often.

What type of handshake are you using? software ? hardware? none?
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10874860
Thanx griessh for that information.

I just checked that out on beyondlogic's site:

http://www.beyondlogic.org/serial/serial1.htm#40

This is what they say:

The RS-232 line, when idle is in the Mark State (Logic 1). A transmission starts with a start bit which is (Logic 0). Then each bit is sent down the line, one at a time. The LSB (Least Significant Bit) is sent first.

0

Featured Post

Independent Software Vendors: 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!

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
Suggested Courses

650 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