<?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>Reading ACC and ACCDBL values from NRFX QDEC.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87198/reading-acc-and-accdbl-values-from-nrfx-qdec</link><description>Hello, 
 
 I am currently working on the NRFX QDEC library with a decoder to be used with a servo motor. 
 
 We manage to initialize and enable the QDEC and IRQ and we get into the event handler. It seems like the QDEC registers values and comparing the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Apr 2022 11:37:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87198/reading-acc-and-accdbl-values-from-nrfx-qdec" /><item><title>RE: Reading ACC and ACCDBL values from NRFX QDEC.</title><link>https://devzone.nordicsemi.com/thread/364453?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 11:37:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d90bbd0-7565-4f2b-baf6-8a67898260ef</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Can we have an example code? We have tried googling, but without luck.[/quote]
&lt;p&gt;Take a look at how the sensor&amp;nbsp;QDEC driver does it:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/sensor/qdec_nrfx/qdec_nrfx.c"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/sensor/qdec_nrfx/qdec_nrfx.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PS: Our nrf_desktop application uses the Sensor API to access the QDEC.&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/applications/nrf_desktop/src/hw_interface/wheel.c"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/applications/nrf_desktop/src/hw_interface/wheel.c&lt;/a&gt;&lt;/p&gt;
[quote user=""]What arguments does the read-function takes? It says pointer, but do we have to declare any variables to store it in the first place?[/quote]
&lt;p&gt;Yes, you need to declare the variables. See this code:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1/drivers/sensor/qdec_nrfx/qdec_nrfx.c#L63"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1/drivers/sensor/qdec_nrfx/qdec_nrfx.c#L63&lt;/a&gt;&lt;/p&gt;
[quote user=""]It seems to count to somewhere between 5- and 6000 events per revolution, do you have any idea what the problems could be?[/quote]
&lt;p&gt;No.&lt;/p&gt;
[quote user=""]How exactly does event.data.report.acc and event.data.report.accdbl work?[/quote]
&lt;p&gt;This is explained in the Product specification. See this link:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/qdec.html?cp=4_2_0_35#concept_isq_pwd_4r"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/qdec.html?cp=4_2_0_35#concept_isq_pwd_4r&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>