Quoting Martin : > Imagine that you want to measure 4 "RC" PWM signals, standard being > about 1mS to 2mS at 50 Hz (IIRC) > You want 8 bit accuracy so that leaves you with 1mS/256 = 4uS resolution. > There are a few schemes I can think of to achieve this, but I don't > think any are particularly good: > > 1. Polling - have a running timer and poll input pins. Resolution will > suffer so you will probably have to average several measurements to > (hopefully) get a good result. You won't really be able to do anything > else with your PIC. > 2. Interrupt on change - your interrupt code runs and checks the pins > when one changes. Chaos results when pins change within uS of each other > and the interrupt code is still executing. > 3. Capture - probably the correct way to do this (pin interrupt stops > timer). The problem is that I can't imagine there being a chip with 4 > such CCP inputs > > How would you do it without a lot of external logic? > > De-mux into a capture pin maybe? > I'd lose f/n resolution: 50/4 = 12.5 samples per second, maybe that's > good enough. Then I'd want to add edge triggering to ensure that I don't > capture half-pulses, meaning more external logic. > - > Martin If you don't care about power consumption, just run the processor clock really fast and use interrupts or CN. For example, a PIC24HJ12GP201. You can probably even write the code in C. Or perhaps a PIC32 polling with a 2usec periodic interrupt? ;-) But maybe the sensible thing to do is to just measure one at a time.. you get a slower update rate, but the frame rate is fairly high usually anyway. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" s...@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist