I'm working on a project that requires frequency measurement of a square-wave signal. I've set up two timers using Processor Expert Software, the LPTMR running at 32.768 kHz and interrupting every 100 ms.
In the ISR I'm reading the counter register of the second Timer (TPM0_CNT), counting the rising edges of the external square-wave signal.
The counter value multiplied by 10 gives the frequency of the input signal.
With the help von Erichs LCDHTA component I'm "printing" the frequency on an LCD screen. At frequencies up to 300 kHz everything is working as expected, but at higher frequencies the system stop's working:
(working as expected)
(stops working at higher frequencies)
I've no idea why this is happening. Am I doing something wrong? Or is there a better way to count higher frequencies?
I've attached my source files, so you may have a look. Thank you for your help!
Jamin
Original Attachment has been moved to: FRDM-KL25Z_LCD_Test.zip
Solved! Go to Solution.
Thanks for your help!
I just found my mistake. It wasn't a software, but a hardware issue. The ground pin of my function generator wasn't connected properly to the FRDM board. Ground was floating and the MCU couldn't detect the signal properly.
Sorry for wasting your time.
You too,
Jamin
Thanks for your help!
I just found my mistake. It wasn't a software, but a hardware issue. The ground pin of my function generator wasn't connected properly to the FRDM board. Ground was floating and the MCU couldn't detect the signal properly.
Sorry for wasting your time.
You too,
Jamin
Hi Jamin,
Before answer your question, I'd like to confirm with you about the exactly value of edges when you put a break point on the line as Fig 1 illustrates during debugging the project.
I'm looking forward to your reply.
Fig 1
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------