11 years, 4 months ago.

Which mode is best to read Frequency?

Hi all,

I use a nxp lpc1768 development board.

I have a Sine wave generator > this i convert to a square wave.

Now i need to measure the frequency Lets say its around 20kHz

Which is the best and fast technique to do this

Timer with CAP(Capture signals) (or)

Timer with MAT(External Match Output) (or)

GPIO interrupt based.

A sample code will be very helpful,

Regards,

Sukruth

1 Answer

11 years, 4 months ago.

Capture is the best/most accurate/fastest way to do it. External match won't do anything useful for your problem. GPIO interrupt based is the easiest, since that is covered by the mbed lib, using InterruptIn and Timer can give you the information you need. But it isn't as fast (maximum speed is limitted, but 20kHz should be fine), and has 'only' microsecond resolution.

Capture while intended for your use case is not covered by the mbed lib, so you need to figure it out using the user manual.

Accepted Answer