This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRV8412-C2-KIT programming

Hello,

I bought the DRV8412-C2-KIT, and I added a coder linked to J2 and to a motor.

I added a few lines in the program (using CCS) to add a variable to  know how many rotation has the motor done, but it doesn't seem to work. Here is the program (added in the file 2xDC_Motor.c) :

if (EQep1Regs.QPOSCNT == 0)          //     QPOSCNT in INDEX mode (00)                        
           {                                  
               qep1.NbTour = qep1.NbTour + 1 ;        //adds 1 each time the did 1 rotation
          }   

The program thas increment, but it thas it much to quickly. I first tried with RawTheta, but that to didn't work out.

I checked the LineEncoder of the coder and entered the correct number in the program, so that's not the problem.

Would you know what I should put in the program to get the number of rotation of the motor?

Would it be possible to enter a number of rotations, that would be send to the coder which would make turn the motor of the number of rotations?

Can anyone help please?

Thanks

  • Deny,

    I am moving this post to our MCU team to address. 

  • Hello Ryan,

    I wanted to know if the MCU team has had any time to lock into the problem?

    Deny

  • Hello Ryan,

    I meant to look, not lock.

    Deny

  • Hi,

      I tried with this program :

      if (EQep1Regs.QPOSCNT == EQep1Regs.QPOSMAX && qep1.DirectionQep == 0)   // if the motor turns in one direction and QPOSDNT gets to the maximum, add 1
               {                                                                                                           
                qep1.NbTour = qep1.NbTour + 1 ;                  // add 1
            //  EQep1Regs.QPOSCNT=0    ;                        // I tried forcing the value QPOSCNT  to 0 to get out of the, but the program still added more than 1
               }    

     if (EQep1Regs.QPOSCNT == 0 && qep1.DirectionQep==1)                 // if the motor turns in one direction and QPOSDNT gets to the maximum, remove 1                              
               {                                                                                                           
             qep1.NbTour = qep1.NbTour - 1 ;                                 //remove 1  
      //     EQep1Regs.QPOSCNT=EQep1Regs.QPOSMAX ;  // I tried forcing the value QPOSCNT  to the max value to get out of the, but the program still removed more than 1         }      

    I really can't understand where my mistake is.

    As for adding a parameter allowing to tell the coder how many rotation to do, any help would be welcomed.

    Deny