<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Two timers on RTC1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/559/two-timers-on-rtc1</link><description>Hi,
This is loosely related to the other question I asked a few weeks ago ( devzone.nordicsemi.com/.../two-interrupt-events-on-timer0) but this time I want to have two timers on RTC1 generating interrupt events. I&amp;#39;m using the internal RC clock.
I&amp;#39;m</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Oct 2013 12:42:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/559/two-timers-on-rtc1" /><item><title>RE: Two timers on RTC1</title><link>https://devzone.nordicsemi.com/thread/2889?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2013 12:42:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bdf40e5-11e5-4187-893a-4c3ee829b14f</guid><dc:creator>Florin</dc:creator><description>&lt;p&gt;Ah yes, thanks, it works now!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two timers on RTC1</title><link>https://devzone.nordicsemi.com/thread/2888?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2013 05:37:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc0e272c-1b1d-404c-9433-3473d344606b</guid><dc:creator>S&amp;#233;bastien Despont</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Because you need to re-set the comparators (or reset the tick event, but it is not what you want in your case) to be notified when the counter will reach the comparators values.&lt;/p&gt;
&lt;p&gt;To do that, you need to re-set the CC comparator in your interrupt like this for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void RTC1_IRQHandler()
{
  if (NRF_RTC1-&amp;gt;EVENTS_COMPARE[0] != 0)
  {
    NRF_RTC1-&amp;gt;EVENTS_COMPARE[0] = 0;
    NRF_RTC1-&amp;gt;CC[0] += 9 * 1000;
  }
  if (NRF_RTC1-&amp;gt;EVENTS_COMPARE[1] != 0)
  {
    NRF_RTC1-&amp;gt;EVENTS_COMPARE[1] = 0;
    NRF_RTC1-&amp;gt;CC[1] += 2 * 1000;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you don&amp;#39;t do that, you need to wait the next time that the counter will reach the value of your comparator : reach the overflow value (24 bits counter = 0xFFFFFF/32768 = 511 seconds with prescaler = 0) and restart to count from 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>