Difference between revisions of "Component: PWM (Internal) (General Output)"
(4 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_PWM_Output.fcfx FC_Comp_Source_PWM_Output.fcfx] |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/ | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_PWM_Output.fcfx FC_Comp_Source_PWM_Output.fcfx] |
==Detailed description== | ==Detailed description== | ||
Line 86: | Line 86: | ||
Digital PWM trace | Digital PWM trace | ||
− | [[File:PWMDigital. | + | [[File:PWMDigital.png]] |
Line 92: | Line 92: | ||
{{Fcfile|PWM_fader.fcfx|PWM Fader}} | {{Fcfile|PWM_fader.fcfx|PWM Fader}} | ||
− | |||
− | |||
− | |||
− | |||
Line 208: | Line 204: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | |||
− | |||
Latest revision as of 10:26, 20 October 2023
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 |