<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>QDEC example simple code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45430/qdec-example-simple-code</link><description>Hi, 
 I want to interface two QENC with nrf52840, I saw QDEC example and it works as expected. 
 The problem I am facing is that QENC has four pins of which two are for power and two are ENCA and ENCB. Since I don&amp;#39;t have QENC LED, I have to sample let</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 Apr 2019 11:04:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45430/qdec-example-simple-code" /><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/182075?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2019 11:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92cca3e5-e808-4aec-83d2-5ca78a72dfed</guid><dc:creator>Ali Rumane</dc:creator><description>&lt;p&gt;Thank you for your help&lt;/p&gt;
&lt;p&gt;I am reading ACC registers but values seems completely incorrect.&lt;/p&gt;
&lt;p&gt;I used gpiote to count pulses and they seems to be fine.&lt;/p&gt;
&lt;p&gt;Do you know some common reasons why it isn&amp;#39;t working as expected?&lt;/p&gt;
&lt;p&gt;I am planning to use gpiote and count risung edge pulses which seems okay for me as of now but still I think qdec should work somehow for my applcation.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/180504?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 13:03:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b38eac90-f294-49ab-9966-28477c7a4603</guid><dc:creator>&amp;#216;yvind</dc:creator><description>[quote user="Ali Rumane"]I don&amp;#39;t understand what they signify.[/quote]
&lt;p&gt;&amp;nbsp;ACC =&amp;nbsp;&lt;span&gt;Register accumulating all valid samples (not double transition) read from the SAMPLE register&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;ACCDBL =&amp;nbsp;Register accumulating the number of detected double or illegal transitions&lt;/span&gt;&lt;/p&gt;
[quote user="Ali Rumane"]In table&amp;nbsp;&lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/qdec"&gt;Sampled value encoding&lt;/a&gt; I saw the description but they are based on sample register and how to interpret direction based on accdbl and acc as they .[/quote]
&lt;p&gt;Not sure what you mean, the link points to the QDEC chapter.&amp;nbsp; The Sample Value Register&amp;nbsp;contains&amp;nbsp;Last motion sample. The value is a &lt;a href="https://stackoverflow.com/questions/1049722/what-is-2s-complement"&gt;2&amp;#39;s complement value&lt;/a&gt;, and the sign gives the direction of the motion. The value &amp;#39;2&amp;#39; indicates a double transition.&amp;nbsp;&lt;/p&gt;
[quote user="Ali Rumane"]Can you please let me know how can I count pulses and time so that I can calculate speed with sign?[/quote]
&lt;p&gt;I&amp;#39;m sorry I don&amp;#39;t know the formula. The&lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/qdec?616#concept_gfd_jzd_4r"&gt; Sampling and Decoding chapter&lt;/a&gt; explains&amp;nbsp;how this works.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/180327?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 13:16:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90e6a187-7455-4441-bb71-0c2e2f8fda5b</guid><dc:creator>Ali Rumane</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thank you for pointing out specific topics.&lt;/p&gt;
&lt;p&gt;I am able to read accdbl and acc values in NRF_QDEC_EVENT_REPORTRDY as you showed, I don&amp;#39;t understand what they signify.&lt;/p&gt;
&lt;p&gt;In table&amp;nbsp;&lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/qdec"&gt;Sampled value encoding&lt;/a&gt; I saw the description but they are based on sample register and how to interpret direction based on accdbl and acc as they .&lt;/p&gt;
&lt;p&gt;Can you please let me know how can I count pulses and time so that I can calculate speed with sign?&lt;/p&gt;
&lt;p&gt;I know the formula&lt;/p&gt;
&lt;p&gt;S = (C/CPR) / (T/60)&lt;/p&gt;
&lt;p&gt;where,&lt;/p&gt;
&lt;p&gt;C is no of pulses&lt;/p&gt;
&lt;p&gt;CPR is constant for encoder&lt;/p&gt;
&lt;p&gt;T is time in sec at which pulses were captured&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/178896?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 11:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:181669e6-50b0-49f1-a3b4-94a2f213d010</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello again,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I would recommend&amp;nbsp;reading the &lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/qdec"&gt;QDEC chapter&lt;/a&gt; in the &lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/keyfeatures_html5"&gt;nRF852840 PS&lt;/a&gt;. Furthermore, have a look at the &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/group__nrf__qdec"&gt;QDEC Peripheral Library&lt;/a&gt;&amp;nbsp;in the SDK documentation.&amp;nbsp;&lt;/p&gt;
[quote user=""]The problem I am facing is that QENC has four pins of which two are for power and two are ENCA and ENCB. Since I don&amp;#39;t have QENC LED, I have to sample let&amp;#39;s say 25 samples per second directly, how to do that?[/quote]
&lt;p&gt;For using off-chip mechanical encoders not requiring a LED, the LED output can be disabled by writing value &amp;#39;Disconnected&amp;#39; to the CONNECT field of the PSEL.LED register. In this case, the QDEC will not acquire access to a LED output pin and the pin can be used for other purposes by the CPU.&lt;br /&gt;&lt;br /&gt;To set the sample rate, use the function:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_qdec_sampleper_set()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Also I tried connecting my QENC pins to QDEC A (pin3) and QDEC B (pin4), connecting QDEC LED as it is and tried the software, it didn&amp;#39;t work.[/quote]
&lt;p&gt;See the answer above.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user=""]Is there a simple code not simulator where I can test my actual hardware and the direction whether it is in positive direction or negative direction?[/quote]
&lt;p&gt;&amp;nbsp;Unfortunately, we do not have any examples of this sort. I recommend using the example we have and customize it for your use.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Have a look at cases regarding QDEC&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/14377/qdec-sampleper-register-problem"&gt;here&lt;/a&gt;,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/37968/nrfx_qdec-driver-quirks"&gt;here&lt;/a&gt;&amp;nbsp;and &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/15669/turning-off-qdec-led"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/178722?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 14:15:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6c9ee9b-0e3a-42b2-a843-64699a402972</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;I have sent you a message asking to convert the message, please confirm.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: QDEC example simple code</title><link>https://devzone.nordicsemi.com/thread/178720?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 13:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e2fda81-fdd9-48df-b466-23dbf157a64d</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Is there a reason for having this task Private? Is it OK for you that we convert to Open? This is so that others in the forum can both help you and that others with the same issue can see how to solve it.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As I have never tried this example my self, I need to test it here at first. Are you using the nRF52840 DK?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>