CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

qei index pulse could not reset

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mehmetem



Joined: 29 Jul 2011
Posts: 12

View user's profile Send private message

qei index pulse could not reset
PostPosted: Wed Aug 03, 2011 1:36 am     Reply with quote

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
mehmetem



Joined: 29 Jul 2011
Posts: 12

View user's profile Send private message

I solved.
PostPosted: Wed Aug 03, 2011 5:04 am     Reply with quote

*(RPINR14+2)=19; //ind remap (my index pin) //index pini rp19

I'm sorry for my broken English.
_________________
trainee
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group