PIC Dead Band Delay Issues

Thread Starter

davis1d0

Joined Mar 24, 2009
4
Hi all,

I'm using a PIC18F4520 to control 2 transistors. I've setup 2 channel PWM and it is working fine, but when I go to setup the delay between the two channels nothing happens.

Information on setup:
osc is 12Mhz
freq of pwm about 43khz
duty cycle is about 40% per channel.

Any help would be great, Thanks
Code:

;Start of main program
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
 

beenthere

Joined Apr 20, 2004
15,819
The hardware is a mystery. If the PWM circuit is controlled by 2 separate pins out of the PIC, turning one off before turning the other on should work. Be nice to see the circuit for confirmation, though.
 

Thread Starter

davis1d0

Joined Mar 24, 2009
4
thanks for responding....

there is no hardware off the pwm..... I'm working on getting the built in delay working. I'm using the pwm as the control for my half-bridge converter. At this point the register that is suppose to turn on and determine this delay seems to be doing nothing, I've read through the data sheets many times and I just can't seem to see where I've made an error or if I missed something.
 
Top