I have attached a file in asm.How can we do this in pic basic pro which has been done in this file.i.e to control a BLDC motor.but mainly first i want to just understand how to use this PPWM module.check its outputs with scope then build my own code.i have read app notes "AN900" regarding control of motor. it explains nicely all the detail except code is in asm.
I tried to do it myself also, just output a 20Khz signal om PWM outputs using PPWM:
while true
PTCON0=00000000 'page 8,step 1
PTPERL=$63 'a guess
PTPERH=$00
PWMCON0=01000000 'step 3
PWMCON1=00000000 'step 4
DTCON=00001010 ' a guess
OVDCOND=00000000 'step 6
OVDCONS=00000000
'POVD=00000000
'SEVTCMP=$0000
'step 8
PDC0L=$00
PDC0H=$00
PDC1L=$00
PDC1H=$00
PDC2L=$00
PDC2H=$00
PDC3L=$00
PDC3H=$00
SEVTCMPL=$00
SEVTCMPH=$00
TRISC.0=1
PTCON1=10000000 'or PTCON1.7=1
wend
Bookmarks