AnsweredAssumed Answered

MC9S12ZVML128_BLDC_Sensorless adding ADC

Question asked by Sohyun Jang on Aug 20, 2017
Latest reply on Mar 26, 2018 by Matej Pacha

Hi.

 

I use MC9S12ZVML128_BLDC_Sensorless example project.

 

I want to add ADC (AN0_3(position sensor (sin)), AN1_3(position sensor (cos)).

 

And then, I modified a code.

 

PR_SECTION(ptuTrigE)
  volatile short PTUTriggerEventList[PTU_TOT_TRIGGERs_GEN_NO][PTU_TOT_LISTS_NO][4] = {
                                              {   /*DelayT0 */
                                                  {0x0100,0x0200,0x0300,0x0000},{0x0000,0x0000,0x0000,0x0000}
                                         
                                              },
                                              {
                                                {0x0100,0x0200,0x0000,0x0000},{0x0000,0x0000,0x0000,0x0000}
                                               
                                              }
                                            };

 

volatile char ADC0CommandList[6][4] = {
   {0x40,0xD0,0x00,0x00}, // current sense channel, end of sequence [D0]
   {0x40,0xCB,0x00,0x00}, // end of list + no int [C0], HD voltage [CB], 4 clock cycles sample time [00], reserved [00]
   {0xC0,0xD3,0x00,0x00},
   {0x00,0x00,0x00,0x00},
   {0x00,0x00,0x00,0x00},
      {0x00,0x00,0x00,0x00}
};

 

PR_SECTION(adcLists)
  volatile char ADC1CommandList[6][4] = {
   {0x40,0xCA,0x00,0x00}, // [end of list] + no int [C0], phase voltage [CA], 4 clock cycles sample time [00], reserved [00]
   {0xC0,0xD3,0x00,0x00},
   {0x00,0x00,0x00,0x00},
   {0x00,0x00,0x00,0x00},
   {0x00,0x00,0x00,0x00},
      {0x00,0x00,0x00,0x00}
  };

 

Getting ADC value is OK, but BLDC motor is not ruuing.

 

how can I modify the code?

Outcomes