I just wanted to make sure that there wasn't an easier/better way to measure a pwm signal. I have obtained some ADXL202E dual axis accellerometers from Analog Devices, and want to hook one up to my IPaq. Rather than taking control of the serial port, I'm going to make a simple interface with a 16f877 (sort of a portable lab toy) and then interface that to the IPaq. The ADXL202 puts out two signals whose duty cycles vary with the acceleration the device is under in the two axis'. Since the period of he signal is controlled by a resistor (which can vary according to temperature) then I need to occasionally (every few minutes) find the total period, and when I need the data I need to find the width of the pulse. My understanding is that the easiest way to do all this is: Measure total period: Set CCP to capture, positive going pulse When a change is captured, reset timer one When the next change is captured, the value captured is the period Measure Pulse Width: Set CCP to capture, positive going pulse When change is captured, reset timer one and set capture to occur on negative going pulse When next change is captured the value captured is the pulse width The duty cycle can be found by dividing the pulse width by the total period. Assuming that's the best way, then I only have a few questions: If the two pulse trians (x axis, y axis) start at the same time, then I won't have a problem measuring both simultaneously with the two ccp pins. However, if they are not the same then I'd have to either measure them seperately, or simply capture the readings for the start and stop of each event, and use subtraction to determine the length without reseting timer one. By doing so, though, I risk timer one overflowing and having to deal with subtraction across the zero boundary, which doesn't sound like fun to me. Is there a better way? Since my initial experiments are going to be under 10 Hz sampling, then it's not an issue to measure them at different time, and it will show me if they are synchronized, so I can do it this way fine, but I'd still like to find out if there's something better out there. -Adam -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads