Other Parts Discussed in Thread: HALCOGEN, TMS570LS1115
Hello,
I am new to the TMS570.
In my application (motor control), I need PWM outputs with variable duty cycle and frequency. I tried to use HALCOGEN to generate source code for PWM. But it produces constant-frequency and constant-dutycycle source code as I have attached below.
How can I modify the HALCOGEN generated source code to vary PWM parameters? I have highlighted the bits regarding the duty cycle and frequency (/* Data */ sections).
Thanks!
Arif
/* MOV64: PWM 0 -> Duty Cycle Update
* - Instruction = 41
* - Next instruction = 42
* - Conditional next instruction = 2
* - Interrupt = 1
* - Pin = 8
*/
{
/* Program */
0x00054201U,
/* Control */
(0x00004007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)8U << 8U) | (uint32)((uint32)3U << 3U)),
/* Data */
45184U,
/* Reserved */
0x00000000U
},
/* MOV64: PWM 0 -> Period Update
* - Instruction = 42
* - Next instruction = 3
* - Conditional next instruction = 41
* - Interrupt = 2
* - Pin = na
*/
{
/* Program */
0x00006202U,
/* Control */
(0x00052007U),
/* Data */
89984U,
/* Reserved */
0x00000000U
},