Searching \ for ' Bit banging Asynchronous Serial Communic' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/serials.htm?key=serial
Search entire site for: 'Bit banging Asynchronous Serial Communic'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] Bit banging Asynchronous Serial Communic'
2001\01\10@174405 by Freddie Leaf

picon face
I'm interested in bit banging Asynchronous Rx and Tx serial communications
on a PIC16F84.  I understand the serial protocol, but need some advise on
the Rx implementation algorithm.  Here are a few questions..  If anyone
has done this and would share their code I sure would appreciate it.

1)For the Rx algorithm, what is the best was to watch for the Start Byte?
Is it best to use an interrupt or to keep polling the line for a
transition.
2) Once you think the start byte is coming, what is the best way to be
sure.  ie, do you look for a pulse that is equal to 1/baud rate? or do you
assume that any transition is the beginning of the Start Byte?



=====


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\01\10@181045 by David Huisman

flavicon
face
Freddie,

Use Interrupt to detect low going START BIT.

Wait 1/2 Bit period

If BIT still low then start BIT is valid

If valid, wait 1 BIT period and read data BIT (x 8)

wait 1 final BIT period and read BIT. If high then STOP BIT is valid - Word
is OK

To improve reliability, you can sample quickly multiple times at sample
points. ie. say sample 3 times at 8 times BIT rate and 2 out of the 3
samples indicate valid state.

Regards

David Huisman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\01\10@181348 by Stephen B Webb

flavicon
face
> 1)For the Rx algorithm, what is the best was to watch for the Start Byte?
> Is it best to use an interrupt or to keep polling the line for a
> transition.

If you can do it, I would let the interrupt on RB0 do the hard part for
you.  Polling would work, but seems less flexible.

> 2) Once you think the start byte is coming, what is the best way to be
> sure.  ie, do you look for a pulse that is equal to 1/baud rate? or do you
> assume that any transition is the beginning of the Start Byte?


Wait for 1/2 bit period, and sample a few times, if the line is still low,
then it's a start bit...


Advice:  Buy the Serial Pic'n book.

-Steve

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\01\10@182800 by Bob Ammerman

picon face
I have had excellent results polling the serial line in a timer interrupt
routine at a multiple of the bit rate.

You need to sample at at least 3x the bit rate, and more is better.

3x works very well with a directly connected async, or when talking to
modern smart modems.

Old 303, 202 or 212 modems often do not accurately recover the timing of the
input signal so I'd want more samples per bit time to help me catch the
'middle' of the bits in this case.

This would also apply in any environment where the bits can be delayed,
especially if rise and fall time are not equal (eg: an 'open-collector' bus
system).

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\01\11@015703 by dr. Imre Bartfai

flavicon
face
Hi,

beware! There is normally no such thing as "Start Byte" on the ISO Layer
2. I guess you meant start bit. It is, of course, better to use an ISR to
receive a complete byte if you have time enough to spend for the
ISR. However, you should implement either some hand shaking mechanism or a
ring buffer, if there are more bytes to come. Polling is simpler, but a
pain in ass if there is a probability to break the line.

Regards,
Imre


On Wed, 10 Jan 2001, Freddie Leaf wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu


2001\01\11@142547 by mike

flavicon
face
On Thu, 11 Jan 2001 07:55:19 +0100, you wrote:

{Quote hidden}

Either will work. Edge-detection will be more susceptible to noise,
but this won't be a problem for most apps. Edge detect is also the
only option for very high baudrates, where you can't get a
sufficiently high sample rate for polling. Edge-det also uses no CPU
time until data comes along.
Polling has the advantage of only needing one interrupt source, which
can be shared with other timer int functions.
As with most of these things, there is no 'best' way - it depends on
your application.
>> 2) Once you think the start byte is coming, what is the best way to be
>> sure.  ie, do you look for a pulse that is equal to 1/baud rate? or do you
>> assume that any transition is the beginning of the Start Byte?
Depends on how much noise you expect. You should allow margins for
baud errors, so if you do check the length, check for at least, say,
0.5 or 0.75/baudrate. An easy way is to have a timer int at
baudrate*2, and check for startbit on 2 successive ints.
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...