<?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 Re: lpc used as comparator in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554859#M13409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Mon Aug 27 10:59:02 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: CroesJeroen&lt;/STRONG&gt;&lt;BR /&gt;... I know it has to be binairy...&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But your compiler doesn't :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10000 = 10000 :confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Use binary notation for binary values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0b10000 = 16 = 0x10&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:10:23 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:10:23Z</dc:date>
    <item>
      <title>lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554856#M13406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Mon Aug 27 04:03:54 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello sir/madam. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to use a input (gpio) as input for the comparator0 (+ input) and the - input of the comparator0 from the voltage divider ( set to Vdd/2). So the output of the comp go's high if I apply a voltage higher than vdd/2 and an interrupt is thrown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The output of the comparator is always high even when no voltage is applied at the + input. The used microcontroller = LPC1227.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the 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;
compare.h
#define PullUpDis&amp;nbsp; (1&amp;lt;&amp;lt;4) // default enabled
#define AnalogMode&amp;nbsp; (1&amp;lt;&amp;lt;7) // enable analog mode

#defineGPIO0_Clock&amp;nbsp; (1&amp;lt;&amp;lt;31)
#define Compare_CLK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1&amp;lt;&amp;lt;20)// enable clock for comparator module
#define PowerCMP&amp;nbsp;&amp;nbsp; ((1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;15))// enable BOD en Comparator module in PDRUNCFG

#define CMP0_EN (1)// enable comparator module 0

#define CMPIEV (1&amp;lt;&amp;lt;3)// activate interrupt on rising edge
#define ACMP0_I0 (1&amp;lt;&amp;lt;8)// use ACMP0_O input

#define INTCOMPCLR (1&amp;lt;&amp;lt;20)// bit to reset the interrupt status
#defineCMP0STAT (1&amp;lt;&amp;lt;21)//interrupt status of the comparator 0
#defineCMP1STAT (1&amp;lt;&amp;lt;22)//interrupt status of the comparator 1

#defineVLADEN (1)// enable ladder module ( 32 levels, 0 to 3V3)
#define VSEL (10000&amp;lt;&amp;lt;1)

#define VLADVDDREF (1&amp;lt;&amp;lt;6)// use internal 3V3 voltage to take a level from


compare.c

void InitCMP(void){ 

LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL|=Compare_CLK; 
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL|=GPIO0_Clock; 
LPC_IOCON-&amp;gt;PIO0_19|=0x2; // select as input for comparator(ACMP0_O) 
LPC_IOCON-&amp;gt;PIO0_19&amp;amp;=(~PullUpDis);//disable pullup 
LPC_IOCON-&amp;gt;PIO0_19&amp;amp;=(~AnalogMode);//enable analog mode 
LPC_SYSCON-&amp;gt;PDRUNCFG&amp;amp;=(~PowerCMP); // power the comparator module 
LPC_ACOMP-&amp;gt;VLAD|=(VLADEN|VSEL|VLADVDDREF); // enable voltage ladder, select reference 3.3V, set voltage to 1.66V 
LPC_ACOMP-&amp;gt;CMP|=(CMP0_EN|CMPIEV|ACMP0_I0|INTCOMPCLR); // enable comparator, use rising edge, positieve input opamp = input ACMP0_I0 , negative = voltage ladder 

//NVIC_ClearPendingIRQ(CMP_IRQn); 
NVIC_EnableIRQ(CMP_IRQn); 
} 

void COMP_IRQHandler(void){ 

uint8_t dummy=0; 
LPC_ACOMP-&amp;gt;CMP|=INTCOMPCLR; 

} 

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully you guys can point me out why the output of comparator 0 is high even when no voltage is applied to the input and also when a voltage is applied, the interrupt doesnt hit..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554856#M13406</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554857#M13407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Mon Aug 27 08:19:39 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define VSEL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (10000&amp;lt;&amp;lt;1)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should be binary not 10,000 decimal.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554857#M13407</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554858#M13408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Mon Aug 27 10:38:33 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: graynomad&lt;/STRONG&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define VSEL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (10000&amp;lt;&amp;lt;1)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;This should be binary not 10,000 decimal.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello graynomad, I know it has to be binairy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just set the MSBit high so I would have Vdd/2. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0000 = VSS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0001 = 1 * Vref/31&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0010 = 2 * Vref/31&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11111 = Vref&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10000=16*Vref/31 ~ Vref/2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for reply!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554858#M13408</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554859#M13409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Mon Aug 27 10:59:02 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: CroesJeroen&lt;/STRONG&gt;&lt;BR /&gt;... I know it has to be binairy...&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But your compiler doesn't :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10000 = 10000 :confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Use binary notation for binary values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0b10000 = 16 = 0x10&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554859#M13409</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554860#M13410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Mon Aug 27 11:09:52 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Zero&lt;/STRONG&gt;&lt;BR /&gt;But your compiler doesn't :)&lt;BR /&gt;&lt;BR /&gt;10000 = 10000 :confused:&lt;BR /&gt;&lt;BR /&gt;Use binary notation for binary values:&lt;BR /&gt;&lt;BR /&gt;0b10000 = 16 = 0x10&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, thanks for the remark.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's strange because I debugged it and it states that the value 10000 ( binairy) is in the vsel register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;[IMG]&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fi50.tinypic.com%2Fnmyf87.jpg%5B%2FIMG%5D" rel="nofollow" target="_blank"&gt;http://i50.tinypic.com/nmyf87.jpg[/IMG]&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554860#M13410</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554861#M13411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Mon Aug 27 11:23:41 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What's strange there :confused::confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10000&amp;nbsp; &amp;lt;&amp;lt; 1&amp;nbsp; =&amp;nbsp; 10000 * 2 = 20000 = 0b100111000[COLOR=Red]10000[/COLOR]0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now cut out bit 1..5 and voila: 0b10000 :eek:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554861#M13411</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554862#M13412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Mon Aug 27 12:19:39 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Zero&lt;/STRONG&gt;&lt;BR /&gt;What's strange there :confused::confused:&lt;BR /&gt;&lt;BR /&gt;10000&amp;nbsp; &amp;lt;&amp;lt; 1&amp;nbsp; =&amp;nbsp; 10000 * 2 = 20000 = 0b100111000[COLOR=Red]10000[/COLOR]0&lt;BR /&gt;&lt;BR /&gt;Now cut out bit 1..5 and voila: 0b10000 :eek:&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OK thanks, I see what you mean. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Changed it to : &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;#define VSEL (0x10&amp;lt;&amp;lt;1)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But still it doesn't work properly. The output of the comparator is set high even when no voltage is applied. So the + input of the comparator ( pin from the GPIO) is also 0.8V when no voltage is applied. The - input for the comp comes from the voltage ladder. As in the picture below the COMP0STAT bit is high, states that + input&amp;gt; - input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;[img]&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fi49.tinypic.com%2F15pq55g.jpg%5B%2Fimg%5D" rel="nofollow noopener noreferrer" target="_blank"&gt;http://i49.tinypic.com/15pq55g.jpg[/img]&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Someone has an idea??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554862#M13412</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554863#M13413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Mon Aug 27 17:57:09 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;The output of the comparator is set high even when no voltage is applied.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Meaning that the input is floating? Have you tried forcing it to VCC and GND?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't see where you set the comparator's output pin (PIO0:27) as an output, is that required?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554863#M13413</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554864#M13414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Tue Aug 28 10:48:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: graynomad&lt;/STRONG&gt;&lt;BR /&gt;Meaning that the input is floating? Have you tried forcing it to VCC and GND?&lt;BR /&gt;&lt;BR /&gt;I don't see where you set the comparator's output pin (PIO0:27) as an output, is that required?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Indeed I don't set PIO0:27 as an output, because I don't want to use that output. I want to use that pin for other purposes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok now, so when I start and attach the input to GND, the interrupthandler isn't thrown, than I unleash it ( floating input), it hits the handler, than I apply the Vdd and it gets hit again, so thats works. Also the output of the comp is zero when 0V is applied and 1 when Vdd is applied.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I'm facing some little problem now : &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;[IMG]&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fi46.tinypic.com%2F2wftsa8.jpg%5B%2FIMG%5D" rel="nofollow noopener noreferrer" target="_blank"&gt;http://i46.tinypic.com/2wftsa8.jpg[/IMG]&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;why the bit INTCLR ( 20) is not set but bit 23 is set instead???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried to change the instruction into :&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;
LPC_ACOMP-&amp;gt;LPC_ACOMP-&amp;gt;CMP+INTCOMPCLR;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully someone knows whats going on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554864#M13414</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554865#M13415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Wed Aug 29 07:39:05 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Hopefully someone knows whats going on.&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;Not me, bit 23 isn't even a valid bit.:confused:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just to prove there's nothing screwy with the define I'd try using (1&amp;lt;&amp;lt;20) directly, but I can't see that making a difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554865#M13415</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554866#M13416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_Europe on Wed Aug 29 15:18:15 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Jeroen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;did you read out the content of address 0x40044008 after initCMP?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;[LEFT][FONT=Arial][COLOR=#005042][B][FONT=Arial][COLOR=#005042]Table 63. PIO0_19 register (PIO0_19, address 0x4004 4008) bit description[/COLOR][/FONT][/B][/COLOR][/FONT][/LEFT]&lt;BR /&gt;[FONT=Arial]&lt;BR /&gt;[LEFT][FONT=Arial][COLOR=#005042][B][COLOR=#005042][FONT=Arial][SIZE=1][FONT=Arial][SIZE=1]2:0 FUNC Selects pin function. 000[/SIZE][/FONT][/SIZE][/FONT][/COLOR][/B][/LEFT]&lt;BR /&gt; &lt;BR /&gt;[LEFT][SIZE=1][FONT=Arial][B][SIZE=1][FONT=Arial][COLOR=#005042]0x0 Selects function PIO0_19.[/COLOR][/FONT][/SIZE][/B][/FONT][/SIZE][SIZE=1][FONT=Arial]&lt;BR /&gt;[B][SIZE=1][FONT=Arial][COLOR=#005042]0x1 Reserved. Do not use.[/COLOR][/FONT][/SIZE][/B]&lt;BR /&gt;[B][SIZE=1][FONT=Arial][COLOR=#005042]0x2 Select function ACMP0_I0.[/COLOR][/FONT][/SIZE][/B]&lt;BR /&gt;[B][SIZE=1][FONT=Arial][COLOR=#005042]0x3 Select function CT32B0_CAP1.[/COLOR][/FONT][/SIZE][/B]&lt;BR /&gt;[B][SIZE=1][FONT=Arial][COLOR=#005042]0x4 Select function CT32B0_MAT1.[/COLOR][/FONT][/SIZE][/B][/LEFT]&lt;BR /&gt;[/FONT][/SIZE][/COLOR][/FONT][/FONT]&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554866#M13416</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554867#M13417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Thu Aug 30 06:29:11 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: NXP_Europe&lt;/STRONG&gt;&lt;BR /&gt;Hello Jeroen,&lt;BR /&gt; &lt;BR /&gt;did you read out the content of address 0x40044008 after initCMP?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Offcourse here you are : [img]&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fi47.tinypic.com%2F2lwoeva.jpg%5B%2Fimg%5D" rel="nofollow" target="_blank"&gt;http://i47.tinypic.com/2lwoeva.jpg[/img]&lt;/A&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554867#M13417</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554868#M13418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CroesJeroen on Thu Aug 30 07:07:41 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: graynomad&lt;/STRONG&gt;&lt;BR /&gt;Not me, bit 23 isn't even a valid bit.:confused:&lt;BR /&gt;&lt;BR /&gt;Just to prove there's nothing screwy with the define I'd try using (1&amp;lt;&amp;lt;20) directly, but I can't see that making a difference.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;swapped it with &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;LPC_ACOMP-&amp;gt;CMP|=(1&amp;lt;&amp;lt;20);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;. No improvements.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yea indeed, the bit isnt even valid.. . Well here is something I tested :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Start lpc with input (0.19) to gnd, interrupthandler isn't invoked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Start lpc with input (0.19) to vdd, interrupthandler is&amp;nbsp; invoked. After executing the interrupt clear,the interrupthandler isn't invoked any more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Start lpc with input (0.19) to vdd, interrupthandler is&amp;nbsp; invoked. Now the instruction to clear the interruptflag is removed and the interrupthandler is still invoked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I think that we wont see bit 20 go high but it works, clearing the interruptflag for the comparator.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554868#M13418</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: lpc used as comparator</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554869#M13419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_Europe on Fri Aug 31 04:56:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Jeroen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;did you look at the Keil example?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an output-interrupt and an output-polling version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;see our website: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://www.lpcware.com/content/nxpfile/lpc12xx-cmsis-driver-library-keil&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:10:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/lpc-used-as-comparator/m-p/554869#M13419</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:10:29Z</dc:date>
    </item>
  </channel>
</rss>

