Redwood Shores, 16 januari 2008. Dear Martin, Sounds like a servo application. You list some good alternatives. At 20 MHz you should be able to use the polling option, with some time to spare. If, as you say, the length is at least 1 ms, you know that you don't have to poll that particular signal during that time, and can do additional processing. Also, at 50 Hz, there should be times that you don't need processing either. I myself would probably employ a few tiny PIC, assign one of the signals to each one of these, and have them forward the result to a big PIC. At 8 MHz for each of these you should be able to get it to work. Another option I might consider is having the signal charge a capacitor, and use an A/D converter to retrieve the result. This is only feasible in a single project, as you would need to calibrate each of the capacitors every time you create a new one. I'm looking forward to hearing more solutions from other people :) Greetings, Maarten Hofman. 2008/1/16, 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 > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist