You can use the Timer component in PSoC Creator and take the Timer example project (available in PSoC Creator) which shows how to use the Capture and Terminal Count interrupts. You can modify for your purposes for measuring the frequency (for small frequencies - reading the period, for large frequencies - counting the number of pulses).
thanks for idea but the problem is iam not getting the read counter value and the debugging is stopped while function generator input is given to the port .iam using Psoc 4200m series kit .help me with the frequency measurement while function generator input is given to port and it has to perform some logic based on freq value . top design pls
Can you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Be a little bit more precise what works and what does not work.
Do not use Pin P0_7: It is connected to the user switch. Pressing the switch will shorten your function generator output to ground. See schematics.
CC_ISR_flag must be declared as "volatile" See here.
The frequent reload of the counter and _StartEx of the interrupt handler will interfere with the normal frequency measure. Both are needed at project initialization only. Your counter is already configured for resetting at the right times.
the problem iam facing is that the function freq() is not returning any value .
as per your suggestion i am changing the port to 0.0. and the CC_ISR_Flag defined as Volatile .
can you please get me the code such that it has to measure the freq whenever it is called . iam new to psoc please help me with it
the program is in the infinite for loop and not executing any statements .may be my approach is wrong can any give me the help to perform the frequency measurement task .new design with minimal code pls
Are you telling that the frequ() function is not called??? check (using a breakpoint) if the capture interrupt fires. When not, scope your input signal.
by the following code i can get the time stamp and freq but i dont want the freq all the time i want to write it in a function and whenever called the function it has to return the freq .
the code which has edited and the other with timer and counter has not worked at all .
i donno why readcapture() or Readcounter () is not updating while debugging the value is 0
It is not possible to help you without the complete project. As I see you reverted some of the corrections I made, so your file contains some errors.
what more you have to do is query the UserSwitch_Read() == 0 and then call for display the value
Glowing of LED is best done using the PriSM component.