Robert Ammerman wrote: > Here is a scheme similar to what I use (**warning: untested code**). It is a > very clean way of doing it. > This version requires no restrictions on the length or location of the > buffer. > > You must be sure that the IRP bit is set properly in chips that have one! [snip] Makes sense, it's about the same thing that I do except that you just check for len==0 using BSTART==BEND (that should work for mine too), that you use absolute addresses (I use relative to BUFFER), and you use some XOR trickery. Will keep for future projects. My powers of two limitation was because, well, it's much easier to deal with in PICs. On the other hand, although my program *should* never overflow the buffer (pulling bytes out of it should be almost 2x as fast as they come in), I don't want to trust the sending device too much. So I just light up an LED on SOS and if the whole thing screws up I just hit reset. SOS is also called when I get a receive error (i.e. screwed up start or stop bit, because I can't really check anything else too much), which happens very often apparently due to EMI (about every time I switch an inductive load on the mains it pops on...). -- Hector Martin (hector@marcansoft.com) Public Key: http://www.marcansoft.com/hector.asc -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist