On Feb 6, 2006, at 3:11 PM, Tomas Larsson wrote: > You need precise timing (at least sort of) if you are supposed > to program a PIC. It's important to remember that "sort of" part. >> Real-time control involving the host CPU, involves to flush all cash >> memory both data and instruction, and since today's cpus are heavily >> pipelined it takes quit long time to do this, even on a 3000+ cpu. IO instructions to control external bits are quite slow. The pipeline gets stalled, all the out-of-order execution stuff has to come to a halt, and other stuff slows. I don't THINK that caches are flushed; cache coherency is handled separately and the IO space and memory space are separate. But an IO instruction to set a UART register takes literally hundreds to thousands of cycles on a machine that normally executes somewhat more than one instruction in each cycle, so it's incredibly inefficient. However, that's still ~1000 cycles at 3GHz, which is still significantly less than a microsecond, which is plenty small a time interval for programming PICs. (But you'll not that it's not much faster than a PIC can twiddle pins... :-) And no one really cares how inefficient a computer is these days, as longs as it's fast... Of more serious concern is that sometime during that 50uS pulse you wanted, something like a legacy USB bios or power management interrupt will come along and do something (or nothing) for 30uS or so and screw up everything... BillW -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist