>> The way to do it without having the CCP is to use the INTR input to start >> the timer on the rising edge of the waveform, change the edge >> sensitivity to >> falling edge, on the next interrupt save the timer count and set the edge >> sensitivity back to rising edge. Initialise the timer ready to start >> counting again on the next interrupt. The value you have saved is >> the pulse >> width. > This is quite a good idea, and is slightly different from the approach I >was planning to take (I was going to use the change on RB interrupt since I >wasn't aware you could change the edge sensitivity on the INT pin). Thanks, >TTYL It would be possible to do the same thing using the RB interrupt, but then you are potentially tying up the whole RB port to have an interrupt on one pin (check the archive for interrupt on RB change problems if you are not already aware of them), and also you have no control over which edge of the waveform is causing the interrupt. This latter item may not be a problem, but you may wish to average the collected timer value over several pulses to ensure that a noise glitch does not give you problems. Another trick you may like to implement is to have a dip switch on some pins that enables you to set up a centre or end value, or sensitivity. If using two dip switches you could go into a programming mode to write calibration values into EEPROM giving minimum timer value, maximum timer value, some sort of sensitivity per timer increment, or any other bits you may desire. These are just some ideas I floating without knowing what you expect to do as outputs (and also without reading the string of messages on this thread that were here on my arrival this morning). -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads