Hi
Im using TMS570LS1224 MCU for the control of 12 DC motors
I did a test to see the changes on the Duty cycle using this code:
/* Include Files */
#include "sys_common.h"
/* USER CODE BEGIN (1) */
#include "stdio.h"
#include "system.h"
#include "etpwm.h"
unsigned int c;
void main(void)
{
c=0;
/* Initialise EPWM and ECAP with GUI configuration */
etpwmInit();
//ecapInit();
etpwmStartTBCLK();
for(;;){
do{
etpwmSetCmpA(etpwmREG1, 15);
etpwmSetCmpB(etpwmREG1, 15);
etpwmSetCmpA(etpwmREG2, 15);
etpwmSetCmpB(etpwmREG2, c);
etpwmSetCmpA(etpwmREG3, c);
etpwmSetCmpB(etpwmREG3, c);
etpwmSetCmpA(etpwmREG4, c);
etpwmSetCmpB(etpwmREG4, c);
etpwmSetCmpA(etpwmREG6, c);
etpwmSetCmpB(etpwmREG6, c);
etpwmSetCmpA(etpwmREG7, c);
etpwmSetCmpA(etpwmREG7, c);
c+=5;
__delay_cycles(160000000);
}while(c<100);
c=0;
}
/* Start counter in CountUp mode */
//etpwmSetCount(etpwmREG1, 0);
//etpwmSetCounterMode(etpwmREG1, CounterMode_Up);
// while(1);
/* USER CODE END */
}
but when runing, the code did not work as expected.. Am I missing something???
The configuration was done using Halcogen with a Period of 10kHz. The PWM works fine. But the problem is the duty cycle does not change.
I don't know if the 0-100 is ok or if I should be using a different scale to reach the 0-100%
I have also configured the VCLK4 at 80MHz
Best regards