On Thu, 11 Jan 2001 07:55:19 +0100, you wrote: >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: > >> 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. 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.=20 >> 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.=20 >> >> >> >> =3D=3D=3D=3D=3D >> >> >> __________________________________________________ >> 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 listserv@mitvma.mit.edu with SET PICList DIGEST in the body >> >> >> >> -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu