Pulse-Width Modulation
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| - | ✓ | ✓ | ✓ | - | ✓ | ✓ | - | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S1 | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | ✓ | ✓ | ✓ |
| S2 | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | ✓ | ✓ | ✓ |
| D1 | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | ✓ | - | - |
| D2 | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | - | - | ✓ | - | - | - |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 5 |
Operands
| Operand | Description |
|---|---|
| S1 | The first operand. Entries are WORD data registers or constants. This is where the amount of pulse time, in milliseconds (ms), ON is stored. The value range is 1 ~ 65,535 (216-1). This value must not exceed S2. |
| S2 | The second operand. Entries are WORD data registers or constants. This is the frequency of the pulse to be output is stored. The value range is 1 ~ 65,535 (216-1). |
| D1 | The third operand. Entries are LWORD data registers. This is where the internal time is stored. DO NOT EDIT THESE SETS OF REGISTERS. |
| D2 | The fourth operand. Entries are BOOL data registers. This is where pulses are output. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
F11.0 turns ON when the value of S1 and S2 equal 0.
F11.0 turns ON when the value of S1 is greater than S2.
Instruction Behavior
The Pulse-Width modulation (PWM) instruction needs to meet certain criteria before using:
- Do NOT manipulate the value stored in D1, D1+1, D1+2, and D1+3.
- This is where timer values are stored by the PLC.
- The value range of S1 and S2 is as following:
- 1ms ≤ S1
- S2 ≤ 65,535ms
- S1 and S2 must be a WORD.
- Range: 1 ~ 65,535 (216-1)
- S1 ≤ S2
- The value of S1 CANNOT exceed the value of S2.
- If S1 = S2, D2 is always ON.
- The operation of PWM may be influenced by the scan time since the instruction uses a deviation of the internal timer.