(C) COPYRIGHT 2015 WIZnet Co.,Ltd.
- file : PWM/CaptureMode/readme.md
- author : IOP Team
- version : V1.0.0
- date : 01-May-2015
- brief : Description of the PWM Capture Mode example.
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, WIZnet SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
This example shows how to use the PWM peripheral to run capture mode.
The PWM channel 0 frequency is set to SystemCoreClock(Hz), the Prescaler is 2 so the PWM0 counter clock is 10 MHz. SystemCoreClock is set to 20 MHz.
The PWM channel 0 is configured in Timer Mode and duty cycle is 50 %. Timer/Counter is up-count mode and periodic mode. Capture mode is rising edge detection. 1 interrupts out of 3 interrupts are enabled: capture interupt(match and overflow interrupt is excepted).
The Timer/Counter runs periodically and if capture signal(PC_00) is received, the Timer/Counter value is saved at capture register and capture interrupt is occurred. In capture interrupt handler, RED LED(PC_08) is toggled.