Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. void TimerCaptureCompare_Ch2_Callback()
  2. {
  3. /* Get the Input Capture value */
  4. uwIC2Value = LL_TIM_IC_GetCaptureCH2(TIM3);
  5.  
  6. if (uwIC2Value != 0)
  7. {
  8. /* Duty cycle computation */
  9. uwDutyCycle = (LL_TIM_IC_GetCaptureCH1(TIM3) * 100) / uwIC2Value;
  10.  
  11. /* uwFrequency computation
  12. TIM3 freq = SystemCoreClock */
  13. uwFrequency = SystemCoreClock / (1*uwIC2Value);
  14. }
  15. else
  16. {
  17. uwDutyCycle = 0;
  18. uwFrequency = 0;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement