<?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 Multiple adc channel interrupt problem, LPC1768 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1453350#M48655</link>
    <description>&lt;P&gt;Hello everyone, I used to read temperatures of two LM35 sensors using adc. I used two channels and interrupt too. My code works fine when I read two channels and I want to add two more sensors and read temperatures of 4 LM35 sensors, however when I add channels in adc interrupt my code locks when adc read function is called. For example my adc channel 0 and channel 1 are active when I add&amp;nbsp;if(ADC_ChannelGetStatus(LPC_ADC,ADC_CHANNEL_2,ADC_DATA_DONE)==0) in interrupt when adc_read() function is called the code stops and in debugger it stops moving forward and executing other lines of the code. I added my code and I hope I managed to explain my problem well enough. My chip is LPC1768.&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 08:20:14 GMT</pubDate>
    <dc:creator>Alexshea</dc:creator>
    <dc:date>2022-05-05T08:20:14Z</dc:date>
    <item>
      <title>Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1453350#M48655</link>
      <description>&lt;P&gt;Hello everyone, I used to read temperatures of two LM35 sensors using adc. I used two channels and interrupt too. My code works fine when I read two channels and I want to add two more sensors and read temperatures of 4 LM35 sensors, however when I add channels in adc interrupt my code locks when adc read function is called. For example my adc channel 0 and channel 1 are active when I add&amp;nbsp;if(ADC_ChannelGetStatus(LPC_ADC,ADC_CHANNEL_2,ADC_DATA_DONE)==0) in interrupt when adc_read() function is called the code stops and in debugger it stops moving forward and executing other lines of the code. I added my code and I hope I managed to explain my problem well enough. My chip is LPC1768.&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 08:20:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1453350#M48655</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-05T08:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1453623#M48669</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;What do you think? I remember once I had one adc and when I wanted to add another one had a similar problem and you helped me. Thought, I won't have any similar problem, since if it works with 2 channels, should work with 3 or more channels as well&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 14:25:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1453623#M48669</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-05T14:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1455881#M48721</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;It seems like the code is stuck in adc interrupt when I have more than 2 channels&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 19:47:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1455881#M48721</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-10T19:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1456021#M48722</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I will answer you at the end of the week, today, I am a bit busy.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 03:34:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1456021#M48722</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-05-11T03:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1456041#M48724</link>
      <description>&lt;P&gt;Awesome! thank you so much. I'll wait for your answer&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 04:05:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1456041#M48724</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-11T04:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458227#M48762</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;Hi, it's already Saturday! I was wondering if you check my code today or maybe tomorrow and by the way I need to work with all the 8 adc channels already not with 4 channels. Now I can work with 2 adcs and can't read other channels in adc interrupt&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 11:50:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458227#M48762</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-14T11:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458263#M48763</link>
      <description>&lt;P&gt;Hi, Alex,&lt;/P&gt;
&lt;P&gt;I do not use the Keil, I have checked the LPCOpen package, it appears that you do not use the lpcOpen package api function.&lt;/P&gt;
&lt;P&gt;Because the conversion time is not a problem, you can use the polling mode as the following code. I suggest you disable all channel interrupt&lt;/P&gt;
&lt;P&gt;I do not compile the code, pls have a try yourself.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//disable all channel interrupt&lt;/P&gt;
&lt;P&gt;void HW_Init()&lt;BR /&gt;{&lt;BR /&gt;PINSEL_CFG_Type adcpinsel;&lt;BR /&gt;PINSEL_CFG_Type uartPinSel;&lt;BR /&gt;UART_CFG_Type uartConfig;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NVIC_SetPriorityGrouping(0x07);&lt;BR /&gt;&lt;BR /&gt;adcpinsel.Funcnum=PINSEL_FUNC_1;&lt;BR /&gt;adcpinsel.OpenDrain=PINSEL_PINMODE_NORMAL;&lt;BR /&gt;adcpinsel.Pinmode=PINSEL_PINMODE_TRISTATE;&lt;BR /&gt;adcpinsel.Pinnum=24;&lt;BR /&gt;adcpinsel.Portnum=0;&lt;BR /&gt;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;adcpinsel);&lt;BR /&gt;adcpinsel.Pinnum=23;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;adcpinsel);&lt;BR /&gt;adcpinsel.Pinnum=25;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;adcpinsel);&lt;BR /&gt;//adcpinsel.Pinnum=26;&lt;BR /&gt;//PINSEL_ConfigPin(&amp;amp;adcpinsel);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ADC_Init(LPC_ADC,200000);&lt;BR /&gt;&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN1,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN0,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN2,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN3,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN4,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN5,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN6,DISABLE);&lt;BR /&gt;ADC_IntConfig(LPC_ADC,ADC_ADINTEN7,DISABLE);&lt;BR /&gt;//ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_1,ENABLE);&lt;BR /&gt;//ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_0,ENABLE);&lt;BR /&gt;//ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_2,ENABLE);&lt;BR /&gt;//ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_3,ENABLE);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;//NVIC_SetPriority(ADC_IRQn,NVIC_EncodePriority(0x07,0,1)); &lt;BR /&gt;//NVIC_EnableIRQ(ADC_IRQn);&lt;/P&gt;
&lt;P&gt;............&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;uint16_t HW_ADC_Read(uint8_t channel_num)&lt;BR /&gt;{&lt;BR /&gt;uint16_t voltage;&lt;BR /&gt;//disable all channels&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_0,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_1,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_2,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_3,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_4,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_5,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_6,DISABLE);&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_7,DISABLE);&lt;BR /&gt;//enable the sampled channel&lt;BR /&gt;ADC_ChannelCmd(LPC_ADC,1&amp;lt;&amp;lt;channel_num,ENABLE);&lt;BR /&gt;ADC_StartCmd(LPC_ADC,ADC_START_NOW);&lt;BR /&gt;while(ADC_ChannelGetStatus(LPC_ADC,1&amp;lt;&amp;lt;channel_num,ADC_DATA_DONE)==0) {}&lt;BR /&gt;voltage=ADC_ChannelGetData(LPC_ADC,1&amp;lt;&amp;lt;channel_num);&lt;BR /&gt;return voltage;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 14:31:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458263#M48763</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-05-15T14:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458265#M48764</link>
      <description>&lt;P&gt;Hi, thank you very much for your recommendation. I'll try what you said and compile the code. Hope it helps. Interesting, haven't heard anything about lpcopen&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 17:59:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1458265#M48764</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-15T17:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple adc channel interrupt problem, LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1461933#M48853</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/26034"&gt;@xiangjun_rong&lt;/a&gt;&amp;nbsp;&amp;nbsp;Hi, I tried what you recommended now it works with 3 channels only. The moment I add adc0[3] the previous problem appears.It seems like the code is stuck at&amp;nbsp;while(ADC_ChannelGetStatus(LPC_ADC,1&amp;lt;&amp;lt;channel_num,ADC_DATA_DONE)==0) {}. I've also noticed that the problem is with ADC0[3] and not the number of channels, since when I use this channel only the code gets stuck, whereas when channels 0,1,2 can work together without any problem when channel 3 isn't enabled.&amp;nbsp; I made the changes and added my code here again. I was wondering if you help me solve this problem&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 07:30:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Multiple-adc-channel-interrupt-problem-LPC1768/m-p/1461933#M48853</guid>
      <dc:creator>Alexshea</dc:creator>
      <dc:date>2022-05-22T07:30:41Z</dc:date>
    </item>
  </channel>
</rss>

