PSOC5 Counter Component - Proper way to change count value

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

cross mob
DaSi_281136
Level 3
Level 3
25 replies posted 10 replies posted 5 replies posted

I'm working on project where I need to be able to change the count value in a Counter component on the fly.

I was thinking about using the Counter_WriteCounter() function but the datasheet states that using this without disabling the Counter could mess things up.

How does one disable and then re-enable the component with the new count value?

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

Quite easy:

Counter_Stop();

Counter_WriteCounter();

Counter_Start();

Bob

View solution in original post

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

Quite easy:

Counter_Stop();

Counter_WriteCounter();

Counter_Start();

Bob

0 Likes

Thanks!

I assumed that when you start the component it uses the component configuration settings and not the new value passed in from my program.

0 Likes

I assumed that when you start the component it uses the component configuration settings

This is done when you use Counter_Init() which is called by Counter_Start() only when the component has not been initialized yet.

Check datasheet for "initvar"

Bob

0 Likes