Does that work if the PWM period changes significantly with temperature? That is the case with the Memsic accelerometers. Over the range of 25° to 40°C, the period increases about 115 uS. That equates to a few degrees tilt (10° of tilt produces an increase of 340 uS for the high time), which would not be acceptable in my application.
I played with measuring the whole period and making a linear correction for the change due to temperature to the high time. In other words, over the range I am using, subtracting half of the change due to temperature works well on paper, and avoids having to do multi-precision division. That approach has not completely been discarded, but I am currently looking at doing the calculation based on the ratio of high counts to total period counts.
What I have working now is quite simple. I use Timer1 (16 bit, 1:2 prescale, 8 MHz processor). I start the timer at the first high after the first low, stop it when input goes low, save that count, restart and count the rest of the period. Total period is 10,000 counts at 25° and duty cycle is 50% at level. The stop, save, start introduces about a 5 cycle error, which is insignificant and constant.
I posted the communication from Memsic merely as a follow-up for someone who might be searching on the same question. Memsic does offer analog-only accelerometers. As for the qualifications of the person who replied, Memsic is quite a small company, and I suspect most of the technical people at his level are fairly knowledgeable about the products.
John