Countcell Counters in PSoC3/5LP UDB.

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

cross mob
Anonymous
Not applicable

 Are you running out of counters/Timer/PWMs in the PSoC UDB due to the Datapath resources being utilized? Thes countcell counters will come in to a rescue then. These counters use the control cells in the UDB, and hence we have a privilege to use 24 of them in PSoC3/5LP architecture. The control cells shall either be used as a control register or as a 7 bit counter lilke this.

   

Remember that these are 7 bit counters that counts down and not 8 bits.

   

To get this counter up and running, we need to instantiate the following code,

   

 

   

   

cy_psoc5_count7

    #(.cy_init_value(7'b1111111),.cy_alt_mode(`TRUE),.cy_period(7'b1111111),.cy_route_ld(`FALSE),.cy_route_en(`TRUE))   

   

 

   

counter(

   

/* input */.clock(clk),

   

/* input */.reset(reset),

   

/* input */.load(1'b0),

   

/* input */.enable(enable),

   

/* output [06:00] */.count(count2),

   

/* output */.tc(tc1)

   

);

   

Just hook up the appropriate inputs to this module and get the counter running. A very important point to remember here is that, to enable this counter, we need to enable the counter both in the hardware and also in the software. In hardware, the enabling happens, when the appropriate enable signal is hooked up in the module above. To enable the counter in the software, we have to set the 5th bit in the Auxiliary control register. To do that, open the "cyfitter.h" and figure out the appropriate Auxiliary register for that instance and write a 1 to the 5th bit. The register will look like the one shown below

   

 

   

countcell_1_cnt7_counter__CONTROL_AUX_CTL_REG |= 0x20;

   

This will enable the counter in software.

   

Happy designing,

   

Rahul ram

0 Likes
5 Replies
Anonymous
Not applicable

Good stuff!!  🙂

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

PSoC Sensei has a ready-made component for that already available: http://www.cypress.com/?rID=47737&cache=0

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

@Rahul

   

One of the advantages of PSoCs (besides some others...) is using ready-made usermodules that prevent us from bit-fiddeling. Not everyone understands excerpts from Verilog and the lack of a complete example given will make the usage difficult at least.

   

As Hli already posted, there is already a complete usermodule made ready to use, so why not take that?

   

 

   

Bob

0 Likes
crcac_264396
Level 4
Level 4
First like received

don't forget these 7 bit counters need to be software enabled or they don't start. Lost quite some time to that...

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Although there is an API named Count7_Start()? Or is there another software enable I didn't see?

   

 

   

Bob

0 Likes