<?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>Classic/Legacy CodeWarriorのトピックADLSTAT REGISTER / High Limit Interrupt Help Please!</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/ADLSTAT-REGISTER-High-Limit-Interrupt-Help-Please/m-p/217794#M6252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have a MC56F83XX board and upon reading the manual I come up with this paragraph.&lt;/P&gt;&lt;P&gt;&amp;amp;quote;2.12.7 ADC Limit Status Register (ADLSTAT)&lt;/P&gt;&lt;P align="left"&gt;The Limit Status register latches in the result of the comparison between the result of the sample&lt;/P&gt;&lt;P align="left"&gt;and the respective limit register, ADHLMT0-7 and ADLLMT0-7. For an example, if the result&lt;/P&gt;&lt;P align="left"&gt;for the channel programmed in SAMPLE0 is greater than the value programmed into the High&lt;/P&gt;&lt;P align="left"&gt;Limit register zero, then the HLS0 bit is set to one. An interrupt is generated if the HLMTIE bit is&lt;/P&gt;&lt;P align="left"&gt;set in ADCR1. A bit may only be cleared by writing 1 to that specific bit. These bits are sticky.&lt;/P&gt;&lt;P align="left"&gt;Once set, the bits require a specific modification to clear them. They are not cleared&lt;/P&gt;&lt;P&gt;automatically by subsequent conversions."&lt;/P&gt;&lt;P&gt;I am not sure I understand this correctly. If I am trying to see if a bit that has triggered the high limit interrupt would this be the correct code? Obviously this code is just an example and the if logic is not conclusive. I have tried to look up other peoples code but haven't found any, the only thing I have found is Init code and I have seen people setting the ADLSTAT to FFFF, which seems to be the opposite of what I am doing. Any input is greatly appreciated. Thanks!&lt;/P&gt;&lt;P&gt;register word LimitStatusTmp; //Word that holds value of data&lt;/P&gt;&lt;P&gt;int Values[8]; AD1_GetValue((int *) Values); LimitStatusTmp = getReg(ADCA_ADLSTAT);&lt;/P&gt;&lt;P&gt;int Curr_High_A&lt;/P&gt;&lt;P&gt;int bit; //flag variable to set high bit number if (LimitStatusTmp &amp;amp; 0x0100) { bit = 8; } Curr_High_A = Values[bit-8]; clrRegBits(ADCA_ADCR1,0x0080);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jun 2011 23:02:19 GMT</pubDate>
    <dc:creator>Myles</dc:creator>
    <dc:date>2011-06-27T23:02:19Z</dc:date>
    <item>
      <title>ADLSTAT REGISTER / High Limit Interrupt Help Please!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/ADLSTAT-REGISTER-High-Limit-Interrupt-Help-Please/m-p/217794#M6252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have a MC56F83XX board and upon reading the manual I come up with this paragraph.&lt;/P&gt;&lt;P&gt;&amp;amp;quote;2.12.7 ADC Limit Status Register (ADLSTAT)&lt;/P&gt;&lt;P align="left"&gt;The Limit Status register latches in the result of the comparison between the result of the sample&lt;/P&gt;&lt;P align="left"&gt;and the respective limit register, ADHLMT0-7 and ADLLMT0-7. For an example, if the result&lt;/P&gt;&lt;P align="left"&gt;for the channel programmed in SAMPLE0 is greater than the value programmed into the High&lt;/P&gt;&lt;P align="left"&gt;Limit register zero, then the HLS0 bit is set to one. An interrupt is generated if the HLMTIE bit is&lt;/P&gt;&lt;P align="left"&gt;set in ADCR1. A bit may only be cleared by writing 1 to that specific bit. These bits are sticky.&lt;/P&gt;&lt;P align="left"&gt;Once set, the bits require a specific modification to clear them. They are not cleared&lt;/P&gt;&lt;P&gt;automatically by subsequent conversions."&lt;/P&gt;&lt;P&gt;I am not sure I understand this correctly. If I am trying to see if a bit that has triggered the high limit interrupt would this be the correct code? Obviously this code is just an example and the if logic is not conclusive. I have tried to look up other peoples code but haven't found any, the only thing I have found is Init code and I have seen people setting the ADLSTAT to FFFF, which seems to be the opposite of what I am doing. Any input is greatly appreciated. Thanks!&lt;/P&gt;&lt;P&gt;register word LimitStatusTmp; //Word that holds value of data&lt;/P&gt;&lt;P&gt;int Values[8]; AD1_GetValue((int *) Values); LimitStatusTmp = getReg(ADCA_ADLSTAT);&lt;/P&gt;&lt;P&gt;int Curr_High_A&lt;/P&gt;&lt;P&gt;int bit; //flag variable to set high bit number if (LimitStatusTmp &amp;amp; 0x0100) { bit = 8; } Curr_High_A = Values[bit-8]; clrRegBits(ADCA_ADCR1,0x0080);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2011 23:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/ADLSTAT-REGISTER-High-Limit-Interrupt-Help-Please/m-p/217794#M6252</guid>
      <dc:creator>Myles</dc:creator>
      <dc:date>2011-06-27T23:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: ADLSTAT REGISTER / High Limit Interrupt Help Please!</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/ADLSTAT-REGISTER-High-Limit-Interrupt-Help-Please/m-p/217795#M6253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Zero Crossing, Low Limit, and High Limit Interrupt share one interrupt vector -&amp;nbsp; ADC_ERR_INT. So if you enable this interrupts&amp;nbsp; via ADCTL1 register (setting 1 in ZCIE, LLMTIE, HLMTIE bits) only one interrupt will occur. Interrupts will be generated if any HLSx, LLSx, ZCSx bits set (ADLSTAT, ADZCSTAT registers) and&amp;nbsp; ADC_ERR_INT-interrupt enabled.&lt;BR /&gt;But to clear HLSx, LLSx, ZCSx bits you need to write 1 in this bits. So your interrupt handlier&amp;nbsp; should be like this&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;#pragma interrupt alignsp saveallvoid ADC1_InterruptERR(void){  register word LimitStatusTmp;  register word ZeroStatusTmp;  word timeR, time;  int val;    LimitStatusTmp = getReg(ADCA_ADLSTAT);  ZeroStatusTmp = getReg(ADCA_ADZCSTAT);  setReg(ADCA_ADLSTAT,65535);          /* Clear limit status flags */  setReg(ADCA_ADZCSTAT,255);           /* Clear Zero crossing status flags */// another actions}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;If you want to disable High Limit, Low Limit and Zero Crossing interrupts you need to use&lt;/P&gt;&lt;PRE&gt;clrRegBits(ADCA_ADCR1,0x0100); // for high limitclrRegBits(ADCA_ADCR1,0x0200); // for low limitclrRegBits(ADCA_ADCR1,0x0400); // for zero crossing&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But if you disable them - interrupt does not generate next time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2011 20:34:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/ADLSTAT-REGISTER-High-Limit-Interrupt-Help-Please/m-p/217795#M6253</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2011-07-12T20:34:40Z</dc:date>
    </item>
  </channel>
</rss>

