Other Parts Discussed in Thread: EK-TM4C1294XL
Hi,
I am working Pulse generation with different width and interval. My PWM setup is generating 20us of pulse width and 70ms of interval.
void init_pwm()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // system peripheral enable for GPIOF
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0); // system peripheral enable for PWM0
// SysCtlPWMClockSet(SYSCTL_PWMDIV_1); // pwm clock set
PWMClockSet(PWM0_BASE, PWM_SYSCLK_DIV_64);
GPIOPinConfigure(GPIO_PF0_M0PWM0); // Gpio pin function configuration as a pwm
GPIOPinTypePWM(GPIO_PORTF_BASE,GPIO_PIN_0 ); // Gpio pin for pwm
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_PWM0)) // wait for peripheral ready
{
// do nothing
}
PWMGenConfigure(PWM0_BASE,PWM_GEN_0,PWM_GEN_MODE_DOWN|PWM_GEN_MODE_NO_SYNC); // Pwm generation 0, down mode, no synchronization
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 4294967295); // pwm_generation 0, period set
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 36); // duty cycle
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT,true); // pwm output enable
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
}
I want to generate 20us of pulse width 1S of interval. HOW to setup PWM Module?
Regards,
Sumit Chaulya