<?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>8-bit MicrocontrollersのトピックRe: Input Capture Clarification</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130253#M2390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello bigmac,&lt;BR /&gt;Thank you for your reply. As i've just started input capture, i'm trying to find out the period by subtracting the two consecutive raise times. The problem i face is that i don't know how to switch between the opeations for the first interrupt and the second interrupt. I've used the following logic... initialised a memory, rotated right through carry and then branced if carry clear to first raise where the value is incremented. to get you a clear picture of this i'll give the code i've tried. kindly give me your comments.&lt;BR /&gt;&lt;BR /&gt;data defn:&lt;BR /&gt;ORG $50&lt;BR /&gt;S1&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;S2&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;R1&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;DUMMY&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.B $0&lt;BR /&gt;&lt;BR /&gt;org $FFF6&lt;BR /&gt;FDB RAISE&lt;BR /&gt;&lt;BR /&gt;code:&lt;BR /&gt;mainLoop:&lt;BR /&gt;&lt;BR /&gt;MOV #$08 ,TPM1SC ;TOIE DISABLED, BUS CLK SELECTED ,NO PRESCALE&lt;BR /&gt;MOV #$44 ,TPM1C0SC ;INTERRUPT ENABLED, RAISING EDGE INPUT CAPTURE&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;feed_watchdog&lt;BR /&gt;BRA mainLoop&lt;BR /&gt;&lt;BR /&gt;RAISE LDHX TPM1C0V&lt;BR /&gt;ROR DUMMY&lt;BR /&gt;BCC FIRST&lt;BR /&gt;STHX S2&lt;BR /&gt;LDA S1+1&lt;BR /&gt;SUB S2+1&lt;BR /&gt;STA R1+1&lt;BR /&gt;LDA S1&lt;BR /&gt;SBC S2&lt;BR /&gt;STA R1&lt;BR /&gt;STOP&lt;BR /&gt;&lt;BR /&gt;FIRST: STHX S1&lt;BR /&gt;INC DUMMY&lt;BR /&gt;BRA mainLoop&lt;BR /&gt;&lt;BR /&gt;hope i'm clear for you.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Nandakumar.V&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Sep 2006 03:01:58 GMT</pubDate>
    <dc:creator>Nandav</dc:creator>
    <dc:date>2006-09-15T03:01:58Z</dc:date>
    <item>
      <title>Input Capture Clarification</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130251#M2388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm currently working on RG60 SLK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying input capture.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But i'm not able to get it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem i face is that i can't figure out how to code for capturing two consecutive raise for period calculation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if possible kindly provide me with an example code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2006 14:58:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130251#M2388</guid>
      <dc:creator>Nandav</dc:creator>
      <dc:date>2006-09-14T14:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Input Capture Clarification</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130252#M2389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Handav,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Period measurement using an input capture channel is relatively simple, provided the period you are trying to measure is always less than the timer overflow period.&amp;nbsp; It becomes considerably more complex if the measurement period can be greater than the overflow period, since you also need to take into account the number of timer overflows.&amp;nbsp; What is your requirement?&amp;nbsp; Another possibility is to measure the period of each cycle, and calculate the average period over a number of cycles, to reduce the affects of any jitter on the reading, or perhaps to increase resolution.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The frequencies you are attempting to measure should&amp;nbsp;be much less than the MCU bus frequency.&amp;nbsp;&lt;/FONT&gt; &lt;FONT size="2"&gt;You will need to utilise input capture interrupts, and the ISR processing period will need to be less than the minimum period to be measured.&amp;nbsp; Other interrupts may also delay input capture processing.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;For a basic measurement, the following steps would be required -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;1.&amp;nbsp; Initialise timer channel for input capture interrupt on positive edge.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;2.&amp;nbsp; First time ISR processing - read timer register and store the word value.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;3.&amp;nbsp; Second time ISR processing - read timer register, subtract previously stored value, store the result, flag a new reading, and possibly disable further input capture interrupts if only single period measurement.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;If the second timer register value is less than the first value, timer overflow has occurred between the two readings, and the result of the subtraction will need to be negated.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;These are some of the basic considerations for use of input capture.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2006-09-15&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;01:34 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2006 22:29:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130252#M2389</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-09-14T22:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Input Capture Clarification</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130253#M2390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello bigmac,&lt;BR /&gt;Thank you for your reply. As i've just started input capture, i'm trying to find out the period by subtracting the two consecutive raise times. The problem i face is that i don't know how to switch between the opeations for the first interrupt and the second interrupt. I've used the following logic... initialised a memory, rotated right through carry and then branced if carry clear to first raise where the value is incremented. to get you a clear picture of this i'll give the code i've tried. kindly give me your comments.&lt;BR /&gt;&lt;BR /&gt;data defn:&lt;BR /&gt;ORG $50&lt;BR /&gt;S1&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;S2&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;R1&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.W $0000&lt;BR /&gt;DUMMY&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;C.B $0&lt;BR /&gt;&lt;BR /&gt;org $FFF6&lt;BR /&gt;FDB RAISE&lt;BR /&gt;&lt;BR /&gt;code:&lt;BR /&gt;mainLoop:&lt;BR /&gt;&lt;BR /&gt;MOV #$08 ,TPM1SC ;TOIE DISABLED, BUS CLK SELECTED ,NO PRESCALE&lt;BR /&gt;MOV #$44 ,TPM1C0SC ;INTERRUPT ENABLED, RAISING EDGE INPUT CAPTURE&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;feed_watchdog&lt;BR /&gt;BRA mainLoop&lt;BR /&gt;&lt;BR /&gt;RAISE LDHX TPM1C0V&lt;BR /&gt;ROR DUMMY&lt;BR /&gt;BCC FIRST&lt;BR /&gt;STHX S2&lt;BR /&gt;LDA S1+1&lt;BR /&gt;SUB S2+1&lt;BR /&gt;STA R1+1&lt;BR /&gt;LDA S1&lt;BR /&gt;SBC S2&lt;BR /&gt;STA R1&lt;BR /&gt;STOP&lt;BR /&gt;&lt;BR /&gt;FIRST: STHX S1&lt;BR /&gt;INC DUMMY&lt;BR /&gt;BRA mainLoop&lt;BR /&gt;&lt;BR /&gt;hope i'm clear for you.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Nandakumar.V&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 03:01:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130253#M2390</guid>
      <dc:creator>Nandav</dc:creator>
      <dc:date>2006-09-15T03:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Input Capture Clarification</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130254#M2391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Nandakumar,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Correct me if I am wrong, but you seem to have&amp;nbsp;done little assembly coding before - there are numerous fundamental errors in your program structure and detail that suggest this.&amp;nbsp; You would need to gain understanding of basic&amp;nbsp;structure, and particularly the way interrupt processing works within the MCU,&amp;nbsp;before trying to utilise the&amp;nbsp;input capture processing.&amp;nbsp; If you have not already done so, I would suggest you examine simple sample programs supplied with CW, such as LED flashing routines, etc. to see how an assembly program should be structured.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The following is a very basic outline of an absolute assembly program framework,&amp;nbsp;with one ISR shown.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Specify basic include files -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Register names and definitions&amp;nbsp;for MCU type, etc&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; INCLUDE "DERIVATIVE.INC"&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;********************************************&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Allocate RAM variables:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; ORG&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Start of RAM block&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;VAR1:&amp;nbsp;&amp;nbsp;&amp;nbsp; DS&amp;nbsp;&amp;nbsp; 1&amp;nbsp; ; Byte variable allocated&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;VAR2:&amp;nbsp;&amp;nbsp;&amp;nbsp; DS&amp;nbsp;&amp;nbsp;&amp;nbsp;2&amp;nbsp; ; Word variable allocated&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;********************************************&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; ORG&amp;nbsp;&amp;nbsp;&amp;nbsp; ROMSTART ; Start&amp;nbsp;location for code&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;START:&amp;nbsp;&amp;nbsp;; Beginning of initialisation code&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Initialise stack pointer&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Initialise CONFIG, I/O, timer, etc.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CLI&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Enable interrupts&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;MAINLOOP:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Reset COP timer&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Main loop processing&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;JMP&amp;nbsp;&amp;nbsp; MAINLOOP ; Loop always&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;********************************************&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Sub-routines called by main loop, etc.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;********************************************&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Interrupt service routines (ISRs)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;TMPC0_ISR: ; Timer Ch 0 interrupt service&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PSHH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Usually necessary&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; ISR processing&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;; Clear interrupt flag(s)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PULH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Restore previous value&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RTI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Exit from ISR&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;********************************************&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Courier New" size="2"&gt;; Setup interrupt vectors:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; ORG&amp;nbsp;$FFF6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Timer Ch0 vector&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DC.W&amp;nbsp; TMPC0_ISR&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Other vectors&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; ORG $FFFE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Reset vector&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DC.W&amp;nbsp; START&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;See if you can fit your code into this basic framework.&amp;nbsp; To answer your specific question - you need to set up a counter that is incremented each time you enter the ISR.&amp;nbsp; Alternatively, you might utilise a single bit flag that is cleared within the main loop, and set the next time the ISR executes.&amp;nbsp; The ISR would first&amp;nbsp;test the flag to see if it is already set, or not.&amp;nbsp; Incidently, never use a STOP instruction unless you have set up a means of waking the MCU.&amp;nbsp; I would not use it within an ISR.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2006-09-18&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:24 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2006 21:03:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130254#M2391</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-09-17T21:03:19Z</dc:date>
    </item>
    <item>
      <title>You're correct.. ;)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130255#M2392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;dear mac,&lt;BR /&gt;you're right..&lt;BR /&gt;i'm totally new to assembly programming.&lt;BR /&gt;i was held up with my exams, that's why i could not reply.&lt;BR /&gt;I think i'll be comfortable very soon.&lt;BR /&gt;I want to thank you for your reply.&lt;BR /&gt;&lt;BR /&gt;Nanda.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2006 21:39:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Input-Capture-Clarification/m-p/130255#M2392</guid>
      <dc:creator>Nandav</dc:creator>
      <dc:date>2006-10-15T21:39:50Z</dc:date>
    </item>
  </channel>
</rss>

