It is currently 20 Aug 2017 07:33

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 10 Jun 2017 03:46 
Offline

Joined: 10 Jun 2017 03:16
Posts: 3
Hi, everyone!
I use the QEI module of dsPIC33FJ64GS606, the chip have two QEI module.
The QEI1 module is debugged successfully, but the QEI2 module has not been successful.
The QEI2 module and ADC module have the same Pin, and POS2CNT has no changes in the actual test, so I suspect that the pin initialization failed.
Help me! Thanks!

My code is as follows:
void InitPort()
{
    ADPCFG=0xFFFF;
    TRISBbits.TRISB3=1;
    TRISBbits.TRISB4=1;
    TRISBbits.TRISB5=1;
}
void InitQEI()
{
    MAX2CNT=65500;
    POS2CNT=0;
    QEI2CON=0;
    QEI2CONbits.QEIM=7;
    QEI2CONbits.POSRES=0;
    QEI2CONbits.PCDOUT=0;
    QEI2CONbits.SWPAB=0;
    QEI2CONbits.QEISIDL=0;
    DFLT2CON=0;
}


Attachments:
0.PNG
0.PNG [ 27.87 KiB | Viewed 635 times ]
Top
 Profile  
 
PostPosted: 12 Jun 2017 11:03 
Offline
mikroElektronika team
User avatar

Joined: 05 Dec 2016 14:59
Posts: 501
Hi,

have you tried setting Peripheral Module Disable (PMD registers) ?

From page 205 on datasheet.

Try setting QEI2 module and disabling ADC and CMP modules.

Regards,

Danilo


Top
 Profile  
 
PostPosted: 12 Jun 2017 13:09 
Offline

Joined: 10 Jun 2017 03:16
Posts: 3
Hi,Danilo
thank you very much!
I just try to disable the ADC and CMP module, but the POS2CNT still no change.
My code:
    PMD1bits.ADCMD=1;
    delay(5);
    PMD3bits.CMPMD=1;
    delay(5);
    PMD3bits.QEI2MD=0;
    delay(5);
    PMD7bits.CMP2MD=1;
    delay(5);
    PMD7bits.CMP3MD=1;


Best regards,
Xavi


Top
 Profile  
 
PostPosted: 14 Jun 2017 09:52 
Offline
mikroElektronika team
User avatar

Joined: 05 Dec 2016 14:59
Posts: 501
Hi,

I did a little search online, are you sure this MCU has QEI two modules?

http://www.microchip.com/forums/m580423.aspx

Also on page 261 FIGURE 17-1

Note 1: The QEI1 module can be connected to the QEA1/QEB1/INDX1or AQEA1/AQEB1/AINDX1 pins, which are controlled by clearing
or setting the ALTQIO bit in the FPOR Configuration register. See Section 24.0 “Special Features” for more information.

So it's unclear to me what pins are to be used for QEI2.

Regards,

Danilo


Top
 Profile  
 
PostPosted: 15 Jun 2017 15:04 
Offline

Joined: 10 Jun 2017 03:16
Posts: 3
Hi Danilo,

thank you very much!

In fact, I used the method mentioned by Note1 and solved the problem.

And it's also unclear to me whether the MCU really has two QEI modules!!!

But the datasheet clearly states that there are two QEI modules! Please look the picture.

Ps:attach a picture of my circuit board.

Best regards,

Xavi


Attachments:
IMG_20170615_212912.jpg
IMG_20170615_212912.jpg [ 3.84 MiB | Viewed 603 times ]
捕获.PNG
捕获.PNG [ 89.36 KiB | Viewed 603 times ]
Top
 Profile  
 
PostPosted: 16 Jun 2017 15:33 
Offline
mikroElektronika team
User avatar

Joined: 05 Dec 2016 14:59
Posts: 501
Hi,

you are welcome.

Regards,

Danilo


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to: