Gast
#5792508
Hallo zusammen,
ich wollte die Duty Cycle(Ton) eines PWM-Signales mit input capture mode
messesn. Es klappt leider nur fast bis 65% der Duty cycle. sonst wird
die T_off gemessen statt Ton. hat jemand eine Idee was man dieses
Problem lösen kann?
Timer Konfiguration ist im Ahnhand zu sehen.
Timer Initialization:
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_1);
HAL_TIM_Base_Start(&htim5);
HAL_TIM_IC_Start_IT(&htim5, TIM_CHANNEL_1);
Timer Interrupt:
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
if(htim==&htim5){
// HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
capture= HAL_TIM_ReadCapturedValue(&htim5,TIM_CHANNEL_1);
__HAL_TIM_SetCounter(&htim5,0);
}
}
