<?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>I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10698/i-want-to-implement-digital-clock-and-calender-in-nrf51422-using-internal-rtc</link><description>I want to implement digital clock AND CALENDER in nRF51422 using internal RTC. iF ANYONE HAVE ANY IDEA THEN PLEASE SHARE WITH ME. bhavasar.bhagyesh@gmail.com</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Feb 2016 07:59:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10698/i-want-to-implement-digital-clock-and-calender-in-nrf51422-using-internal-rtc" /><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39936?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2016 07:59:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b3bb6c2-0a58-4c29-a5b2-9ba42f989150</guid><dc:creator>BHAGYESH</dc:creator><description>&lt;pre&gt;&lt;code&gt;// Internal 32kHz RC
NRF_CLOCK-&amp;gt;LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos;
// Start the 32 kHz clock, and wait for the start up to complete
NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while(NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0);

// Configure the RTC to run at 1 second intervals, and make sure COMPARE0 generates an interrupt (this will be the wakeup source)
NRF_RTC0-&amp;gt;PRESCALER = 0;
NRF_RTC0-&amp;gt;EVTENSET = RTC_EVTEN_COMPARE0_Msk; 
NRF_RTC0-&amp;gt;INTENSET = RTC_INTENSET_COMPARE0_Msk; 
// NORDIC: Count to 32767, and not 32768
NRF_RTC0-&amp;gt;CC[0] = 1*32767;

NVIC_EnableIRQ(RTC0_IRQn);
// NORDIC: SET IRQ PRIORITY
NVIC_SetPriority(RTC0_IRQn, 0);
        
NRF_RTC0-&amp;gt;TASKS_START = 1;

//--------------------------------------------------------------------------------------------------

void RTC0_IRQHandler(void)
{

	  // NORDIC: CLEAR TASK AS QUICKLY AS POSSIBLE
    NRF_RTC0-&amp;gt;TASKS_CLEAR = 1;
    // This handler will be run after wakeup from system ON (RTC wakeup)
    if(NRF_RTC0-&amp;gt;EVENTS_COMPARE[0])
    {
			  NRF_RTC0-&amp;gt;EVENTS_COMPARE[0] = 0;
		info.tm_sec++;
   
		}
}
//--------------------------------------------------------------------------------------------------
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39935?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 14:02:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e057735c-b6fa-4fc1-9f49-0a815f1843cf</guid><dc:creator>hawk</dc:creator><description>&lt;p&gt;to drive the micro motor, it will use the (0.9/1 + 0.4/0)* 3ms pulse with T=15.625ms and run one step.  can i use RTC or i must use TIMER of 16Mhz..??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39933?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 13:53:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ec30720-b96b-4ac0-abde-0b366bef2af6</guid><dc:creator>hawk</dc:creator><description>&lt;p&gt;i have the same question. but i  must create pulse to drive the micro motor  to run to simulate second/minute/hour...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39934?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 12:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5376a9a6-4f3e-4d2c-bdd0-323fae319fe6</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;How about using app_timer and time.h functions?&lt;/p&gt;
&lt;p&gt;First you can create a timer of which the period is 1000 ms. And increase global rtc counter (e.g. uint32_t rtc_counter) in the timer callback each one second. Then you can convert its format to struct tm with localtime(). You can also set rtc counter to the variable using mktime().&lt;/p&gt;
&lt;p&gt;Of cource, rtc counter will reset if device is off and you have to set rtc counter again. =)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39932?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 11:38:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0491419-fbbc-4bc7-8c79-20483e965592</guid><dc:creator>BHAGYESH</dc:creator><description>&lt;p&gt;yes, like same&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to implement digital clock AND CALENDER in nRF51422 using internal RTC</title><link>https://devzone.nordicsemi.com/thread/39931?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 11:34:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e030bb3f-fda6-4639-856b-d82b5128b702</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;What does mean digital clock and calendar? Do you mean that nRF51422 RTC behaves as DS1307 or PCF8563?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>