How do folks achieve 8 bit hpwm at low hpwm frequency?


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default How do folks achieve 8 bit hpwm at low hpwm frequency?

    So I've put myself in a bit of a corner...I've writen a moster program that needs 8 pit pwm.

    My PIC oscillator is running at 4Mhz, so a PR2 value of 63 yields about pwm 255 values @15.7 khz....all was well until I started switching a P-chan mosfet via an n chan mosfet (I really need a hi side load switch but I don't have any & it would need a pcb rejig even if I did!), so what I'm doing is this...

    (yes I know the symbols are trannies...I was lazy - since the package pins are the same as my sot23 fets so just used them on the schematic!)


    Trouble is that 22k resistor combined with the total source/drain capacitance of the first fet Q7 ....it is essentially screwing up the square wave signal as it appears on the second fet gate. (I scoped the gate of the first fet - lovely clean square wave - scoped the gate of the second fet - it has a typical CR rise slope thing going on - it's not square anymore)...this is really screwing up the response of my load (LEDs)

    Lowering the value of the 22k resistor to 1K all but negates the problem, but 1k is lower than I really wanted to go...so my other option is to lower the hpwm frequency. But mucking about with all with Mister e's calc shows that as I take the hpwm base frequency down the hpwm resolution goes up...I don't want any more than 256 bits resolution - so what to do?

    I guess I could go with 512 bits of hpwm resolution, then multiply everything in my code by two to make it correlate with the 512 bits of hpwm (but I've 8 bit lookup tables in my code to get the leds to fade smoothly...pretty sure going this way would screw that aspect up!).

    I guess I could take the PIC oscillator down below 4Mhz too (but I've some pretty time intensive things happening in my program - not sure this would be a wise move!)

    Anyone got other ideas?
    Last edited by HankMcSpank; - 23rd October 2011 at 11:44.

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