How to count rising edges of a clock?

Hello, i have a touch pad based off the TTP229 chip. This chip apparently outputs a basic communication protocol where the specific button pressed is conveyed through counting the clock and seeing when a specific pin turns high in relation to the clock. EX: when button 7 is pressed a specific pin will turn high after 7 rising edges of the clock after a input has been detected. Thus i need help counting these rising edges, i think i can use interupts but i don't have a full grasp of that yet.

So essentially, any good way to count a device's clock cycles?

Post a link to the chip's datasheet. It would be very strange if it needed a DIY detection system like you describe.

You can certainly use interrupts to count rising edges - Nick Gammon has a good Tutorial.

...R

@Robin2 that is indeed a nice little tutorial, thanks alot!

and for who ever is still interested here's the datasheet of the chip: DOC

TheHonestGuy: EX: when button 7 is pressed a specific pin will turn high after 7 rising edges of the clock after a input has been detected.

Sounds like this is where you would use shiftIn() to get the state of all the buttons.

I wonder does that chip work with the standard Wire library.

I confess I have never used that library - but it seems worth trying just in case the wheel has already been invented.

...R