Indeed, I generally sample the bit stream at the fastest rate I can, between 16 and 60X the clock rate, then arrange subsequent checks to be centered in the rest of the bits. I've gotten a 4MHz 12C508A to run reliably on its internal RC oscillator at 9600 bps and a Tiny12 at 1MHz at 9600 bps. The 12C508 was totally on a timed FSM, the Tiny12 had the advantage of having an IRQ that I could use on a timer. All in assembly of course, you probably couldn't get a receiver to work well using a high level language. fun stuff, DLC Don Kinzer wrote: > --- In AVR-Chat@yahoogroups.com, James Washer <washer@t...> wrote: > >>Is this correct? > > > Yes. > > As you may know, the trick to bit banging a serial input is to arrange > to sample the input line consistently somewhere near the middle of the > bit window. Generally, this means that you need to sample the input > line at some multiple of the bit frequency (probably 4x is the lowest > practical multiple, 8x or higher is even better if you can afford the > overhead) and then arrange to sample the input line at multiples of > the bit time after a start bit has been detected. This process is > complicated by the fact that the transmitter's clock can have > virtually any phase relationship to the receiver's clock so you have > to design your software to accommodate the worst-case clock skew. > Moreover, the transmitter's clock and the receiver's clock can vary > from the ideal frequency in opposite directions and the resultant > error is cumulative over the 9 to 11 bits of the character being > received. > > Compared to reception, bit bang transmission is a cinch. > > I implemented a 4-channel bit bang full duplex UART in assembly > language for the ZX microcontrollers; they are based on a mega32 > running at 14.7456MHz. > > Don > ZBasic Microcontrollers > http://www.zbasic.net > > > > > > > > > Yahoo! Groups Links > > > > > > -- ------------------------------------------------- Dennis Clark TTT Enterprises www.techtoystoday.com -------------------------------------------------
Message
Re: [AVR-Chat] Re: question about serial port bit banging
2005-12-28 by dlc
Attachments
- No local attachments were found for this message.