Changing PWM period value and duty cycle at DC start time T1
The PWM period value and the duty cycle can be set to predefined values during runtime when a DC timestamp is reached and thus used for synchronization with other processes.
The default values can be activated as described below (n = 0 for channel 1, n = 1 for channel 2).
Specification of duty cycle, period value and start time
- 0x70n0:11 "PWM output":
The percentage duty cycle (Duty cycle: TON / T) is specified in "PWM output" [0 ... 100 %] to change the pulse-pause ratio. The pulse-pause TOFF is calculated automatically as the difference to the 100 % pulse value.
Desired pulse-pause ratio(Duty cycle) | Value range in hex | Value range in dec |
---|---|---|
100 % | 7FFF | 32767 |
50 % | 3FFF | 16383 |
0 % | 0 | 0 |
- 0x70n0:12 "PWM period":
Specification of the PWM period in µs (corresponds to a frequency specification).
The resolution of the output signal depends on the frequency or period value specification.
The valid value range in this mode corresponds to:
Output frequency: min. approx. 20 Hz, max. 300 kHz - The number of steps changes depending on the set frequency. The resolution decreases with decreasing period value or increasing PWM frequency.
The resolution or step size can be read in CoE object 0x80nE:01 "Timer resolution".
![]() | Common specification of the "PWM output" and "PWM period" parameters To ensure a time-synchronized transition of the PWM parameters, the parameters (0x70n0:11 "PWM output", 0x70n0:12 "PWM period") must always be transferred or changed as a pair. |
- 0x70n0:13 "DC start time" (T1)
Corresponds to the T1 time, it is a 64-bit DC start time in ns.
The time in 0x6001:11 "Sys Time" corresponds to the system time of the µController and can be used as a reference point. However, this time is subject to jitter. - 0x7000:05 "DCSyncOutCh2":
If there is no PWM output on channel 2 (PDOs for the second channel are not assigned), it can be used for a DC-synchron output. After activation via 0x7000:05 “DCSyncOutCh2” = TRUE, the output of channel 2 is toggled with the DC event and the switching of the PWM unit with each new valid start time.
Application of values immediately or after the end of the current period
When the specified values are to be applied is defined via
- 0x70n0:03 "DC Immediately" = TRUE (see example 1)
When a DC timestamp is reached, the specified PWM output takes place immediately.
The current period is aborted. This causes glitches in the output. - 0x70n0:03 "DC Immediately" = FALSE (see example 2)
When a DC timestamp is reached, the PWM output only takes place after the current period has been completed. This ensures glitch-free conversion of the PWM output.
Activating the transfer, switching PWM output on or off
- Transferring the values, switching on PWM output
The transfer of the values must then be confirmed via "Activate DC start time".
0x70n0:02 "Activate DC start time" = TRUE
If this bit is set, a PWM output with the transferred parameters (0x70n0:11 "PWM output", 0x70n0:12 "PWM period") is initiated with each new DC start time. - Switching off PWM output
0x70n0:02 "Activate DC start time" = FALSE
The PWM output is stopped while the period is running.
Confirmation of the transferred values
- 0x60n0:05 "Feedback PWM" = TRUE, with correct DC event
If the desired "DC start time" (T1) is reached, this is confirmed via bit 0x60n0:05 "Feedback PWM". This bit toggles with every correct DC event and the next event can be activated. - 0x60n0:06 "Err. Start Time", 0x80nE:04 "DC error counter", if start time is in the past
If the "DC start time" set is already in the past, the PWM output takes place immediately, taking into account the conditions set in 0x70n0:13 "DC Immediately". - The transfer is reported via 0x60n0:06 "Err. Start time" = TRUE and
- the error counter is incremented under 0x80nE:04 "DC error counter".
- The error counter is reset and the error message acknowledged by setting
0x70n0:04 "ErrAck" = TRUE.
Further Information