mehmetem
Joined: 29 Jul 2011 Posts: 12
|
qei index pulse could not reset |
Posted: Wed Aug 03, 2011 1:36 am |
|
|
Hi All,
I'm trying to use dsPic33fj32mc204 and quadrature encoder.
in main() function:
Code: |
setup_qei(QEI_MODE_X4|QEI_RESET_WHEN_IDX_PULSE,QEI_FILTER_DIV_1|QEI_IDX_WHEN_A0_B0);
|
in timer2 interrupt:
Code: |
count=qei_get_count();
|
here is phsical index pulse but i could not receive it. Counter only counts upward or downward.
Does anyone have an advice?
I've tried this too;
in header file:
Code: |
#define RPINR14 0x069C //QEI remap reg
#define QEI1CON 0x01E0 //qei control register
#define DFLT1CON 0x01E2 //qei dflt control register
|
in main() function:
Code: |
*(RPINR14)=21; //qeb remap (my qeb pin)
*(RPINR14+1)=20; //qea remap (my qea pin)
*(RPINR14+3)=19; //ind remap (my index pin)
*(QEI1CON)=((*(QEI1CON)&0xFB)|0x04); // index pulse reset enable
*(QEI1CON+1)=((*(QEI1CON+1)&0xF8)|0x06); //qei 4x mode, index pulse reset
*(DFLT1CON+1)=((*(DFLT1CON+1)&0xFE)|0x01); // count error detect disabled
|
Thanks in advance _________________ trainee
Last edited by mehmetem on Wed Aug 03, 2011 5:06 am; edited 1 time in total |
|