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

Truncated match.
PICList Thread
'Serial Comms Question'
1997\03\07@001629 by James and Iliana Holbrook

flavicon
face
Hola,
       I'm trying to understand serial communication at the TTL level. My
understanding is that at a baud rate of say... 4800 bps you have a period
of 208 microseconds . Correct ?? If I'm correct then a PIC running at 4mhz
will have executed 208 instructions during the high/low period of the
signal. Instead of just setting there waiting for the signal to change
states could you not be doing some other work ?? Is this Ok ?
       What is the standard for receiving serial data ? Do you get some data th
en
return to the main loop ?? Or couldn't it be made to check pin state..do
other work..check pin state...write data to register after period..do other
work.
       I'm thinking to use an '84 as a servo controller.
       Any help or ideas is appreciated.
       Thanks !!!

James and Iliana Holbrook
Austin Texas

1997\03\07@081019 by tjaart

flavicon
face
James and Iliana Holbrook wrote:
>
> Hola,
>         I'm trying to understand serial communication at the TTL level. My
> understanding is that at a baud rate of say... 4800 bps you have a period
> of 208 microseconds . Correct ?? If I'm correct then a PIC running at 4mhz
> will have executed 208 instructions during the high/low period of the
> signal. Instead of just setting there waiting for the signal to change
> states could you not be doing some other work ?? Is this Ok ?
>         What is the standard for receiving serial data ? Do you get some data
then
> return to the main loop ?? Or couldn't it be made to check pin state..do
> other work..check pin state...write data to register after period..do other
> work.

Exactly! Use a timer interrupt (TMR0) to jump to your comms routine.

--
Friendly Regards

Tjaart van der Walt
spam_OUTtjaartTakeThisOuTspamwasp.co.za
_____________________________________________________________
| Another sun-deprived R&D Engineer slaving away in a dungeon |
|             WASP International  http://wasp.co.za           |
|             GSM and GPS value-added applications            |
|  Voice : +27-(0)11-622-8686   |   Fax : +27-(0)11-622-8686  |
|_____________________________________________________________|

1997\03\07@081940 by Byron A Jeff

face picon face
>
> Hola,

Hello to you too.

>         I'm trying to understand serial communication at the TTL level. My
> understanding is that at a baud rate of say... 4800 bps you have a period
> of 208 microseconds . Correct ??

And change. Yes.

> If I'm correct then a PIC running at 4mhz
> will have executed 208 instructions during the high/low period of the
> signal. Instead of just setting there waiting for the signal to change
> states could you not be doing some other work ?? Is this Ok ?

Yes. And since most every serial receiver samples in the center of the cell
you can usually have jitter around the edges without too many problems as
long as you keep the overall time constant. Presume that each cell is 7
digits wide in the following example:

test 1: 000000011111110000000111111100000001111110000000111111100000001111111
test 2: 0000001111110000000000111111100000111111000000000111110000000111111111
          X   Y  X  Y   X  Y   X  Y   X  Y   X  Y  X  Y   X  Y   X  Y   X

Even though test2 has jitter (early and late) at the edges (the points labeled
Y) it would still receive correctly because the signal is correct at the
sample point (the points labeled X)


>         What is the standard for receiving serial data ? Do you get some data
then
> return to the main loop ?? Or couldn't it be made to check pin state..do
> other work..check pin state...write data to register after period..do other
> work.
>         I'm thinking to use an '84 as a servo controller.
>         Any help or ideas is appreciated.
>         Thanks !!!

Well it depends on what you need to do while receiving serial data. All of the
projects I've done so far it has been simple enough to just receive and buffer
the data (commands from a PC) then execute the command. I usually put both
acknowledgements (Y for Yes, N for No) and timeouts so that the PC can know
if everything is alright. If the controller is too busy, it can just ignore
the incoming packet, or send a negative ack. The PC can then wait for later.

Another possibility is to just run the PIC faster. At 20 Mhz you can get 5
times more work done while waiting to the serial data.

Lastly it's simple enough to write an interrupt version that interrupts on
the dropping of the start bit, then uses the timer to cause an interrupt in
time to sample the middle of each cell. A one variable state machine can
assist the interrupt routine in where it is in the receiving process.
I haven't done this yet because I've always been willing to sacrifice the
serial for other stuff. But conceptually it isn't hard to do.

How you implement depends on the relationship of the serial to the other
stuff.

BAJ

1997\03\07@222949 by PC - JMC CASA

flavicon
face
part 0 286 bytes
>        What is the standard for receiving serial data ? Do you get some >data then return to the main loop ?? Or couldn't it be made to check >pin state..do other work..check pin state...write data to register after
>period..do other work.
you can choose...

Regards,
JC

1997\03\08@024553 by Mike

flavicon
face
>>        What is the standard for receiving serial data ? Do you get some
>data then return to the main loop ?? Or couldn't it be made to check >pin
state..do other work..check pin state...write data to register after
>>period..do other work.
>you can choose...
>
>Regards,
>JC
>Attachment Converted: D:\WAN\MAIL\INCOMING\ReSerial


Why do you keep sending unreadable attachments ?

Rgds

Mike

Some say there is no magic but, all things begin with thought then it becomes
academic, then some poor slob works out a practical way to implement all that
theory, this is called Engineering - for most people another form of magic.
                                                                      Massen

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