Hello, welcome to our forum.

It looks like you have registered but you have not yet posted and messages. Our requirements are that you must post at least two messages, to allow the moderators to review your registration, before you will be allowed access to the full range of forum areas.

Please make a couple of posts, until then you may see a notice that says you are banned from certain forum areas.

Thank you.

Remove Text Formatting

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008

    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


    if ch1 <255 then ch1 = ch1 +1

    Gosub leddrive

    GOTO Main

    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


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


  2. #2
    Join Date
    Feb 2003
    Sydney, Australia


    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.


Similar Threads

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

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