I have having difficulty in setting a 10ms timer using using the PSoC Creator.

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

cross mob
adadc_332791
Level 1
Level 1

I want to create a timer in multiples of 10ms. At the moment, I intend to configure using the TCPWM component to achieve this, but I am not able to get the settings correctly when configuring.

Any advice?

Thanks

Paul.

0 Likes
1 Solution
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

I have attached a sample project that generates a timer interrupt every 10ms. Please do check it out and let us know if it satisfies your requirement.

1. Please make sure that the ISR is written correctly and that Timer_1_ClearInterrupt(Timer_1_INTR_MASK_TC); API is called so that the interrupt is cleared.

2. Timer and clock components have to be started by calling the Timer_Start() and Clock_Start() APIs. Make sure you call these inside main().

3. Interrupt service must be started by calling the isr_StartEx() API.

If the problem isn't resolved, please share your project so that we can debug it and provide a solution.

Thanks and regards

Hari

View solution in original post

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

There are three (3) parameters controlling the TCPWM:

The input clock

The period value

The compare value

The output frequency is calculated by: Input clock[Hz] / Period value

The pulse width[seconds] by: 1 / (Input clock[Hz] / Compare value)

So (as an example only) selecting

Input Clock 1MHz, Period value 100, Compare value 10 will result in

pulses every 10 ms with a width of 1ms

Bob

Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

I have attached a sample project that generates a timer interrupt every 10ms. Please do check it out and let us know if it satisfies your requirement.

1. Please make sure that the ISR is written correctly and that Timer_1_ClearInterrupt(Timer_1_INTR_MASK_TC); API is called so that the interrupt is cleared.

2. Timer and clock components have to be started by calling the Timer_Start() and Clock_Start() APIs. Make sure you call these inside main().

3. Interrupt service must be started by calling the isr_StartEx() API.

If the problem isn't resolved, please share your project so that we can debug it and provide a solution.

Thanks and regards

Hari

0 Likes