<?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 Pulse Accumulator interrupt when the pulse count reaches x in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259459#M9766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Im using mc9s12p128 and im tryinng to count the pulses from PT7 until it reachhes a &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;value and calls an interrupt. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-Im using PT7 as PACLK (timer clock) and counting the signal &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;but im not sure where the compare is done or where i should &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;store the values for compairing. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-is it possible to use other timer channels to compare more than a &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;value with the timerCounter(while getting the timerClock from &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;PT7)? Example: Interrupt occurs when the value x is reached and y is reached.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-Does using PT7 as timer clock effects anything except timer? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;(maybe ISR?) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Could you send an example code of initialisation for something like this. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Thank you. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jan 2014 11:29:27 GMT</pubDate>
    <dc:creator>yücekürüm</dc:creator>
    <dc:date>2014-01-27T11:29:27Z</dc:date>
    <item>
      <title>Pulse Accumulator interrupt when the pulse count reaches x</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259459#M9766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Im using mc9s12p128 and im tryinng to count the pulses from PT7 until it reachhes a &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;value and calls an interrupt. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-Im using PT7 as PACLK (timer clock) and counting the signal &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;but im not sure where the compare is done or where i should &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;store the values for compairing. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-is it possible to use other timer channels to compare more than a &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;value with the timerCounter(while getting the timerClock from &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;PT7)? Example: Interrupt occurs when the value x is reached and y is reached.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;-Does using PT7 as timer clock effects anything except timer? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;(maybe ISR?) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Could you send an example code of initialisation for something like this. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: #f5f5f5;"&gt;Thank you. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jan 2014 11:29:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259459#M9766</guid>
      <dc:creator>yücekürüm</dc:creator>
      <dc:date>2014-01-27T11:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse Accumulator interrupt when the pulse count reaches x</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259460#M9767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's no pulse accumulator counter compare function. You have only two interrupts associated with pulse counter: pulse accumulator input interrupt (PAI) and pulse counter overflow interrupt (PAOVI). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jan 2014 14:38:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259460#M9767</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2014-01-27T14:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse Accumulator interrupt when the pulse count reaches x</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259461#M9768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pulse accumulator can be set to the Event counter mode which allows incrementing the PACNT by a count each time there is pulse on IOC7 pin (falling/rising edge; see Table 14-17. PACTL Field Descriptions in the S12P RM).&lt;/P&gt;&lt;P&gt;So you can use this to read and store the PACNT value and then compare it with desired one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An other solution could be IRQ input pin. If the frequency of pulses on the input pin is not so high, you can use simple code to count the number of pulses on the input.&lt;/P&gt;&lt;P&gt;Define global variable and give it a value of pulse number you expect e.g. i=127;&lt;/P&gt;&lt;P&gt;Then define the IRQ interrupt routine which is called each time there is a pulse on the IRQ pin.&lt;/P&gt;&lt;P&gt;In the IRQ_ISR, you should compare and decrement the 'i' value (i&amp;lt;1, --i) and do this until it reaches zero. And here you should do what you want.&lt;/P&gt;&lt;P&gt;I've tested this on S12P demo board and it works fine. The SW sample code will be posted soon.&lt;/P&gt;&lt;P&gt;Actually, this solution can be implemented on IOC7 with PAIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw, your last question is not so clear. PT7 is the port which can be used as GPIO. But timer if enabled has higher priority over GPIO function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Ivan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 16:36:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259461#M9768</guid>
      <dc:creator>iggi</dc:creator>
      <dc:date>2014-02-03T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse Accumulator interrupt when the pulse count reaches x</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259462#M9769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input signal may be as high as 1KHz so i was thinking of letting the accumulater do the job but it seems like im gonna have to find another way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My last question is answered. i was wondering, if using the accumulator would prevent the other timer interrupts and it does not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Yüce&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 11:21:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259462#M9769</guid>
      <dc:creator>yücekürüm</dc:creator>
      <dc:date>2014-02-04T11:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse Accumulator interrupt when the pulse count reaches x</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259463#M9770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1kHz is pretty low interrupt frequency. At max 32MHz bus clock you have 32M/1k = 32000 bus cycles for one pulse. Interrupt entry + interrupt exit + counter increment + counter compare needs about 30 bus cycles only. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 11:42:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Pulse-Accumulator-interrupt-when-the-pulse-count-reaches-x/m-p/259463#M9770</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2014-02-04T11:42:44Z</dc:date>
    </item>
  </channel>
</rss>

