microchip - dsPIC33EV256GM002 PWM settings -
i developed simple program produce pwm waveform on dspic33ev256gm002 can't disable it. used pwm1 , pwm2 , generate pwm waveform on pwm1l1 pin (pin 26 on dip package) maintain pwm1h1 (pin 25 on dip package) digital i/o. teorically pwm register setting: iocon1bits.penl = 1; /* pwm1l controlled pwm module / iocon1bits.penh = 0; / pwm1h controlled gpio module */ should but, using , oscilloscope, noticed pwm waveform on pwm1h1 pin, opposite value (when pwm1l 1 pwm1h 0 , veceversa) if should digital i/o.
did find similar problem ?
thank , cooperation
regards
i used following code:
trisbbits.trisb10 = 0; /* set digital output */ trisbbits.trisb11 = 0; /* set digital output */ trisbbits.trisb12 = 0; /* set digital output */ trisbbits.trisb13 = 0; /* set digital output */ trisbbits.trisb14 = 0; /* set digital output */ trisbbits.trisb15 = 0; /* set digital output */ latbbits.latb10 = 0; /* set digital output */ latbbits.latb11 = 0; /* set digital output */ latbbits.latb12 = 0; /* set digital output */ latbbits.latb13 = 0; /* set digital output */ latbbits.latb14 = 0; /* set digital output */ latbbits.latb15 = 0; /* set digital output */ portbbits.rb10=0; portbbits.rb11=0; portbbits.rb12=0; portbbits.rb13=0; portbbits.rb14=0; portbbits.rb15=0; ptper = 4000; /*~~~~~~~~~~ pwm1 configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ iocon1bits.penl = 1; /* pwm1l controlled pwm module */ iocon1bits.penh = 0; /* pwm1h controlled gpio module */ iocon1bits.pmod = 0; /* select independent output pwm mode */ pdc1 = 500; /* initial duty cycle */ dtr1 = 0; /* deadtime setting */ altdtr1 = 0; /* deadtime setting */ phase1 = 0; /* no phase shift */ /*~~~~~~~~~~~ pwm2 configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ iocon2bits.penh = 1; /* pwm2h controlled pwm module */ iocon2bits.penl = 0; /* pwm2l controlled gpio module */ iocon2bits.pmod = 0; /* select independent output pwm mode */ pdc2 = 2000; /* initial duty cycle */ dtr2 = 0; /* deadtime setting */ altdtr2 = 0; /* deadtime setting */ phase2 = 0; /* */ ptconbits.pten = 1; /* enable pwm module */
i faced same problem dspic33ev32gp002 , did change in configuration bits as:
// fdevopt #pragma config pwmlock = off
this worked me
Comments
Post a Comment