Jan-Erik Soderholm wrote: > > > Nick_F wrote: >> As far as I know, a 20MHz PIC16F628A can have a resolution of 200nS, > > Exactly what do you meen with "resolution" ? > 200 ns is the fastest instruction time, but that doesn't > give you any practical "resolution" in most applications. > > Yes, sorry. I was thinking about the duration of a one cycle instruction. The shortest pulse I can generate with a 20MHz clock has 200ns and by using the following code, the period of a complete cycle has 800ns. Loop bsf LEDPORT, LED ;turn on led for 200ns (1 cycle) bcf LEDPORT, LED ;turn off led for a total of 600ns (3 cycles with goto) goto Loop ;go back and do it again If I want a 50% duty cycle, I can generate a 1.2us pulse using this method (add two nop after bsf). I know it is very crude, I try to improve the code. Regards, Nick -- View this message in context: http://www.nabble.com/Project-with-LCD%2C-keys-and-delays-on-PIC16F628A-tp23309866p23315118.html Sent from the PIC - [PIC] mailing list archive at Nabble.com. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist