<?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 Quadrature Decoder on 56F8037 best option? in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Quadrature-Decoder-on-56F8037-best-option/m-p/147298#M1837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a MC56F8037 to read a Quadrature encoder. It is difficult as the last embedded platform I programmed on&amp;nbsp; an open loop V/Hz Induction motor speed control on a . . .9S12C&amp;nbsp; . . . is different to the DSP architecture of the 56F8037 . I have&amp;nbsp;2 questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I tried writing the code to do the quadrature encoding by myself. But it did not work. Should I attempt to use the stationery code in processor expert? Like in this post? &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fcommunity.freescale.com%2Fmessage%2F47553%2347553" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/47553#47553&lt;/A&gt;&amp;nbsp;.&amp;nbsp; Or does someone think that my code is close to working?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I have noticed that you cannot write to some registers in the 56F8037 using the assignment operator ' = ' in C. (I get an lvalue error).&amp;nbsp;This is different from the 9S12 why is this so?. I believe in the code snippet provided I am using an assembly move instruction to write to the register, as this is how the examples in codewarrior worked. Is there a document aimed at HC12/9S12 programmers transitioning to the 56F8XXX type DSC's?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code, as best as I can currently interpret the Peripheral description and System Intergration Module documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include "MC56F802x3x.h"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;/* DISABLE COP TIMER */&lt;BR /&gt;&amp;nbsp;asm(bfclr&amp;nbsp;#$FFFF,X:COP_CTRL);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;//initialise quadrature encoder&lt;BR /&gt;&amp;nbsp;asm (move.w #$8020,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA0);&amp;nbsp;//Bit 6=1 (Timer A0 ON GPIOA6) and Bit 12=1 (Timer A1 on GPIOA12)&lt;BR /&gt;&amp;nbsp;asm (move.w #$1000,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA0); &amp;nbsp;//Bit 12=1 (Timer A0)&lt;BR /&gt;&amp;nbsp;asm (move.w #$0100,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA1); &amp;nbsp;//Bits 9-8 = 10 (Timer A1)&lt;BR /&gt;&amp;nbsp;asm (move.w #$0080,X:TMRA0_CTRL); &amp;nbsp;//0x0080&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_SCTRL); &amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_CNTR);&amp;nbsp;//0x0000&amp;nbsp;&lt;BR /&gt;&amp;nbsp;asm (move.w #$0000,X:TMRA0_LOAD);&amp;nbsp;//0x0000&amp;nbsp;&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$FFFF,X:TMRA0_COMP1);&amp;nbsp;//0xFFFF&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_COMP2);&amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_CSCTRL);&amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$8080,X:TMRA0_CTRL);&amp;nbsp;//0x8080&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;while (1)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;printf("Value of Quadrature Decoder:%u",TMRA0_CNTR);&amp;nbsp; //very large function will not be present after debugging&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im expecting&amp;nbsp;inputs are&amp;nbsp;on Pins A6 and A12. And the count value appears in TMRA0_CNTR up or down counting depending on direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for&amp;nbsp;a reply in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Sep 2010 20:44:10 GMT</pubDate>
    <dc:creator>raptor310</dc:creator>
    <dc:date>2010-09-14T20:44:10Z</dc:date>
    <item>
      <title>Quadrature Decoder on 56F8037 best option?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Quadrature-Decoder-on-56F8037-best-option/m-p/147298#M1837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a MC56F8037 to read a Quadrature encoder. It is difficult as the last embedded platform I programmed on&amp;nbsp; an open loop V/Hz Induction motor speed control on a . . .9S12C&amp;nbsp; . . . is different to the DSP architecture of the 56F8037 . I have&amp;nbsp;2 questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I tried writing the code to do the quadrature encoding by myself. But it did not work. Should I attempt to use the stationery code in processor expert? Like in this post? &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fcommunity.freescale.com%2Fmessage%2F47553%2347553" rel="nofollow" target="_blank"&gt;https://community.freescale.com/message/47553#47553&lt;/A&gt;&amp;nbsp;.&amp;nbsp; Or does someone think that my code is close to working?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I have noticed that you cannot write to some registers in the 56F8037 using the assignment operator ' = ' in C. (I get an lvalue error).&amp;nbsp;This is different from the 9S12 why is this so?. I believe in the code snippet provided I am using an assembly move instruction to write to the register, as this is how the examples in codewarrior worked. Is there a document aimed at HC12/9S12 programmers transitioning to the 56F8XXX type DSC's?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code, as best as I can currently interpret the Peripheral description and System Intergration Module documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include "MC56F802x3x.h"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;/* DISABLE COP TIMER */&lt;BR /&gt;&amp;nbsp;asm(bfclr&amp;nbsp;#$FFFF,X:COP_CTRL);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;//initialise quadrature encoder&lt;BR /&gt;&amp;nbsp;asm (move.w #$8020,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA0);&amp;nbsp;//Bit 6=1 (Timer A0 ON GPIOA6) and Bit 12=1 (Timer A1 on GPIOA12)&lt;BR /&gt;&amp;nbsp;asm (move.w #$1000,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA0); &amp;nbsp;//Bit 12=1 (Timer A0)&lt;BR /&gt;&amp;nbsp;asm (move.w #$0100,X&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif"&gt;&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;&lt;/A&gt;IM_GPSA1); &amp;nbsp;//Bits 9-8 = 10 (Timer A1)&lt;BR /&gt;&amp;nbsp;asm (move.w #$0080,X:TMRA0_CTRL); &amp;nbsp;//0x0080&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_SCTRL); &amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_CNTR);&amp;nbsp;//0x0000&amp;nbsp;&lt;BR /&gt;&amp;nbsp;asm (move.w #$0000,X:TMRA0_LOAD);&amp;nbsp;//0x0000&amp;nbsp;&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$FFFF,X:TMRA0_COMP1);&amp;nbsp;//0xFFFF&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_COMP2);&amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$0000,X:TMRA0_CSCTRL);&amp;nbsp;//0x0000&lt;BR /&gt;&amp;nbsp;asm (move.w&amp;nbsp;#$8080,X:TMRA0_CTRL);&amp;nbsp;//0x8080&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;while (1)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;printf("Value of Quadrature Decoder:%u",TMRA0_CNTR);&amp;nbsp; //very large function will not be present after debugging&lt;BR /&gt;&amp;nbsp;&amp;nbsp;asm(nop);&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im expecting&amp;nbsp;inputs are&amp;nbsp;on Pins A6 and A12. And the count value appears in TMRA0_CNTR up or down counting depending on direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for&amp;nbsp;a reply in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Sep 2010 20:44:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Quadrature-Decoder-on-56F8037-best-option/m-p/147298#M1837</guid>
      <dc:creator>raptor310</dc:creator>
      <dc:date>2010-09-14T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Quadrature Decoder on 56F8037 best option?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Quadrature-Decoder-on-56F8037-best-option/m-p/147299#M1838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;IMHO the best option is to get QuickStart, you'll find it in the freescale website. It's a API to interact with the processor modules. And it comes with a easy to use GUI that helps to initialize the processor.&lt;/P&gt;&lt;P&gt;In the freescale webste there are many examples of quadrature encoder and/or V/Hz &amp;nbsp;control. Most of them use quickstart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bye Jack&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 21:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Quadrature-Decoder-on-56F8037-best-option/m-p/147299#M1838</guid>
      <dc:creator>giacomopetrini</dc:creator>
      <dc:date>2010-09-30T21:10:32Z</dc:date>
    </item>
  </channel>
</rss>

