MATLAB: Is it possible to change the frequency of the PWM signal output that is generated from the DM6816 PWM block in xPC Target 4.2 (R2009b)

electric_motor_controlpower_conversion_controlpower_electronics_controlSimulink Real-Time

The documentation of the DM6816 PWM block mentions the approach to modify the duty cycle of the PWM output signal.
However, I am not able to find any information in the documentation that explains the approach to change the frequency of the PWM signal output that is generated.

Best Answer

The DM6816 PWM board 6816 is extremely limited in its ability to let you set the output frequency.
Referring to the DM6816/DM5816 User's Manual from Real Time Devices, the output frequency is always 256 ticks of the reference frequency. The duty cycle between 0 and 1 is a fraction of those 256 ticks.
The reference frequency is chosen by first selecting the clock source for the chosen channel. If you choose the 8 MHz clock for a group of 3 channels, then those have an output frequency of 8 MHz/256 = 31.250 KHz.
If you choose the output of timer 1, then you need to configure the timers. As discussed in the user manual for the board, the jumper group P5 selects the input clock source for the 3 timers.
The input to timer 1 can be the 8 MHz crystal, the output of timer 0, or an external signal.
The 3 frequency divisors are used by counters 0, 1 and 2.
So, if you are using the output of timer 1, and timer 1 is setup to have input from the 8 MHz clock, and the second entry in the divisors is N, then the output frequency is (8/N MHz)/256 = 31250/N Hz.
You can also cascade counters by setting timer 1 to use the output of timer 0 and then set the first two divisors. That allows you to get very low frequencies.
You can cascade all three by jumpering timer 2 to use the 8 MHz crystal and wire T/C out 2 back to external clock 0 input and then set timer 0 to use the external input.
However, note that that the above suggestions do not offer much control over the frequency because the hardware is designed in a specific manner.