PWM
Function Block - Generate a PWM signal.
Inputs
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
XIN |
REAL |
|
|
|
Input analog value. |
XinMin |
REAL |
|
|
|
Minimum input value. |
XinMax |
REAL |
|
|
|
Maximum input value. |
MinPulse |
TIME |
|
|
|
Minimum pulse time on output. |
Period |
TIME |
|
|
|
Period of the output signal. |
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Q |
BOOL |
|
|
Blinking PWM signal. |
Remarks
- The input value is truncated to [XinMin .. XinMax] interval.
- XinMax must be greater than XinMin.
- The signal is TRUE during:
(Xin - XinMin) * Period / (XinMax - XinMin)
FBD Language Example
FFLD Language Example
Not available.
IL Language Example
Not available.
ST Language Example
PWM1 is a declared instance of PWM function block.
PWM1 (rIn, rInMin, rInMax, tMinPulse, tPeriod);
Signal := PWM1.Q;