That's a good example of using the CCP module. Once you have a good understanding of what you want to measure and what the CCP module can do it works out not very hard. If the CCP module had the feature we were talking about though it would mean you could measure even faster pulses, getting just a single interrupt when the pulse has been measured. Perhaps another flag could be used to set single shot/repetitive - just like a digital scope trigger. On 4 Nov 2002 at 10:52, Claudio Tagliola wrote: > I have a piece of interrupt driven code which measures pulse width on > both ports (two channel ADXL202 digital pwm output). CCP1 is first set > to rising edge, inside of the hit interrupt, it is switched to falling > edge, next interrupt CCP2 is selected on rising and last one on CCP2 > falling edge. The pulses aren't that fast, but luckily I could > regulate the average and maximum pulse width so it's all covered > withing one overflow of timer1 so I don't have to do any fancy > checking. Wasn't even that hard to set up. > > Claudio > > -----Oorspronkelijk bericht----- > > Example: > > > > After enable, > > 1st trigger edge: reset TMR1 > > 2nd trigger edge: capture, flag and disable. > > > > Surely this would make it much more usable. > > Hey yeah - plus if the trigger edges were selectable it would be > great for measuring pulse widths. eg: > > After enable, > 1st trigger (+ve edge): reset TMR1 > 2nd trigger (-ve edge): capture, flag and disable. -- Brent Brown, Electronic Design Solutions 16 English Street, Hamilton, New Zealand Ph/fax: +64 7 849 0069 Mobile/txt: 025 334 069 eMail: brent.brown@clear.net.nz -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics