<?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のトピックLPC11C24 ADC channels 5-7 not working</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539758#M11934</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by over9k on Fri Aug 28 08:29:43 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am writing a program for LPCXpresso LPC11C24 that uses ADC to measure 3 voltages. I want to use ADC channels 2, 3, 7. But channels 0-4 work properly while 5-7 behave in a weird way. Here are the results I get:&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;
Chan | GND | 3,3V | Not Connected
0-4&amp;nbsp; |&amp;nbsp; 0&amp;nbsp; | 1023 | ~200
5-7&amp;nbsp; |&amp;nbsp; 0&amp;nbsp; | ~5&amp;nbsp;&amp;nbsp; | 0
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And I checked with an oscilloscope, the voltage is really 3,3V there when I measure it, so there is no unexpected drain during measurement. I also have the same problem with one other board, so it's unlikely to be a manufacturing error. I looked at the documentation and there was no hint about why channels 5-7 would be different from 0-4, but maybe I missed something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I doing something wrong? How do I make it work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code (I'm using &lt;/SPAN&gt;&lt;A href="http://http://www.lpcware.com/system/files/lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11c24.zip" rel="nofollow noopener noreferrer" target="_blank"&gt;LPCOpen libraries&lt;/A&gt;&lt;SPAN&gt;&lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&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;

#include "board.h"

#include &amp;lt;cr_section_macros.h&amp;gt;

#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

static ADC_CLOCK_SETUP_T ADCSetup;
Status status;

int adc(char *param1){
uint8_t channel;
uint16_t dataADC = 0;

if(strcmp("2", param1) == 0){
channel = ADC_CH2;
}else if(strcmp("3", param1) == 0){
channel = ADC_CH3;
}else if(strcmp("7", param1) == 0){
channel = ADC_CH7;
}

Chip_ADC_EnableChannel(LPC_ADC, channel, ENABLE);

Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

/* Waiting for A/D conversion complete or timeout */
for (int i = 0; i &amp;lt; 500000; i++) {
if (Chip_ADC_ReadStatus(LPC_ADC, channel, ADC_DR_DONE_STAT) == SET) {
break;
}
}

status = Chip_ADC_ReadValue(LPC_ADC, channel, &amp;amp;dataADC);

Chip_ADC_EnableChannel(LPC_ADC, channel, DISABLE);

return (int)dataADC;
}

int main(void) {

SystemCoreClockUpdate();
Board_Init();

//Configuring ADC pins.
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_1, FUNC2); //ADC2
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_2, FUNC2); //ADC3
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_11, FUNC2); //ADC7

/* ADC Init */
Chip_ADC_Init(LPC_ADC, &amp;amp;ADCSetup);

int measurement2, measurement3, measurement7;
while(1){
measurement2 = adc("2"); //1023 at 3,3V, around 200 when not connected, 0 when connected to GND.
measurement3 = adc("3"); //1023 at 3,3V, around 200 when not connected, 0 when connected to GND.
measurement7 = adc("7"); //between 4 and 6 at 3,3V, 0 when not connected, 0 when connected to GND.
}//Debug breakpoint here to read the values.

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>Wed, 15 Jun 2016 19:40:30 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:40:30Z</dc:date>
    <item>
      <title>LPC11C24 ADC channels 5-7 not working</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539758#M11934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by over9k on Fri Aug 28 08:29:43 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am writing a program for LPCXpresso LPC11C24 that uses ADC to measure 3 voltages. I want to use ADC channels 2, 3, 7. But channels 0-4 work properly while 5-7 behave in a weird way. Here are the results I get:&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;
Chan | GND | 3,3V | Not Connected
0-4&amp;nbsp; |&amp;nbsp; 0&amp;nbsp; | 1023 | ~200
5-7&amp;nbsp; |&amp;nbsp; 0&amp;nbsp; | ~5&amp;nbsp;&amp;nbsp; | 0
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And I checked with an oscilloscope, the voltage is really 3,3V there when I measure it, so there is no unexpected drain during measurement. I also have the same problem with one other board, so it's unlikely to be a manufacturing error. I looked at the documentation and there was no hint about why channels 5-7 would be different from 0-4, but maybe I missed something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I doing something wrong? How do I make it work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code (I'm using &lt;/SPAN&gt;&lt;A href="http://http://www.lpcware.com/system/files/lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11c24.zip" rel="nofollow noopener noreferrer" target="_blank"&gt;LPCOpen libraries&lt;/A&gt;&lt;SPAN&gt;&lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&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;

#include "board.h"

#include &amp;lt;cr_section_macros.h&amp;gt;

#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

static ADC_CLOCK_SETUP_T ADCSetup;
Status status;

int adc(char *param1){
uint8_t channel;
uint16_t dataADC = 0;

if(strcmp("2", param1) == 0){
channel = ADC_CH2;
}else if(strcmp("3", param1) == 0){
channel = ADC_CH3;
}else if(strcmp("7", param1) == 0){
channel = ADC_CH7;
}

Chip_ADC_EnableChannel(LPC_ADC, channel, ENABLE);

Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

/* Waiting for A/D conversion complete or timeout */
for (int i = 0; i &amp;lt; 500000; i++) {
if (Chip_ADC_ReadStatus(LPC_ADC, channel, ADC_DR_DONE_STAT) == SET) {
break;
}
}

status = Chip_ADC_ReadValue(LPC_ADC, channel, &amp;amp;dataADC);

Chip_ADC_EnableChannel(LPC_ADC, channel, DISABLE);

return (int)dataADC;
}

int main(void) {

SystemCoreClockUpdate();
Board_Init();

//Configuring ADC pins.
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_1, FUNC2); //ADC2
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_2, FUNC2); //ADC3
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_11, FUNC2); //ADC7

/* ADC Init */
Chip_ADC_Init(LPC_ADC, &amp;amp;ADCSetup);

int measurement2, measurement3, measurement7;
while(1){
measurement2 = adc("2"); //1023 at 3,3V, around 200 when not connected, 0 when connected to GND.
measurement3 = adc("3"); //1023 at 3,3V, around 200 when not connected, 0 when connected to GND.
measurement7 = adc("7"); //between 4 and 6 at 3,3V, 0 when not connected, 0 when connected to GND.
}//Debug breakpoint here to read the values.

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>Wed, 15 Jun 2016 19:40:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539758#M11934</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11C24 ADC channels 5-7 not working</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539759#M11935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Aug 28 09:29:58 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: over9k&lt;/STRONG&gt;&lt;BR /&gt;...but maybe I missed something.&lt;BR /&gt;&lt;BR /&gt;Am I doing something wrong? How do I make it work?&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;
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_11, [color=#f00]FUNC2[/color]); //ADC7
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AD5-7 are FUNC1&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PIO1_11 FUNC2 is CT32B1_CAP1&amp;nbsp; :(( &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:40:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539759#M11935</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC11C24 ADC channels 5-7 not working</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539760#M11936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by over9k on Fri Aug 28 10:01:42 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you! You have no idea, how much time I wasted on that. I'll test it on Monday when I get back to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:40:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC11C24-ADC-channels-5-7-not-working/m-p/539760#M11936</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:40:32Z</dc:date>
    </item>
  </channel>
</rss>

