<?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のトピックHow do i make a simple AD conversion with the LPC822?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-do-i-make-a-simple-AD-conversion-with-the-LPC822/m-p/561781#M16347</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ledi007 on Wed Apr 13 02:32:32 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am a newbie to programm the nxp controller and i am struggling with the ADC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i want to do is a simple AD conversion (e.g. every 100ms) on ADC_2 (PIO0_14) in the while loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I dont want to use the LPCOPEN libraries!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the LPC82x user manual is this described as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"To perform a single ADC conversion for ADC0 channel 1 using the analog signal on pin ADC_1, follow these steps":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Enable the analog function ADC_1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Configure the system clock to be 25 MHz and select a CLKDIV value of 0 for a sampling rate of 1 Msamples/s using the ADC CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Select ADC channel 1 to perform the conversion by setting the CHANNELS bits to 0x2 in the SEQA_CTL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Set the TRIGPOL bit to 1 and the SEQA_ENA bit to 1 in the SEQA_CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Set the START bit to 1 in the SEQA_CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Read the RESULT bits in the DAT1 register for the conversion result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i have right now is that code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
int main(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; SystemCoreClockUpdate();// Read clock settings and update SystemCoreClock variable

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(1&amp;lt;&amp;lt;4);//power the ADC
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL&amp;nbsp;&amp;nbsp; |= (1&amp;lt;&amp;lt;24);&amp;nbsp;&amp;nbsp;&amp;nbsp; //enable clock for ADC

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Need to do a calibration after initialization and trim */
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_StartCalibration(LPC_ADC);
&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {}

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SWM_EnableFixedPin(SWM_FIXED_ADC2);

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_IOCON-&amp;gt;PIO0[IOCON_PIO14] |= (1&amp;lt;&amp;lt;1);//set to ADC mode for pin PIO0_14 (ADC_2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_ADC-&amp;gt;SEQ_CTRL[ADC_SEQA_IDX] |= 0x4;//Select ADC CH2 (Bit 3) to perform the conversion&amp;nbsp; in the SEQA_CTL register.

&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 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;Can somebody help me, whith the next steps?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can somebode post an simple example?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:03:30 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:03:30Z</dc:date>
    <item>
      <title>How do i make a simple AD conversion with the LPC822?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-do-i-make-a-simple-AD-conversion-with-the-LPC822/m-p/561781#M16347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ledi007 on Wed Apr 13 02:32:32 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am a newbie to programm the nxp controller and i am struggling with the ADC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i want to do is a simple AD conversion (e.g. every 100ms) on ADC_2 (PIO0_14) in the while loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I dont want to use the LPCOPEN libraries!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the LPC82x user manual is this described as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"To perform a single ADC conversion for ADC0 channel 1 using the analog signal on pin ADC_1, follow these steps":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Enable the analog function ADC_1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Configure the system clock to be 25 MHz and select a CLKDIV value of 0 for a sampling rate of 1 Msamples/s using the ADC CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Select ADC channel 1 to perform the conversion by setting the CHANNELS bits to 0x2 in the SEQA_CTL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Set the TRIGPOL bit to 1 and the SEQA_ENA bit to 1 in the SEQA_CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Set the START bit to 1 in the SEQA_CTRL register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Read the RESULT bits in the DAT1 register for the conversion result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What i have right now is that code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
int main(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; SystemCoreClockUpdate();// Read clock settings and update SystemCoreClock variable

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;PDRUNCFG &amp;amp;= ~(1&amp;lt;&amp;lt;4);//power the ADC
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL&amp;nbsp;&amp;nbsp; |= (1&amp;lt;&amp;lt;24);&amp;nbsp;&amp;nbsp;&amp;nbsp; //enable clock for ADC

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Need to do a calibration after initialization and trim */
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_ADC_StartCalibration(LPC_ADC);
&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {}

&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SWM_EnableFixedPin(SWM_FIXED_ADC2);

&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_IOCON-&amp;gt;PIO0[IOCON_PIO14] |= (1&amp;lt;&amp;lt;1);//set to ADC mode for pin PIO0_14 (ADC_2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_ADC-&amp;gt;SEQ_CTRL[ADC_SEQA_IDX] |= 0x4;//Select ADC CH2 (Bit 3) to perform the conversion&amp;nbsp; in the SEQA_CTL register.

&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 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;Can somebody help me, whith the next steps?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can somebode post an simple example?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:03:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-do-i-make-a-simple-AD-conversion-with-the-LPC822/m-p/561781#M16347</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do i make a simple AD conversion with the LPC822?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-do-i-make-a-simple-AD-conversion-with-the-LPC822/m-p/561782#M16348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;bump&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 01:08:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-do-i-make-a-simple-AD-conversion-with-the-LPC822/m-p/561782#M16348</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-19T01:08:06Z</dc:date>
    </item>
  </channel>
</rss>

