John De Villiers wrote: > One frequency is the pulses from one of the coils on a motorbike. The > other is for it's speedo. The problem with the revcounter one is that > I have to multiply the freq with a constant value in order to still > display the correct value. Should I do this in assembler or with a > PLL? What's the PLL got to do with it, and why's it an alternative to assembler? Do you mean a HLL? I'm applying traction to your femur ;-) Actually, I think I know how you are muddled. If you *were* to use a PLL, you have to code the PLL in assembler (or if it suits you, "C"). It goes sort of like this: At a given rate (determined by your timing loops) you add a phase increment to a register which is your phase accumulator. Every time you receive a timing pulse, you look at the phase accumulator and see how close it is to the "zero" point. The error is scaled, and added to/ subtracted from the phase increment. This can be made to work as long as your internal "flywheel" (PLL) responds faster than the *real* one. The phase increment is scaled closely (binary factor) to the actual RPM value. There is some risk of locking to a (sub-)harmonic with this phase detection algorithm, perhaps you should use the "digital" algorithm from the 4046 chip instead... Interesting concept really, you do the measurement "backwards" using successive approximation of your presumed frequency to your (sub- multiple) real one. -- Cheers, Paul B.