how to generate Timer

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

cross mob
Anonymous
Not applicable

Hi. i have a question about Timer.

   

compared to other program, 'PSoC Creator' used wdt mostly by creating Timer.

   

but I think that side effect of this program could only 3 wdt.

   

but I want to use such as '1sec, 1min' Timer.

   

here's the example

   

***********************************************

   

SysTimer10ms++;
 if(!(SysTimer10ms%600)) { // 1 min
  SysTimerMin++;
 }
 if(!(SysTimer10ms%100)) { // 1 sec
  SysTimerForDHCP++;//DHCP LEASE TIME CHECK NO
 }
 if(!(SysTimer10ms%10)) { //100 ms
  SysTimer100ms++;
 }

   

***************************************************

   

 

   

please teach me in detail.

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

Using the systick timer or the WDT as you showed is the usual ARM M0 way. But in PSoCs (or PRoCs) is a bit more: there are components. Open the Topdesign view and drag a Timer Counter PWM - component onto your schematic screen. You may add a new page beforehand to better overview what you do. This component together with a clock component can be used to generate a one minute timer quite easy. The output can be connected to an isr component to get interrupted. With the component's APIs you are able to control (start/stop/reset etc) the TCPWM.

   

 

   

Bob

0 Likes