Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

LM3S pwm dont working

$
0
0

hi;

he following codes compile is ok.but i cant get pwm outputs .I'm watchingoutputswithan oscilloscope(portd pind0,pind1,pind2,pind3).

why?

i cant found  errors..

all thanks..

my codes..

#include "C:\StellarisWare\inc/lm3s5g51.h"
#include "C:\StellarisWare\inc/hw_memmap.h"
#include "C:\StellarisWare\inc/hw_types.h"
#include "C:\StellarisWare\driverlib/gpio.h"
#include "C:\StellarisWare\driverlib/adc.h"
#include  "C:\StellarisWare\driverlib/pwm.h"

#include "C:\StellarisWare\driverlib/sysctl.h"
#include "C:\StellarisWare\driverlib/debug.h"

 int     main(void)     
{
        
SysCtlClockSet( SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN );        
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);        
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);        
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);        
GPIOPinConfigure(GPIO_PCTL_PD0_PWM0 );        
GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);        
PWMGenConfigure(PWM_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);        
PWMGenConfigure(PWM_BASE, PWM_GEN_1, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);        
 PWMGenPeriodSet(PWM_BASE, PWM_GEN_0, 64000);        
PWMGenPeriodSet(PWM_BASE, PWM_GEN_1, 64000);        
PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, 34000);        
PWMPulseWidthSet(PWM_BASE, PWM_OUT_1, 34000);        
PWMPulseWidthSet(PWM_BASE, PWM_OUT_2, 34000);        
PWMPulseWidthSet(PWM_BASE, PWM_OUT_3, 34000);        
PWMGenEnable(PWM_BASE, PWM_GEN_0);        
PWMGenEnable(PWM_BASE, PWM_GEN_1);          
          
 PWMGenEnable(PWM_BASE, PWM_GEN_0);        
PWMOutputState(PWM_BASE, PWM_OUT_0_BIT|PWM_OUT_1_BIT|PWM_OUT_2_BIT|PWM_OUT_3_BIT, true);                
SysCtlDelay((SysCtlClockGet() * 1) / 3);        

while(1)        
 {        
}

Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>