HPWM ....use Timer0?


Results 1 to 3 of 3

Threaded View

  1. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: HPWM ....use Timer0?

    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
    Last edited by HankMcSpank; - 18th June 2011 at 09:21.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts