I am getting an accelerometer which sends out PWM. The total length of the off and on is 10ms. To measure the On time I can just run a time loop which begins the moment the input pin is high and measures the length of time the pin is high for.
Will this work OK? I havent got the thing yet, just trying to visual it. Can it be this simple? Always worries me when I think something will be simple!
Believe it or not, it is that simple. If you want better performance, consider using the CCP module in your PIC to capture the output. Not only will it be more accurate, but you can have it interrupt driven so you can free up processor time for other applications.