1
\$\begingroup\$

How to measure input pulse signal's frequency using xilinx toolkit on matlab?

Since I'm bad at coding,I use System generator on matlab. I'm doing a project, In which I'll be using a Proximity sensor to measure RPM of a motor. The output of the sensor is put across Schmitt trigger, so it becomes a Pulse Signal.

I need to find the frequency of this pulse signal, So I can calculate RPM.

\$\endgroup\$
2
\$\begingroup\$

If you want to measure frequency, you need a reference frequency you can compare it to.

The usual way to do this is to set up two counter chains, one of which is clocked by your reference frequency Fref, and the other clocked by your unknown frequency Funk (input signal conditioning is an exercise left for the student). You let the two counters run for the same amount of time T, then read their values.

$$Count_{ref} = F_{ref} \cdot T$$

$$Count_{unk} = F_{unk} \cdot T$$

Combine the two equations by dividing them, and solve for Funk:

$$F_{unk} = \frac{Count_{unk}}{Count_{ref}} F_{ref}$$

That's the general concept, but in practice, the process is often simplified by using the reference counter itself to determine the time period T, which makes Countref a known constant, and Fref is also chosen to be a "nice round" number. This turns the multiplication and division into trivial operations, and the frequency can be read more or less directly from Countunk. For example, if Fref/Countref = 1 Hz, then Countunk = Funk directly.

There are many subtleties associated with optimizing the performance of this process that I won't get into here, but there's one trick that's often used when you want to measure relatively low frequencies (such as RPM) with high resolution without requiring a long time T. Instead of making T depend on Fref, making Countref constant, you make T depend on Funk, making Countunk a constant. Also, make Fref as high as you reasonably can. Now you need to do a division operation to get the answer, but you can get it in a fraction of a second with many digits of precision.

\$\endgroup\$
0
0
\$\begingroup\$

Feed your pulse into the reset input of an up counter (System generator has a block for that). Latch the output of the counter each time the pulse comes along, and feed that signal onwards. It is a representation of frequency - knowing your FPGA's clock rate you can convert to Hz and then RPM if required, but with a little extra thought you can often work in the "clock count" domain in the next stages of your processing and avoid having to convert.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.