It depends on your needs but generally speaking you need to use a timer module that tells you the exact timing you need. In other words you should not depend on the instruction cycles, and all you need is to make sure you can done the bit banging before the next tick comes... You can do this by interrupts or by polling the timer register, depending again what are the specifications and if the service routing can handle the demand (ISR could have a bigger overhead with all the context savings and such stuff than a polling...). Tamas On Sun, Sep 12, 2010 at 4:18 PM, PICdude wrote: > I'm finally going to start really using a higher (than 8-bit) PIC and > also looking into Atmels and C instead of assembly (for the PIC too). > Since there will be optimizations, how would timing-specific code > (such as bit-banging) be done? Are these pieces put into inline > assembly, or is there a way to use C code with known timing? > > Cheers, > -Neil. > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .