<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDEのトピックRe: time () does nothing</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550426#M11413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cfb on Mon Jul 29 15:05:27 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Read Chapter 27 of the LPC1769 User Manual (UM10360) for all the details of how to access the Real-Time Clock. In particular Section 27.6.3.1 describes how the Secs:Mins:Hrs:Day information is stored in the CTIME0 register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We supply a library module called Clock and an example LPC1769 program called ShowTime with our Astrobe development system. Clock includes the following Oberon-language procedure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PROCEDURE* GetHMS*(VAR hh, mm, ss: INTEGER);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ctime: INTEGER;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BEGIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SYSTEM.GET(MCU.CTIME0, ctime);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ss := ctime MOD 40H;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mm := LSR(ctime, 8 ) MOD 40H; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; hh := LSR(ctime, 16 ) MOD 20H&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;END GetHMS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to translate this to C:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CTIME0 = 0x40024014&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MOD is equivalent to %&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LSR is equivalent to &amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;40H is equivalent to 0x40&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:01:45 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:01:45Z</dc:date>
    <item>
      <title>time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550424#M11411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by abaxor on Mon Jul 29 00:38:01 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the LPC1769 with a real time clock. Just now I want to use the time function of time.h to read the RTC. But time does nothing. How can I add some meaningful stuff to time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;tom&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550424#M11411</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550425#M11412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Jul 29 06:02:15 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I suggest you start off by looking at RTC example code for the part. This subject has come up several times before on the LPCXpresso forums. Thus a good place to start would be to do a forum search for "RTC LPC17". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fsearch%2Fgss%2FRTC%2520LPC17%2520inurl%253Aforum" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/search/gss/RTC%20LPC17%20inurl%3Aforum&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550425#M11412</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550426#M11413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cfb on Mon Jul 29 15:05:27 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Read Chapter 27 of the LPC1769 User Manual (UM10360) for all the details of how to access the Real-Time Clock. In particular Section 27.6.3.1 describes how the Secs:Mins:Hrs:Day information is stored in the CTIME0 register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We supply a library module called Clock and an example LPC1769 program called ShowTime with our Astrobe development system. Clock includes the following Oberon-language procedure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PROCEDURE* GetHMS*(VAR hh, mm, ss: INTEGER);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ctime: INTEGER;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BEGIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SYSTEM.GET(MCU.CTIME0, ctime);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ss := ctime MOD 40H;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mm := LSR(ctime, 8 ) MOD 40H; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; hh := LSR(ctime, 16 ) MOD 20H&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;END GetHMS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to translate this to C:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CTIME0 = 0x40024014&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MOD is equivalent to %&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LSR is equivalent to &amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;40H is equivalent to 0x40&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550426#M11413</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550427#M11414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by abaxor on Thu Aug 01 05:07:57 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is not to access the RTC, this works. Instead of using my own function to read the RTC I want to use the time () function of time.h. But I haven't any imagination how to adopt this function to my needs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;tom&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550427#M11414</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550428#M11415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Thu Aug 01 06:27:19 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using Newlib, the time functions call _gettimeofday to actually get the time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you provide _gettimeofday in your project (and make sure it gets linked before th system library), then you can use the RTC to get your clock values and use time() as normal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a simple example of _gettimeofday:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
int
_gettimeofday (struct timeval * tp, void * tzvp)
{
&amp;nbsp; struct timezone *tzp = tzvp;
&amp;nbsp; if (tp)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;tv_sec = &amp;lt;get_seconds&amp;gt; ; // get the seconds from a clock source
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp-&amp;gt;tv_usec = &amp;lt;get usecs&amp;gt;; // get the microsconds from a clock source
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp; /* Return fixed data for the timezone.&amp;nbsp; */
&amp;nbsp; if (tzp)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tzp-&amp;gt;tz_minuteswest = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tzp-&amp;gt;tz_dsttime = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp; return 0;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550428#M11415</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: time () does nothing</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550429#M11416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 01 09:05:31 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Redlib's&lt;/SPAN&gt;&lt;STRONG&gt; time()&lt;/STRONG&gt;&lt;SPAN&gt; call's the function &lt;/SPAN&gt;&lt;STRONG&gt;__sys_time()&lt;/STRONG&gt;&lt;SPAN&gt;, which when you link with the semihosted variant of the library will call up to the host to get the time value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fsupport.code-red-tech.com%2FCodeRedWiki%2FWhatIsSemiHosting" rel="nofollow" target="_blank"&gt;http://support.code-red-tech.com/CodeRedWiki/WhatIsSemiHosting&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thus if you want to get time() to use the RTC on your system, you will need to provide your own implementation of __sys_time() that carries out the necessary accesses to the RTC to work out the time_t value to return. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned int __sys_time(void);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that Redlib does not implement timezone support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:01:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/time-does-nothing/m-p/550429#M11416</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:01:47Z</dc:date>
    </item>
  </channel>
</rss>

