What is the main function of PWM Capture?

Post Reply
a_ziliu
Posts: 207
Joined: 20 Mar 2017, 10:52

27 Mar 2017, 13:54

PWM Capture and PWM Output share the same hardware. When a rising edge or a falling edge occurs, the value of a PWM counter will be latched into the corresponding rising or falling latch register. At this time, whether to reload the PWM counter or an interrupt event occurs can be determined.
The PWM Capture is mainly used to measure the input waveform of high level and (or) a high-level pulse width. The following diagram is used as example for illustration:

To measure the time W2 from a rising edge to a falling edge (high level), the user can set the PWM counter reload value CN when a rising edge occurs. A falling latch value CFL can be obtained when a falling edge occurs. The time W2 can be calculated using the following formula:
(CN+1-CFL)*(prescale+1)*(clock divider)/PWM_CLK

Note: prescale: 8-bit prescale
clock divider: divider options
PWM_CLK: PWM clock source frequency

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests