how make 90 seconds timer

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

cross mob
Anonymous
Not applicable

Hi ,

   

      how to make a 90 seconds timer ,i.e after 90 seconds it must enable a ADC, here ADC is started by Hardware triggered by the 90 seconds timer .

   

Thanks

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

The usual way to accomplish a long-time timer is

   

Setup an interrupt-generating short-time timer (like 10 to 100ms)

   

At each interrupt increase a counter (can be a 32-bit global var)

   

in main()-loop check counter for exceeding a given value

   

 

   

or

   

At start of time set counter to a pre-defined value

   

At each interrupt decrease the counter (can be a 32-bit global var)

   

in main()-loop check counter for expiring.

   

 

   

Happy times

   

Bob

View solution in original post

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

The usual way to accomplish a long-time timer is

   

Setup an interrupt-generating short-time timer (like 10 to 100ms)

   

At each interrupt increase a counter (can be a 32-bit global var)

   

in main()-loop check counter for exceeding a given value

   

 

   

or

   

At start of time set counter to a pre-defined value

   

At each interrupt decrease the counter (can be a 32-bit global var)

   

in main()-loop check counter for expiring.

   

 

   

Happy times

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You could also use RTC derived one pulse per second interrupt, from

   

the TRM -

   

 

   

Real Time Clock

   


One of the major uses of the kHzECO oscillator is for RTC
implementation. The block level illustration of the RTC
implementation is shown in Figure 14-7.
The RTC timing is derived from the 32 kHz external crystal
oscillator, as shown in Figure 14-7. Therefore, for the functioning
of the RTC, the 32 kHz external crystal must be
enabled through the register SLOWCLK_X32_CR [0]. The
generated 32 kHz is divided to achieve a one pulse per second.

   


The register PM_TW_CFG2[4] enables one pulse per
second functionality.

   


By enabling the bit PM_TW_CFG2[5], the RTC generates
an interrupt every second. The interrupt is routed through
the DSI and is brought out as an interrupt. See the UDB
Array and Digital System Interconnect chapter on page 221
for more details on usage. RTC functionality is available for
use in all power modes except the Hibernate mode.

   

Looks like you can use this HW feature w/o having to place

   

RTC module. See PM_TW_CFG2 register information in

   

PSOC 3 register TRM.

   

 

   

Regards, Dana.