Changes for page 3.5.03 MC_PWM

Last modified by xingzhi lin on 2025/12/03 23:06

From version 1.1
edited by xingzhi lin
on 2025/12/03 17:15
Change comment: There is no comment for this version
To version 4.1
edited by xingzhi lin
on 2025/12/03 23:06
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,0 +1,75 @@
1 +== **Instruction format** ==
2 +
3 +|**Instruction**|(% colspan="2" %)MC_PWM (FB)
4 +|**Name**|(% colspan="2" %)Pulse width modulation
5 +|(% colspan="2" %)**Graphical performance**|**ST performance**
6 +|(% colspan="2" %)(((
7 +(% style="text-align:center" %)
8 +[[image:1764774334496-387.png]]
9 +)))|(((
10 +MC_PWM(
11 +
12 +Enable: =
13 +
14 +OutputPort: =
15 +
16 +PulsePeriod: =
17 +
18 +PulseWidth: =
19 +
20 +InVelocity=>,
21 +
22 +Busy=>,
23 +
24 +Error=>,
25 +
26 +ErrorID=>);
27 +)))
28 +
29 +
30 +
31 +== **Related variables** ==
32 +
33 +|**Input variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
34 +|Enable|Enable|BOOL|[FALSE, TRUE]|FALSE|Level trigger
35 +|OutputPort|Pulse output port|BYTE|[0, 2, 4, 6]|0|PWM output port, support D0, D2, D4, D6 only
36 +|PulsePeriod|Pulse width|UINT|[0,65535]|0|Period: The width of the complete square wave. Unit: 1us
37 +|PulseWidth|High-level pulse width|UINT|[0,65535]|0|The width of the high level of the square wave. Unit: 1us
38 +
39 +
40 +
41 +|**Output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
42 +|InVelocity|Reaching set value flag|BOOL|[FALSE, TRUE]|FALSE|The pulse width frequency reaches the set value.
43 +|Busy|Execution flag|BOOL|[FALSE, TRUE]|FALSE|Execute output PWM square wave.
44 +|Error|Error flag|BOOL|[FALSE, TRUE]|FALSE|TRUE when an error occurred inside the function block.
45 +|ErrorID|Error ID|MC_ERROR|-|MC_NO_ERROR|Error ID, refer to MC_ERROR.
46 +
47 +
48 +
49 +== **Function description** ==
50 +
51 +(1) This function block realizes dynamic pulse width modulation;
52 +
53 +(2) After D0/D2/D4/D6 is configured as PWM function, control of D0 + D1/ D2 + D3/ D4 + D5 /D6 + D7 outputs is not allowed, during the execution of MC_PWM function block.
54 +
55 +
56 +== **Sequence diagram** ==
57 +
58 +(% style="text-align:center" %)
59 +[[image:1764774322875-747.png]]
60 +
61 +
62 +== **Error description** ==
63 +
64 +ErrorID in MC_ERROR describes the cause of the corresponding error.
65 +
66 +|**Error ID**|**Initial value**|**Description**
67 +|0|MC_NO_ERROR|No error
68 +|5|MC_PWM_PORT_ERROR|Port input error
69 +|6|MC_PWM_PORT_WAS_RUN|The corresponding port is running
70 +|7|MC_PWM_PERIOD_LESS_THAN_WIDTH|The pulse width is smaller than the high level pulse width
71 +|8|MC_PWM_PORT_WASNT_ENABLE|Port is not enabled
72 +
73 +
74 +
75 +
1764774322875-747.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.lxz
Size
... ... @@ -1,0 +1,1 @@
1 +14.0 KB
Content
1764774334496-387.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.lxz
Size
... ... @@ -1,0 +1,1 @@
1 +63.0 KB
Content