<?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>CodeWarrior for MCU中的主题 Re: How to use interrupts on MCF51EM?</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493563#M12635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really apreciate it, Mr. Xing Kuang.&lt;/P&gt;&lt;P&gt;You were completely clear in your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me ask just one more thinkg.. &lt;BR /&gt;How do I write a code to be executed in a time specified by the interruption? For exemple, check a variable value and take any decision according to the interruption time?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Jan 2016 15:47:14 GMT</pubDate>
    <dc:creator>rodrigocorrêa</dc:creator>
    <dc:date>2016-01-23T15:47:14Z</dc:date>
    <item>
      <title>How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493555#M12627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm programming the MCF51EM256 and I do not understand how to use the interrupts.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For exemple. I would like to blink a LED every second. So I should make a interrupt that runs every second;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I do this? How and I declare a interrupt and define its time on CodeWarrior 6.3?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not using processor expert.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody give me any tutorial or app note? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jan 2016 13:59:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493555#M12627</guid>
      <dc:creator>rodrigocorrêa</dc:creator>
      <dc:date>2016-01-16T13:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493556#M12628</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;&lt;/P&gt;&lt;P&gt;I made a sample code to you , please see attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code I send you, I use Timer1, the interrupt is defined as 1s interval. The interval is decided by TPM1SC register Prescale Divisor bits. For more about how to set Timer registers, may I suggest you read the “&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: #51626f;"&gt;MCF51QE128 Reference Manual&lt;/SPAN&gt;”, page 341-346.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the sample code I sent you, the interrupt subroutine is defined as:&lt;/P&gt;&lt;P&gt;void interrupt 66 timer()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here, “interrupt” is key word for interrupt subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;Vector number can be found in Reference Manual &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Helvetica-Bold','sans-serif';"&gt;&lt;STRONG&gt;ColdFire Exception Vector Table&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;, Vector Number(s) row.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;the demo code is for 51QE128 but the method is exactly the same for 51EM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jennie Zhang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 06:52:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493556#M12628</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2016-01-18T06:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493557#M12629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rodrigo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;For how to define the vector table in your project, you may refer to the example project for EM256 Demo board, which is contained in CW 6.3 installation folder:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;C:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.3\(CodeWarrior_Examples)\ColdFire V1\Evaluation Board Examples\DEMOEM\EM256 Demo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;This example demonstrates KBI interrupts, the LEDs, and push buttons.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;If you need to blink a LED every second, please enable a timer and toggle the led in the timer interrupt subroutine, you may refer to the attached project, it is based on CW10.6, but the source code is same.&amp;nbsp; It demonstrates interrupts from the timer and uses two LED's. For details, please look into its readme.txt. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Fiona Kuang&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Technical Information &amp;amp; Commercial Support&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 06:59:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493557#M12629</guid>
      <dc:creator>TICS_Fiona</dc:creator>
      <dc:date>2016-01-18T06:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493558#M12630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer. I really apreciate it;&lt;/P&gt;&lt;P&gt;What are the meaning of those variables you wrote in your code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1C0SC = 0x50;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1CNTH = 0x00;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1SC = 0x0E;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How does it work? Why do we need to attribute these values like you've done? Shoudn't you call the interruption in the main program, like we do with functions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 18:23:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493558#M12630</guid>
      <dc:creator>rodrigocorrêa</dc:creator>
      <dc:date>2016-01-20T18:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493559#M12631</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;I comment the code as below. setting these registers is because we need enable TPM channel 0 interrupt, define TPM clock source, and "when" to trigger the interrupt. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPM1C0SC = 0x50; //enable channel 0 interrupt, output compare mode&lt;/P&gt;&lt;P&gt;TPM1CNTH = 0x00; //this is TPM counter. 0x00 is the default value, you can remove this line of code.&lt;/P&gt;&lt;P&gt;TPM1SC = 0x0E; //TPM clock source is bus rate clock, TPM clock source is divided by 64&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for more information about these registers, see related chip user manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once you finishing these configuration. void interrupt 66 timer() will be called automatically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jennie Zhang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 04:20:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493559#M12631</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2016-01-21T04:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493560#M12632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a Lot, Mrs. &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ZhangJennie"&gt;ZhangJennie&lt;/A&gt;!&lt;BR /&gt;I would like to ask just one more thing (if you allow me..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where Exactly do you set the time of the interruption? &lt;BR /&gt;For Exemple, 1s, 10s, 1ms...?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 21:45:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493560#M12632</guid>
      <dc:creator>rodrigocorrêa</dc:creator>
      <dc:date>2016-01-21T21:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493561#M12633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we can set TPM1SC and TPM1CNT to get interrupt time.&lt;/P&gt;&lt;P&gt;for example, you have 4.194Mhz bus clock.&lt;/P&gt;&lt;P&gt;1. to get 1s interrupt, we can set:&lt;/P&gt;&lt;P&gt;TPM1SC = 0x0E; //TPM clock source is bus rate clock, TPM clock source is divided by 64&lt;/P&gt;&lt;P&gt;TPM1C0V=0xfffe;&amp;nbsp; //65535&lt;/P&gt;&lt;P&gt;thus we can get 4.194M/64/65535 = 1hz&amp;nbsp; TPM clock&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. to get 1ms interrupt, we can set&lt;/P&gt;&lt;P&gt;TPM1SC = 0x08; //TPM clock source is bus rate clock, TPM clock source is divided by 1&lt;/P&gt;&lt;P&gt;TPM1C0V=0x1061;&amp;nbsp; //4193&lt;/P&gt;&lt;P&gt;thus we can get 4.194M/1/4193 = 1khz&amp;nbsp; TPM clock&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with this method you can set multi interrupt time value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jennie Zhang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jan 2016 09:13:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493561#M12633</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2016-01-22T09:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493562#M12634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very very much!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jan 2016 14:42:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493562#M12634</guid>
      <dc:creator>rodrigocorrêa</dc:creator>
      <dc:date>2016-01-23T14:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use interrupts on MCF51EM?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493563#M12635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really apreciate it, Mr. Xing Kuang.&lt;/P&gt;&lt;P&gt;You were completely clear in your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me ask just one more thinkg.. &lt;BR /&gt;How do I write a code to be executed in a time specified by the interruption? For exemple, check a variable value and take any decision according to the interruption time?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jan 2016 15:47:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-interrupts-on-MCF51EM/m-p/493563#M12635</guid>
      <dc:creator>rodrigocorrêa</dc:creator>
      <dc:date>2016-01-23T15:47:14Z</dc:date>
    </item>
  </channel>
</rss>

