question on using capture interrupt to read count on Timer16 (CY3210)

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.
SuSc_283911
Level 1
Level 1
5 replies posted 5 questions asked First reply posted

Hi --

   

I'm working towards building a "reaction timer" application using the CY3210 eval kit w the 29466 device.

   

As an precursor to the goal project, I've built a project to simply read the count on a Timer16 when an external pb switch is depressed and display that count on the LCD.  At this point - that's all I want to do.  Once I've got that working, then I know that I understand the capture interrupt capability of the device.

   

The pb switch is connected between two resistors -- one of which goes to VCC, the other to ground. When the switch is not depressed (open), the output from this circuit- which is connected to P0_1 is 0V, when depressed the output is 5V.  P0_1 goes to the analog_column_mux to the input of a COMPA in the analog section.  The comparator_0 bus is then used as the capture input on the Timer16 module. 

   

There's a "spin loop" in the project which is supposed to stop when the pb switch is pressed.  The Timer_Interrupt ISR is supposed to read the count and set a flag to stop the spin loop.  The count is to be displayed when the spin loop terminates.

   

That's it "in theory".  In practice, however, when I push the switch, NOTHING HAPPENS.  The spin loop keeps merrily counting and the interrupt is (apparently) never generated.  

   

I've attached the project in hopes that someone can find my error.   

   

Thanks,

   

SQ

0 Likes
3 Replies
Anonymous
Not applicable
        Hi SQ   
I think comparator is not need for this purpose which connected to P0-1   
Just only Pin interruption(fall edge) meet for this.   
P0-1 would have resistive pull up drive and before evry sensing the pin value,   
Write 1 to this pin.   
0 Likes
SuSc_283911
Level 1
Level 1
5 replies posted 5 questions asked First reply posted

Hi PSoC73 --

   

Thanks for your reply.  It got me to thinking about the project I/O. 

   

Actually, I do need the comparator UM (or some other UM to serve as an intermediary) because one can't connect the timer UM to the I/O pins directly.  I pulled up the "measuring frequency" project (AN2283) and looked at how the I/O from the signal source to the timer was done. 

   

In truth, however, the actual reason my project didn't work is because I forgot to START the COMP UM.  Total rookie mistake (shame on me).

   

So, I used your suggestion about configuring the pin, together with what I saw in the app note project, and added the command  to start the COMP UM.   The project now works like a champ - and my i/o circuit is much simpler with just the pb to VCC rather than the resistor/pb network I had before.

   

So, again -- thanks!

   

Best,

   

SQ

0 Likes
Anonymous
Not applicable
        Person is following a similar way to reach the destination. You are wellcome anytime at all.   
0 Likes