I have a sensor which produces a square wave of varying frequency on its output.
I would like to capture this value. I am using the eZ430-F2013. Based on the document I thought I could input a this value on P1.0 and setup Timer 2A to use TACLK. This doesn’t appear to work.
I had another thought, but the chip is nott exactly designed for this. Use the XIN pin
My third tought is just to make an interrupt on P1.0 and count them, seems like a waste of resources.
Any thoughts? Has anyone else tried to do pulse counting?
A good way to measure frequency is to connect the signal to a pin that triggers a timer capture irq on each rising edge f.e. In the irq service you can read the value that was copied into the capture register. Store it to a variable. At the next irq you can subtract the old capture value from the new one. Now you got the length of the period of your sqaure wave.
TimerA runs always uninterrupted counting up on ACLK.
This can be beefed up with time out and overflow recognition, couting absolute number of pulses, debouncing etc.
That is what I ended up doing. It appears to work quite well. Now I’d like to figure out a way to pump the result back to the host computer over the USB port.