cancel
Showing results for 
Search instead for 
Did you mean: 

u8 SVPWMEOCEvent(void) function in motor library V2.0

1205336750
Associate
Posted on September 26, 2014 at 04:52

This routine to be performed inside the end of conversion ISR,from the function ,we can see that the ext. adc triggeringis disable when the motor state is RUN.So,how can we to trigrer AD conversion for the next time?

/*******************************************************************************

* Function Name : SVPWMEOCEvent

* Description : Routine to be performed inside the end of conversion ISR

It computes the bus voltage and temperature sensor sampling

and disable the ext. adc triggering.

* Input : None

* Output : None

* Return : None

*******************************************************************************/

u8 SVPWMEOCEvent(void)

{

// Store the Bus Voltage and temperature sampled values

h_ADCTemp = ADC_GetInjectedConversionValue(ADC2,ADC_InjectedChannel_2);

h_ADCBusvolt = ADC_GetInjectedConversionValue(ADC1,ADC_InjectedChannel_2);

if ((State == START) || (State == RUN))

{

// Disable EXT. ADC Triggering

ADC1->CR2 = ADC1->CR2 & 0xFFFF7FFF;

}

return ((u8)(1));

}

void ADC1_2_IRQHandler(void)

{

//if(ADC_GetITStatus(ADC1, ADC_IT_JEOC) == SET))

if((ADC1->SR & ADC_FLAG_JEOC) == ADC_FLAG_JEOC)

{

//It clear JEOC flag

ADC1->SR = ~(u32)ADC_FLAG_JEOC;

if (SVPWMEOCEvent())

{

......

2 REPLIES 2
Gigi
Senior
Posted on September 29, 2014 at 09:05

Ciao Murphy Ding

Usually the ADC triggering is enabled during the update event of the timer (when the counter reach zero).

Ciao

Gigi

1205336750
Associate
Posted on October 01, 2014 at 10:26

Ciao Gigi:

Thank you very much for your reply,i have found the reason.