<?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 Re: HCS08 TPM Configured for Quadrature Decoding? in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201693#M16560</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hello Alan,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not familiar with the capabilities of the TPU module.&amp;nbsp; However, a search of the forum revealed the following lengthy thread from some time ago, in which a number of approaches to quadrature decoder signal processing&amp;nbsp;were discussed.&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&amp;amp;thread.id=398" target="_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&amp;amp;thread.id=398&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The complexity is likely to depend on the type of decoder, optical or contact, and indent or no indent, and the purpose of the control.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2008-03-11&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;05:03 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Mar 2008 13:01:56 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2008-03-11T13:01:56Z</dc:date>
    <item>
      <title>HCS08 TPM Configured for Quadrature Decoding?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201692#M16559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have used Freescale's 32 bit processors with TPU functions, which make quadrature decoding straightforward.&amp;nbsp; I am looking at the HCS08 family, which has a TPM.&amp;nbsp; Can this be configured for quadrature counting?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for the response.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2008 06:55:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201692#M16559</guid>
      <dc:creator>windpower</dc:creator>
      <dc:date>2008-03-11T06:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 TPM Configured for Quadrature Decoding?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201693#M16560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hello Alan,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not familiar with the capabilities of the TPU module.&amp;nbsp; However, a search of the forum revealed the following lengthy thread from some time ago, in which a number of approaches to quadrature decoder signal processing&amp;nbsp;were discussed.&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&amp;amp;thread.id=398" target="_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&amp;amp;thread.id=398&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The complexity is likely to depend on the type of decoder, optical or contact, and indent or no indent, and the purpose of the control.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2008-03-11&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;05:03 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2008 13:01:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201693#M16560</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-03-11T13:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 TPM Configured for Quadrature Decoding?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201694#M16561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Alan,&lt;BR /&gt;&lt;BR /&gt;I have implemented the tpm in a MC9S08DZ60 for capturing quadrature encoder pulses.&amp;nbsp; Relevant parts of my code are listed below.&amp;nbsp; Note that in order to determine direction, my code only captures one channel and looks at the status of the other channel.&amp;nbsp;&amp;nbsp; You can get a higher resolution using both channels and watching both the rising and the falling edges, but it will cost you cpu cycles to do so (I had to do it this way to accomodate for a higher resolution encoder on a faster motor).&amp;nbsp;&amp;nbsp; Hope it helps.&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void MCU_init_tpm1(void){  //Initialize timer TPM1 channel, assumes not touched since reset!  TPM1SC_CLKSA = 1;//Select BUS clock  TPM1SC_CLKSB = 0;  TPM1SC_PS = T1PRESCALAR;//clock source divided by prescalar  TPM1MOD = T1MODULUS;//set Counter modulus  TPM1SC_CPWMS = 0;   // not center aligned    //TPM1, channel 1  TPM1C1SC_MS1B = 0;  // MS0B:MS0A 00 == input capture  TPM1C1SC_MS1A = 0;  //  TPM1C1SC_ELS1B = 0; // ELSnB:ELSnA 01 == rising edge capture only (10 falling, 11 either)  TPM1C1SC_ELS1A = 1; // 0 = Select high as true, 1 = Select low as true    TPM1C1SC_CH1IE = 1;  TPM1C1SC = TPM1C1SC;  TPM1SC_TOIE = 1;  //enable timer overflow for counter //Verify!!! FIX ME!!! RPO}void update_encoder(unsigned char direction_verify_channel){   if(!direction_verify_channel)    //   {      if(!++encoder[2]) if(!++encoder[1]) encoder[0]++; //"up" //encoder uses 3 bytes, shift the carry bit up/down   }   else   {      if(!encoder[2]--) if(!encoder[1]--) encoder[0]--; //"down"   }}void interrupt 6 tpm1ch1_ChannelA_inputcapture(void){   unsigned char dummy = 0;   dummy = TPM1SC;   update_encoder(ChannelB);   TPM1SC &amp;amp;= 0x7F;   update_speed();   dummy = TPM1C1SC_CH1F;   TPM1C1SC_CH1F = 0;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2008 14:09:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/HCS08-TPM-Configured-for-Quadrature-Decoding/m-p/201694#M16561</guid>
      <dc:creator>mayfly</dc:creator>
      <dc:date>2008-03-11T14:09:27Z</dc:date>
    </item>
  </channel>
</rss>

