Jump to content

Pic18f520 Dead Band Delay For Pwm


Recommended Posts

I've setup the PWM function on my pic to run two channels, which will be used to control the turning on of two igbts, but for some reason I can not get the Dead Band Delay to work. The PWM is working fine, but no matter what adjustments I make to my PWM1CON register no delay appears on the scope.

 

My code is below, any help would be great. Thanks

 

By the way I'm working with a 12Mhz clock.

 

Main:

 

banksel TRISC

 

movlw b'00000010'

movwf TRISC

movlw b'00010000'

movwf TRISD

 

banksel PR2

movlw b'01000000'

movwf PR2

 

banksel CCPR1L

movlw b'00011010'

movwf CCPR1L

movlw b'10001100'

movwf CCP1CON

 

banksel PWM1CON

movlw b'00001000' ;Bit 7 sets auto reset

movwf PWM1CON ;Bits 6:0 Dead Band Delay

 

banksel PIR1

bcf PIR1,TMR2IF

 

banksel T2CON

movlw b'00000100' ; Sets up the timer w/ a 1/16 scaler

movwf T2CON ; Timer2 Register

 

banksel TRISC

clrf TRISC

clrf TRISD

 

banksel ECCP1AS

bcf ECCP1AS,ECCPASE

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...