Component: PWM (Internal) (General Output)
Author | Matrix Ltd |
Version | 1.0 |
Category | General Output |
Contents
PWM (Internal) component
Pulse Width Modulation, a versitile way of generating a digital pulse using mark / space modulation. Uses the capture compare peripherals onboard most Microcontrollers to generate accurate waveforms without any intervention from the processor. Useful for generating audio, controlling the speed of motors, brightness of LED etc.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_PWM_Output.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_PWM_Output.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Here is a basic example to control the PWM duty based on an ADC reading.
Digital PWM trace
Here is another basic example which ramps the PWM duty cycle up and down. If the PWM output pin is connected to a LED and series resistor then the LED will smoothly transition between on bright and off.
Macro reference
ChangePeriod
Disable
![]() |
Disable |
Disables a PWM channel and allows the default output / input state to be resumed | |
![]() |
Return |
Enable
![]() |
Enable |
Enables a PWM channel as an output overriding the default output pin state. | |
![]() |
Return |
SetDutyCycle
SetDutyCycle10Bit
SetFrequency
![]() |
SetFrequency |
Sets a PWM of the specifed frequency at a duty of 50% Ideal use is a frequency generator | |
![]() |
Frequency |
Enter frequency in Hz | |
![]() |
Return |