Bit Angle Modulation


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    26

    Default Bit Angle Modulation

    Has anyone had any luck with bit angle modulation.
    I have read the forum post that discribes it and come up with the folowing code.

    define osc 4

    ANSEL = %00000000
    CMCON0 = %00000111

    TRISA = %00000000
    PORTA = %00000000
    TRISC = %00100000
    PORTC = %00000000

    led VAR PORTC.0
    bc var byte
    ch1 var byte

    bc = 1
    ch1 = 0

    Main:

    if ch1 <255 then ch1 = ch1 +1

    Gosub leddrive

    GOTO Main

    leddrive:
    for bc = 1 to 8

    select case bc
    case 1
    led = ch1.7
    pauseus 5000
    case 2
    led = ch1.6
    pauseus 2500
    case 3
    led = ch1.5
    pauseus 1250
    case 4
    led = ch1.4
    pauseus 625
    case 5
    led = ch1.3
    pauseus 312
    case 6
    led = ch1.2
    pauseus 156
    case 7
    led = ch1.1
    pauseus 78
    case 8
    led = ch1.0
    pauseus 39
    end select
    next bc
    bc = 1
    return

    end

    This works fine for static values but when ramping up the led flickers as the level increments until after value 128. Any Ideas.

    Thanks

  2. #2
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    I played with it for a while last year, but could never get rid of the steppiness during fades. I used an interrupt routine and the level control was great, but fading showed gaps and all kinds of weird artifiacts.

    In the end I used a pic with three PWM channels to do the control I needed.


    Bill.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. Bit Angle Modulation (BAM) in a PIC
    By Bronx68 in forum mel PIC BASIC Pro
    Replies: 150
    Last Post: - 24th February 2015, 14:41
  3. MIBAM - (Mirror Imaged Bit Angle Modulation)
    By Darrel Taylor in forum Code Examples
    Replies: 2
    Last Post: - 15th February 2009, 17:02
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Members who have read this thread : 1

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