<?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のトピックRe: LPC1768  ADC0.4</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC0-4/m-p/984265#M38815</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and &lt;BR /&gt;the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I've attached an ADC demo project, please refer to it for details.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Nov 2019 03:15:11 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2019-11-29T03:15:11Z</dc:date>
    <item>
      <title>LPC1768  ADC0.4</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC0-4/m-p/984264#M38814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,i use the LPC1768 ,&lt;/P&gt;&lt;P&gt;when i use the ADC , i found a problem , i use all the 8 ch,&lt;/P&gt;&lt;P&gt;i use the same signal to test all the ch,&lt;/P&gt;&lt;P&gt;the ch0 ch1 ch2 ch3 ch5 ch6 is OK,but the ch4 have problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;it show&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/92879iFB11FE70770404E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;not a line ,and i use oscillscope &amp;nbsp;test &amp;nbsp;the &amp;nbsp;waveform ,it's ok ,not any problem.&lt;/P&gt;&lt;P&gt;this is my prj ,only the ch4 have problem !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/94182iBA52F5F2578129A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;void ADCInit( uint32_t ADC_Clk )&lt;BR /&gt;{&lt;BR /&gt; uint32_t i;&lt;/P&gt;&lt;P&gt;LPC_SC-&amp;gt;PCONP |= (0x1&amp;lt;&amp;lt;12); /* Ê¹ÄÜADCÊ±ÖÓ . */&lt;/P&gt;&lt;P&gt;for ( i = 0; i &amp;lt; ADC_NUM; i++ )&lt;BR /&gt; {&lt;BR /&gt; ADCValue[i] = 0x0;&lt;BR /&gt; }&lt;BR /&gt; /*&lt;BR /&gt; * ÅäÖÃADC¹Ü½Å&lt;BR /&gt; */&lt;BR /&gt; #if ADCCH0_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= ~(0X03&amp;lt;&amp;lt;14); //P0.23AD0.0&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= 0X01&amp;lt;&amp;lt;14;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0x01&amp;lt;&amp;lt;23);//ADC0.0&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH1_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= ~(0X03&amp;lt;&amp;lt;16); //P0.24ADC0.1&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= 0X01&amp;lt;&amp;lt;16;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0x01&amp;lt;&amp;lt;24);//ADC0.1&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH2_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= ~(0X03&amp;lt;&amp;lt;18); //P0.25ADC0.2&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= 0X01&amp;lt;&amp;lt;18;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0x01&amp;lt;&amp;lt;25);//ADC0.2&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH3_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= ~(0X03&amp;lt;&amp;lt;20); //P0.26ADC0.3&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= 0X01&amp;lt;&amp;lt;20;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0x01&amp;lt;&amp;lt;26);//ADC0.3&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH4_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL3 &amp;amp;=~(0x03&amp;lt;&amp;lt;28); //P1.30AD0.4&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL3 |=0x03&amp;lt;&amp;lt;28;&lt;BR /&gt; LPC_GPIO1-&amp;gt;FIODIR &amp;amp;=~(0x01&amp;lt;&amp;lt;30);//ADC0.4&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH5_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL3 &amp;amp;=~0xC0000000; //P1.31AD0.5&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL3 |=0xC0000000;&lt;BR /&gt; LPC_GPIO1-&amp;gt;FIODIR &amp;amp;=~0x80000000;//ADC0.5&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH6_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL0 &amp;amp;=~(0X03&amp;lt;&amp;lt;6); //P0.3--ADC0.6&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL0 |=0X01&amp;lt;&amp;lt;7;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0X01&amp;lt;&amp;lt;3);//ADC0.6&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if ADCCH7_EN&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL0 &amp;amp;=~(0X03&amp;lt;&amp;lt;4); //P0.2--ADC0.7&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL0 |=0X01&amp;lt;&amp;lt;5;&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;=~(0X01&amp;lt;&amp;lt;2);//ADC0.7&lt;BR /&gt; #endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;ADCR = ( 0x01 &amp;lt;&amp;lt; 0 ) | /* SEL=1,select channel 0~7 on ADC0 */&lt;BR /&gt; ((SystemFrequency/ADC_Clk-1)&amp;lt;&amp;lt;8) | /* CLKDIV = Fpclk / ADC_Clk - 1 */&lt;BR /&gt; ( 0 &amp;lt;&amp;lt; 16 ) | /* BURST = 0, Èí¼þ¿ØÖÆ×ª»» */&lt;BR /&gt; ( 1 &amp;lt;&amp;lt; 21 ) | /* PDN = 1, ´¦ÓëÕý³£Ä£Ê½ */&lt;BR /&gt; ( 0 &amp;lt;&amp;lt; 24 ) | /* START = 0 ²»Æô¶¯AD×ª»» */&lt;BR /&gt; ( 0 &amp;lt;&amp;lt; 27 ); /* EDGE = 0 ÉÏÉýÑØÆô¶¯ */&lt;/P&gt;&lt;P&gt;#if ADC_INTERRUPT_FLAG&lt;BR /&gt; NVIC_EnableIRQ(ADC_IRQn);&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;ADINTEN = 0xFF; /* Í¨µÀ0×ª»»½áÊø²úÉúÖÐ¶Ï */&lt;BR /&gt;#endif&lt;BR /&gt; return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t ADCRead( uint8_t channelNum )&lt;BR /&gt;{&lt;BR /&gt;#if !ADC_INTERRUPT_FLAG&lt;BR /&gt; uint32_t regVal, ADC_Data;&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;if ( channelNum &amp;gt;= ADC_NUM )&lt;BR /&gt; {&lt;BR /&gt; channelNum = 0; /* ÊäÈëchannelNum´óÓÚ8£¬ÔòÉèÖÃ¸Ã²ÎÊýÎª0 */&lt;BR /&gt; }&lt;BR /&gt; LPC_ADC-&amp;gt;ADCR &amp;amp;= 0xFFFFFF00;&lt;BR /&gt; LPC_ADC-&amp;gt;ADCR &amp;amp;=~(0x03&amp;lt;&amp;lt;25);&lt;BR /&gt; LPC_ADC-&amp;gt;ADCR |= (1 &amp;lt;&amp;lt; 24) | (1 &amp;lt;&amp;lt; channelNum);&lt;BR /&gt; /* Ñ¡Ôñ¶ÔÓ¦Í¨µÀÁ¢¼´Æô¶¯×ª»» */&lt;BR /&gt;#if !ADC_INTERRUPT_FLAG&lt;BR /&gt; while ( 1 ) /* µÈ´ýADC×ª»»Íê³É */&lt;BR /&gt; {&lt;BR /&gt; regVal = LPC_ADC-&amp;gt;DR[channelNum];&lt;BR /&gt; if ( regVal &amp;amp; ADC_DONE )&lt;BR /&gt; {&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;CR &amp;amp;= 0xF8FFFFFF; /* Í£Ö¹ADC */&lt;BR /&gt;/*&lt;BR /&gt; * Èç¹ûÃ»ÓÐ·¢Éúoverrun´íÎó£¬Ôò±£´æÊý¾Ý&lt;BR /&gt; */&lt;BR /&gt; if ( regVal &amp;amp; ADC_OVERRUN )&lt;BR /&gt; {&lt;BR /&gt; return ( 0 );&lt;BR /&gt; }&lt;BR /&gt;#if ADC_12BITS&lt;BR /&gt; ADC_Data = ( regVal &amp;gt;&amp;gt; 4 ) &amp;amp; 0xFFF;&lt;BR /&gt;#else&lt;BR /&gt; ADC_Data = ( regVal &amp;gt;&amp;gt; 6 ) &amp;amp; 0x3FF;&lt;BR /&gt;#endif&lt;BR /&gt; return ( ADC_Data ); /* ·µ»ØADC²ÉÑùÊý¾Ý */&lt;BR /&gt;#else&lt;BR /&gt; return ( channelNum );&lt;BR /&gt;#endif&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void ADC_WOrk(void)&lt;BR /&gt;{&lt;BR /&gt; unsigned int Ins_read=0,Ins_re=0;&lt;/P&gt;&lt;P&gt;ADCRead(0);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[0];&lt;BR /&gt; ADCDataInput[0] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[0] =1200-ADCDataInput[0];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(1);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[1];&lt;BR /&gt; ADCDataInput[1] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[1] =1200-ADCDataInput[1];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(2);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[2];&lt;BR /&gt; ADCDataInput[2] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[2] =1200-ADCDataInput[2];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(3);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[3];&lt;BR /&gt; ADCDataInput[3] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[3] =1200-ADCDataInput[3];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(4);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[4];&lt;BR /&gt; Ins_read =Ins_read*1320/4095;&lt;BR /&gt; //ADCDataInput[4] =1200-Ins_read;&lt;BR /&gt; Ins_re =1200-Ins_read;&lt;BR /&gt; ADCDataInput[4] =(Ins_re+ADCDataInput[4]*7)/8;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(5);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[5];&lt;BR /&gt; ADCDataInput[5] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[5] =1200-ADCDataInput[5];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADCRead(6);&lt;BR /&gt; while(!ADCIntDone);&lt;BR /&gt; ADCIntDone = 0;&lt;BR /&gt; Ins_read = ADCValue[6];&lt;BR /&gt; ADCDataInput[6] = Ins_read*1320/4095;&lt;BR /&gt; ADCDataInput[6] =1200-ADCDataInput[6];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2019 09:00:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC0-4/m-p/984264#M38814</guid>
      <dc:creator>oceansea</dc:creator>
      <dc:date>2019-11-28T09:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768  ADC0.4</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC0-4/m-p/984265#M38815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and &lt;BR /&gt;the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I've attached an ADC demo project, please refer to it for details.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Nov 2019 03:15:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC0-4/m-p/984265#M38815</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2019-11-29T03:15:11Z</dc:date>
    </item>
  </channel>
</rss>

