Regarding my Post I put a counter in my interrupt, In the output I have a 1000Hz signal which it means I should have 1000 pulses in each second, but I get 100 pulses each second. what is my problem?
Prescale=7;Periode=7999;Pulse=3998;
void PWMControl(unsigned int Freq){
TIM_TimeBaseInitTypeDef TimeStructureure;
TIM_OCInitTypeDef TIMOCStructureure;
TimeStructure.TIM_Prescaler=Prescale;
TimeStructure.TIM_CounterMode=TIM_CounterMode_Up;
TimeStructure.TIM_Period=Period;
TimeStructure.TIM_ClockDivision=TIM_CKD_DIV1;
TimeStructure.TIM_RepetitionCounter=0;
TIM_TimeBaseInit(TIM4, &TimeStructure);
TIM_Cmd(TIM4, ENABLE);
TIMOCStructure.TIM_OCMode=TIM_OCMode_PWM2;
TIMOCStructure.TIM_OutputState=TIM_OutputState_Enable;
TIMOCStructure.TIM_OCPolarity=TIM_OCPolarity_Low;
TIMOCStructure.TIM_Pulse=Pulse;
TIM_OC1Init(TIM4, &TIMOCStructure);
//TIM_OC1PreloadConfig(TIM4, TIM_OCPreload_Enable);
TIM_ITConfig(TIM4,TIM_IT_Update,ENABLE);
}