Bit Angle Modulation (BAM) in a PIC


Results 1 to 40 of 151

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default BAM vs PWM.

    <table><tr><td>PWM (Pulse Width Modulation) has 2 periods per cycle.
    There's the period when the output is HIGH, and the period when it is LOW.

    There will always be only 2 periods, and together they add up to the time it takes for 1 complete cycle. The ratio of the "ON" time to the total Cycle time defines the DutyCycle. (Corrected by The Borg)

    BAM (Bit Angle Modulation) has as many periods as there are Bits in the Resolution. For instance, 8-bit resolution (0-255) would have 8 periods per cycle.

    Each Period has a duration that corresponds to the Bit number, with each period being half as long as the previous one.

    </td><td></td></tr><tr><td valign=top><hr>Assuming a 100hz refresh rate, each cycle will take 0.01 sec. (1/100)

    Bit 7 of the DutyCyle will last for half of that, or 0.005 sec.
    Bit 6 is half of that again, or 0.0025 sec.
    then, continuing to divide in half each time, you end up with the lowest bit taking 0.000039 sec, (39 uS).

    When you add up all the "ON" times for the example at DutyCycle=168, then you'll get 0.0065625 sec. which is the exact same amount of time that the PWM cycle would have been "ON" during it's Single "ON" Period.

    This works good for controlling anything that depends on the Average Output, like LED's. But, it's not good for driving motors, or anything with inductance. </td><td></td></tr></table>
    <hr>
    Why is it better than PWM?

    Well, the real savings come in when you have Multiple Outputs.

    With 8-bit PWM, you would have to Interrupt 256 times per cycle to accommodate multiple outputs switching at different times.
    And at 100 Hz refresh rate, it would need 25,600 interrupts per second.

    But with BAM, you only need 8 Interrupts per Cycle (1 for each bit of resolution), and @ 100Hz, that's only 800 Interrupts per Second or 3% of the processing power required for software PWM.

    So now that it has all this extra time on it's hands, the PIC can control the brightness of 16-32 or more LED's, and still have time left over to do the animations.

    More on BAM ...
    http://www.artisticlicence.com/app%20notes/appnote011.pdf<!-- BitAngleModulation.pdf -->
    Last edited by Darrel Taylor; - 30th October 2007 at 19:25. Reason: Paul found a mistake.
    DT

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. Cordic trig assembly code for PIC18f
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 54
    Last Post: - 8th September 2015, 05:36
  3. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 16:10
  4. MIBAM - (Mirror Imaged Bit Angle Modulation)
    By Darrel Taylor in forum Code Examples
    Replies: 2
    Last Post: - 15th February 2009, 16:02
  5. Bit Angle Modulation
    By BH_epuk in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th November 2008, 07:01

Members who have read this thread : 2

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