best way to count the number of failing edges?

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

cross mob
Anonymous
Not applicable

Hi,

   

I have configured the SPIM component with 11 bits of Manchester data. I want to count the number of falling edges of that Manchester data. Currently have configured the Counter to do so. Counter is configured as :

   

-------------------------------------

   

Capture Mode: Falling Edge

   

Interrupt: On Capture 

   

Compare mode: Less than or Equal

   

Capture and count input: manchester

   

Clock: sclk

   

​--------------------------------------

   

In the ISR, I want to perform action on the particular falling edge.

   

What is the best way to count the falling edges of the manchester data? 

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I assume you want to count over a specific period of time ? If so

   

use a timer to enable counter, one shot mode, then attach an ISR

   

to timer end of period, in that ISR read counter and reset it  The

   

variable used should be declared as volatile. After counter read,

   

reset counter, restart timer.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
1 Reply
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I assume you want to count over a specific period of time ? If so

   

use a timer to enable counter, one shot mode, then attach an ISR

   

to timer end of period, in that ISR read counter and reset it  The

   

variable used should be declared as volatile. After counter read,

   

reset counter, restart timer.

   

 

   

Regards, Dana.

0 Likes