> > 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