Linearizing an LED for 800 pwm steps'?


Results 1 to 37 of 37

Threaded View

  1. #31
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Linearizing an LED for 800 pwm steps'?

    Hi Hank,

    Sorry for the late reply. Glad you figured it out. Another slightly more recent version of that Gamma Table program is listed below.

    Gamma values of 1.7 to 1.9 worked good for me but it's very much dependent on your LEDs, voltage, hardware, etc..

    Cheerful regards, Mike

    Code:
     '  Leo Bodnar's 'antilogarithmic'
     '  gamma correction algorithm (Mike, K8LH)
     '
     '  JustBASIC (free) interpreter
     '
     Input "Gamma array size: "; arraysize
     Input " Total PWM steps: "; width
     Input "Gamma correction: "; gamma       ' try 0.5 to 1.0
     Input "Entries per line: "; entries     '
    
     FOR index = 0 to arraysize-1
        dcyval = INT(width^(((index+1)/arraysize)^gamma)+.3)
        if(index MOD entries = 0) then
          PRINT
          PRINT "  DW ";
        else
          PRINT ",";
        end if
    
        if(dcyval < 100) then print " ";
        if(dcyval < 10) then print " ";
        PRINT dcyval;
     NEXT index
     PRINT
     PRINT
     REM CLOSE
    Last edited by Mike, K8LH; - 11th May 2013 at 01:14.

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