| ??? 11/14/02 22:40 Read: times |
#32526 - RE: help - question on digital frequen |
Seamus,
Post your code. The timer 0 or 1 can be gated by an external signal, ie your acclerometer. The input signal goes to INT1 and the timer is set to gate mode, as well as 16 bit timer mode Now as long as INT1 is high timer 1 will count, and when INT1 goes low it can send an interrupt that tells you to get your answer. If you use timer0 as WELL, then you can measure the period of the other half cycle and get a VERY precise ratio. Invert your signal and apply it to INT0. There are much more elegant methods, but they need a CCU, or messing around with T2 as well. This method is quick and dirty ! Have you got a 400Hz part or a 100 Hz part. Steve |



