Announcements
Community Announcement : Welcome to the NEW Cypress Developer Community.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

Anonymous
Not applicable

Hi everybody! The project I'm currently working on requires a counter with the ability to increment or decrement its value based on two non periodic clock/count direction signals (in contrast to a generic counter that only needs to work with one clock/count direction pair). I can think of several ways to implementing this in software for the ARM core, but I don't have much of a clue when it comes to hardware design, I only know basic theory. Any tips for the hardware noob?

   

 

   

Thanks in advance,

   

Gino

0 Likes
6 Replies
Bob_Marlowe
Expert II

Quite easy: use the UDB-based counter (v 3.0) which has got the capabilities you want.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob. I think the UDB counter is appropiate for the last part of the problem. However, I'm not sure of how to feed the count signals to it, as I have two signals that could either increment or decrement the stored value independently, like this: count_pulse_A,count direction_A, count_pulse_B, count_direction B.

0 Likes
odissey1
Honored Contributor II

Gino,

   

add a hardware MUX after inp1 and inp2 to make a single output  

0 Likes
Anonymous
Not applicable

Thanks for the tip! I'm thinking I could have a problem if both signals try to update the counter value at once, only the one being passed by the multiplexer will affect the counter value. I need to figure a way to avoid loosing pulses when each of the inputs "take turns" at the multiplexer output.

0 Likes
Bob_Marlowe
Expert II

Use a LUT component to cover some strange situations like counting up and down simultaneously. Since this component can be used  registered you may use it as a hardware state-machine to control your up/down counter.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob. I'll take a look at the LUT documentation. I'll report back with some results as soon as possible.

0 Likes