At 12:46 24/05/98 EDT, you wrote: >Hi everyone > >I hace a project where a stamp BS2 and a Pic16F84 are talking back and forth >on the same board (about an inch apart). The code utilizes 9600 baud. I have a >couple of questions. > >1) For 9600 baud and bit timing should be 104us. The best I have been able to >do in my 16F84 program is 116us between bits, due to the way I have >implemented the code. This is consistent for both the serout and serin >routines. Can I communicate effectively with the BS2 with the slight offset in >timing? The BS2 will utilize its standard serin/out commands. > >2) What kind of limitations do I have for baud rate in this application? Can I >run at 19,200 or even higher? I just replied to your later message. If you're doing this in software (or hardware for that matter) I always aim for an error of less than 1%, and I try to get the best I possibly can especially when using equipment with different UARTs or unknown UARTs. For a software implementation, check for the start bit periodically (or have it interrupt driven) then start a (software or hardware) timer for half the bit time. Resample the start bit if valid, start a counter for one bit time (then you'll be in the middle of bit 0 (lsb comes first of course), repeat 5/6/7/8 times (or 1 more than each of these if you have a parity bit). As a "slight cheat" I sample about 1/4 after the bit transition time since I am using a software implementation with various polling delays within the start bite period time. Regards Adrian WWW WWW Adrian Gothard WWW WW WWW White Horse Design WWWWWWWWWW +44-385-970009 (Mobile/SMS), +44-118-962-8913/4 (voice/fax) WWWW WWWW whd@zetnet.co.uk, http://www.users.zetnet.co.uk/whd --- Developers of GPS satellite-based tracking systems