Variable value counter

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

cross mob
Anonymous
Not applicable

Is there any way that the count value of the counter be not just one each time but any value. If so how to do that ?

0 Likes
8 Replies
Anonymous
Not applicable

Can you be more specific?

   

Ie what do you want to counter to do?

   

What is the input to the counter?

   

How do you read the counter?

   

Is this a problem with your project? if yes, could you zip and post the project file as well?

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

There are several ways you could create a custom modulo counter -

   

 

   

1) Standard counter with ISR triggered read, followed by multiplier of value read.

   

2) LUT implemented counter.

   

3) Verilog derived solution.

   

 

   

To name a few.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Actually I wanted a variable value counter. The counter can not only increment by 1 at each clock but user specified value. 

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

Where does this user-defined value come from? How often does it change? It might be easier to just count, and then multiply afterwards.

   

What is the problem you are trying to solve?

0 Likes
Anonymous
Not applicable

Good question.

0 Likes
Anonymous
Not applicable

 This is basically for frequency divider. Thats the reason I was asking for variable value counter. User can specify the what value needs to be skipped bby the counter.

0 Likes
Anonymous
Not applicable

you can use a counter with TC as the output.
Change the dividiing ration by loading the counter value with Counter_WritePeriod().
Remember that the counter should be n+1, also that you cannot have divided by 1 in this case.

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

So basically you want to build a phase accumulator? Look here: http://www.cypress.com/?rID=39408&cache=0 to find a component which should do what you need. You will need to rework the component a little bit, since it is intended to use the DMA, but you want a digital output signal.

0 Likes