about Capture function test of CY8C4247AZI-M485

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.
Tim_Shih
Level 5
Level 5
250 sign-ins 50 replies posted 50 questions asked

Dear Receiver,

I would like to test simple "capture function" of the timer counter block.

Because I want to know how long I pressed the switch (SW2). But my test is failed. Could you help me to check my code?!

My test board is CY8CKIT-044.

Attached file 1 is my test project. It's a full project which be compressed in ZIP file.

Attached file 2 is my *.cysch of the test project.

Attached file 3 is my *.pin setting of the test project.

Attached file 4 is my  capture setting of the test project.

Attached file 5 is my  main.c code of the test project.

Could you help me to check what's wrong with my project ?! (IO function is ok, but capture function is not ok!)

Thank you so much.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Gautami_12
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @Tim_Shih,

I have created a project to know how long I pressed the switch SW2. please use the tera term to see the time interval value. Please refer to the project zip file attached below.

Warm Regards,
Gautami J

View solution in original post

4 Replies
Gautami_12
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @Tim_Shih 

Can I please know the test condition you are using? Are you expecting the onboard led to be controlled by the SW2 switch manually?
We recreated the project using the project file that you shared with us. 
We were able to switch off the led by pressing the sw2 switch and keep the led off until we release the switch.

Warm regards,
Gautami J

lock attach
Attachments are accessible only for community members.

Dear Gautami, 

Yes, the LED is the indicator that I pressed/release the button. This function is ok.

But the "capture interrupt subroutine" in the main.c can't work properly.

The main function I want is  how much time interval from I pressed the button to release the button.

Could you please check the following attached file ?! This is the main function I want.

Thank you so much.

0 Likes
Gautami_12
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @Tim_Shih,

In the schematic of your project that you have attached, you have not configured the input pin to generate interrupts during falling /rising edges. Hence interrupt is not generated while we press the sw2 switch,  Hence the "capture interrupt subroutine" in main.c does not get executed.

please follow the below steps to configure the input pin to generate interrupt:-

1]double tap on the input pin module present in the schematic.
2]open the pin section.
3]then open the input section.
4]In the interrupt text box, select both edges. So, that interrupt gets generated on both rising and falling edges.

For reference please refer to the below screenshot:-

schematic.pngScreenshot (130).png

Please let us know if you have any more queries.

Warm Regards,
Gautami J

 

lock attach
Attachments are accessible only for community members.
Gautami_12
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @Tim_Shih,

I have created a project to know how long I pressed the switch SW2. please use the tera term to see the time interval value. Please refer to the project zip file attached below.

Warm Regards,
Gautami J