<?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>ColdFire/68K Microcontrollers and Processors中的主题 Re: PIT not working</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131286#M876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;gt; can anyone see anything in my code that will prevent it&lt;BR /&gt;&amp;gt; from interrupting continuously, like it&lt;BR /&gt;&amp;gt; should?&lt;BR /&gt;&lt;BR /&gt;yes, in your interrupt service the PIF-Bit has to be set, not reset!&lt;BR /&gt;&lt;BR /&gt;i.e.: MCF_PIT_PCSR(PIT) |= MCF_PIT_PCSR_PIF;&lt;BR /&gt;&lt;BR /&gt;cheers, Thomas&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Apr 2006 13:35:13 GMT</pubDate>
    <dc:creator>thz</dc:creator>
    <dc:date>2006-04-12T13:35:13Z</dc:date>
    <item>
      <title>PIT not working</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131282#M872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hey everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to get a PIT to interrupt, so that I can sample a quadrature encoded signal. I have used the following code to initialize the timer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void quad_gpt_setup(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_PIT0_PMR = MCF_PIT_PMR(70); //set modulus to 2!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_PIT0_PCSR = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| MCF_PIT_PCSR_PRE(0xA)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| MCF_PIT_PCSR_PIE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| MCF_PIT_PCSR_EN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| MCF_PIT_PCSR_RLD; //enable PIT (32768 prescaler, interrupts)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and have called this before an empty while loop within main. now, I have created a handler for it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;__interrupt__ void quad_handler(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;board_led_display((MCF_GPIO_SETTA &amp;amp; 0x03));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCF_PIT0_PCSR &amp;amp;= 0xFFFE; //clear the interrupt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and initialized the interrupt as follows, in the main:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mcf5xxx_set_handler(64 + 55,quad_handler);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;now, this is not working for me. The system sits in the infinite loop, and this is bad. do I need to set up any other registers, or is there an error in my code anywhere, or what?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;another question i have is whether i can use a GPT for this purpose if I am using their pins as digital I/O. if so, how do i set this up? specifically, do i select output compare or input capture mode, or does it matter?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any help would be appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Trevor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;p.s. if it matters, I am using a MCF5213, specifically the M5213EVB...&lt;/SPAN&gt;&lt;P&gt;Message Edited by airswit on &lt;SPAN class="date_text"&gt;04-04-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;02:08 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2006 14:01:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131282#M872</guid>
      <dc:creator>airswit</dc:creator>
      <dc:date>2006-04-04T14:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: PIT not working</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131283#M873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Did you setup the interrupt controller?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2006 19:37:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131283#M873</guid>
      <dc:creator>thz</dc:creator>
      <dc:date>2006-04-04T19:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: PIT not working</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131284#M874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;well, I am not too sure what all I have to set up. to get the edge port interrupts to work was real simple, i just used:&lt;BR /&gt;&lt;BR /&gt;MCF_EPORT_EPPAR = 0&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA1_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA4_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA5_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA7_LEVEL;&lt;BR /&gt;mcf5xxx_set_handler(64 + 4, sw1_handler);&lt;BR /&gt;mcf5xxx_set_handler(64 + 5, sw2_handler);&lt;BR /&gt;mcf5xxx_set_handler(64 + 7, abort_handler);&lt;BR /&gt;mcf5xxx_irq_enable();&lt;BR /&gt;&lt;BR /&gt;and that got me running on the three buttons on the eval board. now, i have tried to set up the PIT0 interrupt likewise with:&lt;BR /&gt;&lt;BR /&gt;mcf5xxx_set_handler(64 + 55,quad_handler);&lt;BR /&gt;MCF_INTC_ICR55 = 0&lt;BR /&gt;| MCF_INTC_ICR_IP(6)&lt;BR /&gt;| MCF_INTC_ICR_IL(6); //set priorities&lt;BR /&gt;mcf5xxx_irq_enable();&lt;BR /&gt;&lt;BR /&gt;but as of now, the system is stuck (not interrupting like it should). when i debug the program, it sits in the main loop, it is not like it runs to a bad address or something. I am using codewarrior v6.2, and I have attached my whole file for you (a little bloated, but hopefully that helps more than the cutting/pasting!)&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;&lt;BR /&gt;Trevor&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 01:26:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131284#M874</guid>
      <dc:creator>airswit</dc:creator>
      <dc:date>2006-04-05T01:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: PIT not working</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131285#M875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;update:&lt;BR /&gt;&lt;BR /&gt;I can get it to interrupt once while in debug mode. but, i am not sure that it is interrupting when i 'run' the code (choose run rather than debug in codewarrior). I achieved this by clearing the INT_MASK[55] bit in the IMRH. my 'main' code is now this:&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;MCF_EPORT_EPPAR = 0&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA1_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA4_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA5_RISING&lt;BR /&gt;| MCF_EPORT_EPPAR_EPPA7_LEVEL;&lt;BR /&gt;mcf5xxx_set_handler(64 + 4, sw1_handler);&lt;BR /&gt;mcf5xxx_set_handler(64 + 5, sw2_handler);&lt;BR /&gt;mcf5xxx_set_handler(64 + 7, abort_handler);&lt;BR /&gt;mcf5xxx_set_handler(64 + 55,quad_handler);&lt;BR /&gt;MCF_INTC_ICR55 = 0&lt;BR /&gt;| MCF_INTC_ICR_IP(6)&lt;BR /&gt;| MCF_INTC_ICR_IL(6); //set priorities&lt;BR /&gt;MCF_INTC_IMRH &amp;amp;= ~MCF_INTC_IMRH_MASK55;&lt;BR /&gt;&lt;BR /&gt;mcf5xxx_irq_enable();&lt;BR /&gt;&lt;BR /&gt;quad_gpt_setup();&lt;BR /&gt;check_quadrature();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;can anyone see anything in my code that will prevent it from interrupting continuously, like it should?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 01:54:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131285#M875</guid>
      <dc:creator>airswit</dc:creator>
      <dc:date>2006-04-05T01:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: PIT not working</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131286#M876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&amp;gt; can anyone see anything in my code that will prevent it&lt;BR /&gt;&amp;gt; from interrupting continuously, like it&lt;BR /&gt;&amp;gt; should?&lt;BR /&gt;&lt;BR /&gt;yes, in your interrupt service the PIF-Bit has to be set, not reset!&lt;BR /&gt;&lt;BR /&gt;i.e.: MCF_PIT_PCSR(PIT) |= MCF_PIT_PCSR_PIF;&lt;BR /&gt;&lt;BR /&gt;cheers, Thomas&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 13:35:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/PIT-not-working/m-p/131286#M876</guid>
      <dc:creator>thz</dc:creator>
      <dc:date>2006-04-12T13:35:13Z</dc:date>
    </item>
  </channel>
</rss>

