<?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>LPC MicrocontrollersのトピックInterrupt and variable</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Interrupt-and-variable/m-p/617339#M24128</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to all, i am new with lpcxpresso and i have a simple question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like change the value of a variable during an interrupt but the interrupt function is void, for this reason i try to use extern volatile variable but it seems not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;extern volatile uint64_t counter_1=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void RIT_IRQHandler(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Clear interrupt */&lt;BR /&gt; Chip_RIT_ClearIntStatus(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;counter_1=counter_1+1;&lt;BR /&gt;printf(" counter_1 vale %d \n",counter_1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Board_LED_Toggle(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/**&lt;BR /&gt; * @brief Main entry point&lt;BR /&gt; * @return Nothing&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Generic Initialization */&lt;BR /&gt; SystemCoreClockUpdate();&lt;BR /&gt; Board_Init();&lt;/P&gt;&lt;P&gt;/* Initialize RITimer */&lt;BR /&gt; Chip_RIT_Init(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;/* Configure RIT for a periodic interrupt tick rate */&lt;BR /&gt; Chip_RIT_SetTimerIntervalHz(LPC_RITIMER, TIME_INTERVAL);&lt;BR /&gt; Chip_RIT_Enable(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; NVIC_EnableIRQ(RITIMER_IRQn);&lt;/P&gt;&lt;P&gt;/* LED is toggled in interrupt handler */&lt;BR /&gt; while (1) {&lt;BR /&gt; /* Sleep between interrupts */&lt;BR /&gt; __WFI();&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like increment the variable&amp;nbsp;&lt;SPAN&gt;counter_1 every time an interrupt occours but it seems not work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thx you&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 15 Jan 2017 11:48:17 GMT</pubDate>
    <dc:creator>svip</dc:creator>
    <dc:date>2017-01-15T11:48:17Z</dc:date>
    <item>
      <title>Interrupt and variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Interrupt-and-variable/m-p/617339#M24128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to all, i am new with lpcxpresso and i have a simple question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like change the value of a variable during an interrupt but the interrupt function is void, for this reason i try to use extern volatile variable but it seems not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;extern volatile uint64_t counter_1=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void RIT_IRQHandler(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Clear interrupt */&lt;BR /&gt; Chip_RIT_ClearIntStatus(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;counter_1=counter_1+1;&lt;BR /&gt;printf(" counter_1 vale %d \n",counter_1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Board_LED_Toggle(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/**&lt;BR /&gt; * @brief Main entry point&lt;BR /&gt; * @return Nothing&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Generic Initialization */&lt;BR /&gt; SystemCoreClockUpdate();&lt;BR /&gt; Board_Init();&lt;/P&gt;&lt;P&gt;/* Initialize RITimer */&lt;BR /&gt; Chip_RIT_Init(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;/* Configure RIT for a periodic interrupt tick rate */&lt;BR /&gt; Chip_RIT_SetTimerIntervalHz(LPC_RITIMER, TIME_INTERVAL);&lt;BR /&gt; Chip_RIT_Enable(LPC_RITIMER);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; NVIC_EnableIRQ(RITIMER_IRQn);&lt;/P&gt;&lt;P&gt;/* LED is toggled in interrupt handler */&lt;BR /&gt; while (1) {&lt;BR /&gt; /* Sleep between interrupts */&lt;BR /&gt; __WFI();&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like increment the variable&amp;nbsp;&lt;SPAN&gt;counter_1 every time an interrupt occours but it seems not work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thx you&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Jan 2017 11:48:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Interrupt-and-variable/m-p/617339#M24128</guid>
      <dc:creator>svip</dc:creator>
      <dc:date>2017-01-15T11:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt and variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Interrupt-and-variable/m-p/617340#M24129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do not use printf in your interrupt handler:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- it disables interrupts while running&lt;/P&gt;&lt;P&gt;- is very very slow&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Jan 2017 16:14:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Interrupt-and-variable/m-p/617340#M24129</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2017-01-15T16:14:35Z</dc:date>
    </item>
  </channel>
</rss>

