Difference between revisions of "HANcoder/STM32/Blocks/PWM Init"
(Created page with "{{HANcoder/block| info= A 'PWM Init' block configures one of the STM32 timer modules for PWM functionality, allowing a PWM signal to be generated on up to 4 timer channels an...") |
|||
Line 16: | Line 16: | ||
PWMInitMask.png | PWMInitMask.png | ||
+ | }} | ||
+ | == Block inputs (inports) == | ||
+ | Input: The value of the duty cycle in 100/1023[%].(512=50%, 1023=100%).(uint16)<br/> | ||
− | | | + | == Block parameters == |
− | | | + | {| class="wikitable" |
− | | | + | |- |
− | | | + | ! style="width:150px" | Parameter |
− | | | + | ! Description |
+ | |- | ||
+ | | Output pin | ||
+ | | Select the output pin where the PWM signal should be generated. | ||
+ | |- | ||
+ | | Sample time | ||
+ | | Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model. | ||
+ | |} | ||
− | + | == Examples == | |
+ | [[HANcoder/Examples/Workshop?| Workshop?]] | ||
+ | {{HANcoder/BlockFooter| | ||
+ | |SeeAlso = [[HANcoder/PWM_Duty_Cycle|PWM Duty Cycle]] | ||
}} | }} |
Revision as of 13:46, 21 April 2017
Supported Targets: Olimexino, E407, P405
Contents
General information about PWM Init
A 'PWM Init' block configures one of the STM32 timer modules for PWM functionality, allowing a PWM signal to be generated on up to 4 timer channels and their associated output pins. Additionally, a function-call subsystem can be connected to the IRQ output. The subsystem will execute each time a PWM period completes.
The generation of the PWM signal can be enabled and disabled per channel.
The frequency of the PWM signal is configured on a module level. So the same configured frequency is used on all enabled channels.
The timer module 1 on the STM32 (TIM1) has a special feature on the first 3 channels. It can output 2 signals on 2 micro controller pins where the second signal is the inverted of the first signal.
Block
Mask
Block inputs (inports)
Input: The value of the duty cycle in 100/1023[%].(512=50%, 1023=100%).(uint16)
Block parameters
Parameter | Description |
---|---|
Output pin | Select the output pin where the PWM signal should be generated. |
Sample time | Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model. |