Bit Angle Modulation (BAM) in a PIC


Closed Thread
Results 1 to 40 of 151

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Ioannis:

    You might want to remap the LED's brightness curve to compensate for the non-linearity in perceived brightness.

    This are the values I use
    Code:
    data @$0, $00,$00,$01,$01,$01,$01,$02,$02,$02,$03,$03,$03,$04,$04,$04,$04,$05,$05,$05,$06,$06,$06,$07,$07,$07,$08,$08,$08,$09,$09,$0A,$0A
    data      $0A,$0B,$0B,$0B,$0C,$0C,$0C,$0D,$0D,$0E,$0E,$0E,$0F,$0F,$10,$10,$10,$11,$11,$12,$12,$13,$13,$13,$14,$14,$15,$15,$16,$16,$16,$17
    data      $17,$18,$18,$19,$19,$1A,$1A,$1B,$1B,$1C,$1C,$1D,$1D,$1E,$1E,$1F,$1F,$20,$20,$21,$21,$22,$23,$23,$24,$24,$25,$25,$26,$27,$27,$28
    data      $28,$29,$2A,$2A,$2B,$2B,$2C,$2D,$2D,$2E,$2F,$2F,$30,$31,$31,$32,$33,$33,$34,$35,$35,$36,$37,$37,$38,$39,$3A,$3A,$3B,$3C,$3D,$3D
    data      $3E,$3F,$40,$40,$41,$42,$43,$44,$44,$45,$46,$47,$48,$49,$49,$4A,$4B,$4C,$4D,$4E,$4F,$50,$51,$51,$52,$53,$54,$55,$56,$57,$58,$59
    data      $5A,$5B,$5C,$5D,$5E,$5F,$60,$61,$62,$63,$64,$65,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F,$71,$72,$73,$74,$75,$77,$78,$79,$7A,$7B,$7D
    data      $7E,$7F,$81,$82,$83,$84,$86,$87,$89,$8A,$8B,$8D,$8E,$8F,$91,$92,$94,$95,$97,$98,$9A,$9B,$9D,$9E,$A0,$A1,$A3,$A4,$A6,$A7,$A9,$AB
    data      $AC,$AE,$B0,$B1,$B3,$B5,$B6,$B8,$BA,$BB,$BD,$BF,$C1,$C3,$C4,$C6,$C8,$CA,$CC,$CE,$D0,$D1,$D3,$D5,$D7,$D9,$DB,$DD,$DF,$E1,$E3,$E6
    Then just
    Code:
    READ LED, LED

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default

    Hi gmglickman,

    Hmm, nice, thanks for the post. I was thinking more complicated on this!

    Ioannis

  3. #3
    Caius1's Avatar
    Caius1 Guest


    Did you find this post helpful? Yes | No

    Default Regarding blink

    Hi,

    I came across this topic when browsing for BAM.

    Regarding the blink can you verify that the blink still occurs when:
    1 The last value of the period = 2^nBits - 2 instead of 2^nBits-1
    2 New value is only updated at the start of a pwm period.

    It would seem strange to me if it does.
    I think that a blink can only occur form value=0 to value=x

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Caius1 View Post
    Regarding the blink can you verify that the blink still occurs when:
    1 The last value of the period = 2^nBits - 2 instead of 2^nBits-1
    2 New value is only updated at the start of a pwm period.
    I assume you mean reversing the order of bits 6 and 7.

    Yes, the blink still occurs. It just happens at different numbers.
    No matter which way you order the bit's, if they are only scanned in one direction, there will always be a blink at some point.

    I also found that at other points in the dutycycle, the original BAM has several more less obvious blinks as the phase shift does the exact same thing in the lower bits. You just can't see them as well because they are shorter periods. But if you stare right at the LED straight on, you can definitely see them.

    However, the symmetrical nature of the Mirror Imaged waveform, completely eliminates ALL of the blinking. It's really amazing how well it fixed the problems.

    You can see how it works from the animation in this thread ...

    MIBAM - (Mirror Imaged Bit Angle Modulation)
    http://www.picbasic.co.uk/forum/showthread.php?t=10564
    DT

  5. #5
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    6


    Did you find this post helpful? Yes | No

    Exclamation Cylon Scanner Error message

    Hi Darrel.

    I am testing your Cylon Scanner
    code on a 887 chip at 8MHz.

    I am stuck on this error:

    Error[118] c:\pbp\mibam-~1.asm 97:Overwriting previous address contents (2007)

    In fact, the code is a copy of the example. Nothing more or less. Of course the part about wsave is included too. Attached is the final test code.

    Regards,
    Konrad
    MIBAM_Cylon.pbp.txt

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


    Did you find this post helpful? Yes | No

    Default

    Try this thread ... post#5

    Presetting Configuration Fuses (PIC Defines) into your Program
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    Or, just delete the __config line, which will then use the PBP default configs.
    <br>
    DT

  7. #7
    Join Date
    Mar 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default bam is ok

    u will let it to 2.45kHz. the led will be not blink. i have test it.

    last week, i send some thread. they r disappear, my god!

    mbam will not solve the blink problem absolutely. from 127 to 128 change so much the same.

    the best way is let more interrupt. and let the bit7 or bit6 or bit5 or bit4's time average in the period.
    Last edited by lanyong; - 28th March 2009 at 14:21.

  8. #8
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Smile Testing your code

    Darrel,
    I started this link when I was working on an RGB backlight. I have been away from this task for quite some time but plan to get back into next month.
    You mentioned that you are willing to let someone test out your code. I am using a 16F819. Will it run on this chip? Are you still looking for someone to do some testing?

  9. #9
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Mybam

    DT

    I'm sorry to ask a basic question when this development/discussion is well under way.

    I don't see why one PWM output needs 256 interrupts per cycle? I would have thought only one was needed - at the appropriate time in the cycle?

    I'm missing something here - probably brains!

    Regards Bill Legge

  10. #10
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Mybam

    DT

    Sorry to ask a basic question when the discussion is well advanced.

    I don't see why 256 interrupts are needed for one PWM signal? I would have thought that one interrupt - at the appropriate time - in the cycle would do the trick?

    I'm missing something? Brains?

    Regards Bill Legge

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 : 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