Gast
#5823735
Hallo zusammen,
ich habe ein Problem und zwar die Duty Cycle zu berechnen. Die Variable
duty bleibt immer null. Aber wenn ich die Variable duty so
duty=Puls_new/9; berechne, dann hat die Variable duty einen Wert.
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
puls2=Puls_new+Puls_freq;
duty=Puls_new/puls2;
}
/* USER CODE END 3 */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
if(htim==&htim5){
Puls_new=HAL_TIM_ReadCapturedValue(&htim5,TIM_CHANNEL_4); //Falling
Puls_freq=HAL_TIM_ReadCapturedValue(&htim5,TIM_CHANNEL_1); // Rising
__HAL_TIM_SetCounter(&htim5,0);
}
}
Puls_new >> Ton
Puls_freq>> Toff
kann Jemand bitte helfen ?



