PSoC4 TCPWM Counter Mode Interrupt Trigger on Capture

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I have an application needs to measure the pulse width. I used the demo code PWMexample as a start. I added a TCPWM counter component to try to measure the pulse width of the PWM signal. Hope that the counter will start at the rising edge and capture at the falling edge so by reading the capture register I can get the pulse width. But the problem here is: whenever I added start or reload input to the component, the capture won't trigger the interrupt.

   

Does anyone knows what I missed? 

0 Likes
5 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Why do you think that start reacts to a rising flank and capture to a falling flank? The component data sheet says a capture happens when "a capture event is active". This means the signal must go high for a capture.

   

In your schematic, a NOT gate should then help. Or even better: use an edge detector component.

0 Likes
Anonymous
Not applicable

Thank you for reply! But the inputs can be configured as either 'rising edge', 'falling edge' or both?

   

On datasheet: The Input Configuration parameters select the visibility and mode for each of the five input signals (Reload, Start, Stop, Capture, and Count). These inputs are not visible on the symbol by default. Check the Present checkbox for each input that is needed in the design to make it present on the symbol for connection. Each of these signals can be configured to be triggered by a Rising edge, Falling edge, Either edge, or based on the signal Level

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Can you share your project? The images show not everything...

   

How did you determine the interrupt is not triggered? By software? (Maybe the ISR was not started...) You can route the interrupt line a to a pin and then use a scope to check.

0 Likes
Anonymous
Not applicable

I got it worked... something messed up in the software... 

   

Much appreciated for your reply. Thanks!

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Janey,

Could you share what went wrong in the setup, so that it will be helpful for the community.

Best Regards,
VSRS

0 Likes