QDEC for EC11 in SDK17

Hello,

nRF52840, SDK17.2, keil5, EC11 codec button

  

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void MY_QDEC_INTERRUPT(nrfx_qdec_event_t event)
{
static uint8_t flag=0;;
static int cnt = 0;
if(NRF_QDEC_EVENT_REPORTRDY == event.type)
{
nrfx_qdec_disable();
//int8_t dat = nrf_qdec_sample_get();
int16_t p_acc = event.data.report.acc;
uint16_t p_accdbl = event.data.report.accdbl;
nrfx_qdec_enable();
if(0==p_accdbl)
{
if(p_acc<0)
cnt++;
else
cnt--;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Output the same log in the positive and negative directions,

Turn one space:   <info> app: cnt=-1  acc=1  accdbl=0

Turn one more:    <info> app: cnt=0  acc=-1  accdbl=0

Unable to distinguish positive and negative directions.

   

Best regards

Parents
  • Hi,

     

    You do not need the series resistors R57/R56, try replacing these with 0 ohm.

    Have you looked at the input signals using a logic analyzer or oscilloscope to see if they are as expected?

     

    Kind regards,

    Håkon

  • Hi,

    thanks for reply,

    i've replacing these with 0 ohm.  

    it work well.

          

    Best regards

Reply Children
No Data