<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>getting Qei position value problem in LPC-1768</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/29706/getting-qei-position-value-problem-in-lpc-1768</link><description> 
Hi every one 

 
i want to get the exact position alue of the quadrature encoder ,
in the QEI example of the CMSIS 
but when i want to use the QEI_Getposition function the returned
value is still zero , so the calculated speed in this example is
correct</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: getting Qei position value problem in LPC-1768</title><link>https://community.arm.com/thread/60023?ContentTypeID=1</link><pubDate>Tue, 08 May 2012 13:12:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d66ab13-1fb1-4dad-975d-4ca8a90ec665</guid><dc:creator>Cocoh H</dc:creator><description>&lt;p&gt;&lt;p&gt;
You use Channel A,B,Z of Encoder connect to QEI Module.&lt;br /&gt;
After ,you are calculate position with form &amp;quot; Position =
QEIPOS+REV*(pulse/round of Encoder)&amp;quot;.&lt;br /&gt;
Note. Channel Z must connect to QEI MOdule.&lt;/p&gt;

&lt;p&gt;
QEIPOS= positiopn register in QEI module&lt;br /&gt;
REV = INXCNT register in QEI module&lt;/p&gt;

&lt;p&gt;
set pin and parameter&lt;br /&gt;
void initial_QEI(void)&lt;br /&gt;
{ LPC_SC-&amp;gt;PCONP|=0x40000; //Power on LPC_SC-&amp;gt;PCLKSEL1|=0x01;
LPC_PINCON-&amp;gt;PINSEL3 |=0x14100 ; // turn on PIN QEI
LPC_QEI-&amp;gt;QEICON |= 0x01; LPC_QEI-&amp;gt;CMPOS0 = 0x00;
LPC_QEI-&amp;gt;CMPOS1 = 0x00; LPC_QEI-&amp;gt;CMPOS2 = 0x00;
LPC_QEI-&amp;gt;INXCMP = 0x00; LPC_QEI-&amp;gt;QEILOAD = 0x00;
LPC_QEI-&amp;gt;VELCOMP = 0x00; LPC_QEI-&amp;gt;QEIIEC = 0x01;
LPC_QEI-&amp;gt;QEICLR = 0x41; LPC_QEI-&amp;gt;QEICONF = 0x04; //Cap x4&lt;/p&gt;

&lt;p&gt;
}&lt;br /&gt;
/************* Set up ***/round **************/&lt;br /&gt;
void qei_SetuPulse()&lt;br /&gt;
{ LPC_QEI-&amp;gt;QEIMAXPOS =0x270F; /* set Up pulse/round**/
LPC_QEI-&amp;gt;QEILOAD =PCKK/4; LPC_QEI-&amp;gt;FILTER = 0x100;&lt;br /&gt;
}&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>