<?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>topic Re: RIT priority over 'if' block in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591912#M29807</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aenglot on Wed Nov 28 16:02:03 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;sounds good. thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:26:06 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:26:06Z</dc:date>
    <item>
      <title>RIT priority over 'if' block</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591910#M29805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aenglot on Wed Nov 28 13:13:59 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi sorry if this question is annoying, hopefully it has a simple and easy solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so i have a switch hooked up to my LPC1769 at one of the GPIO pins, and i want my program to print a timestamp every time the swith is pressed. i want millisecond resolution so i'm using the RIT for milliseconds, and the RTC for the minutes and seconds. the problem i'm having is that if i keep the switch pressed down, the RTC values update (great!), but the RIT value doesn't (not so great). i'm assuming the 'if' statement is overriding the RIT interrupt handler. is there a way to give the RIT priority over the if statement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the code looks something like this (initialization of RTC and RIT were copied from the examples unaltered):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;while (1) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; current_time = RTCGetTime();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; if ( rit_timer_counter &amp;gt;= 100 )&amp;nbsp;&amp;nbsp; // 1s&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rit_timer_counter = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; if(LPC_GPIO2-&amp;gt;FIOPIN &amp;amp; SWITCH)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get pin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "time: %d:%d:%d \n", i,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; current_time.RTC_Min, current_time.RTC_Sec, rit_timer_counter);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:26:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591910#M29805</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: RIT priority over 'if' block</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591911#M29806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Wed Nov 28 13:49:26 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: aenglot&lt;/STRONG&gt;&lt;BR /&gt;Hi sorry if this question is annoying, hopefully it has a simple and easy solution.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#1 Add a flag to read a new pressed button. Reset this flag if your button is released again. So you printf only one time and not as long as your button is pressed ;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#2 Move your RIT stuff (rit_timer_counter &amp;gt;= 100...) into your RIT interrupt handler. So your slow printf isn't delaying it :eek:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:26:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591911#M29806</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: RIT priority over 'if' block</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591912#M29807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aenglot on Wed Nov 28 16:02:03 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;sounds good. thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:26:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/RIT-priority-over-if-block/m-p/591912#M29807</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:26:06Z</dc:date>
    </item>
  </channel>
</rss>

