Hi Henrik,
Many thanks....after I posted that and went to bed ...I was lying with this still in my mind and then the penny dropped (pretty sad that I think about timers lying in bed with a foxy wife next to me!)....yes, you're quite right I can just use Timer0 as the timebase which frees up Timer2 for HPWM (which I've just done a program that uses manual HPWM @50khz that I can lift chunks from).
..once more unto the breach!
Many thanks!
PS as ever, you're right on the money with your HPWM calculations, just dug out that associated code ...
Code:
'HPWM SETTINGS (MANUAL SETTING OF THE REGISTERS VS THE PICBASIC HPWM COMMAND) uses timer 2
CCP1CON = %00001100 'Turn HPWM on on CCP1
CCPR1L.6 = 0 'I'm only using 8 bit PWM so clear the top two bits
CCPR1L.7 = 0 'I'm only using 8 bit PWM so clear the top two bits
CCPTMRS0 = 0 'CCP 'Timer select' register - these bits select 'CCP2 USING TIMER2'
PR2 =41 'a maximum of 167 steps available at a PWM FREQUENCY OF 48kHZ.
T2CON = %00000100 'TIMER2 ON 1:1 PRESCALER 1:1 POSTSCALER
Bookmarks