Smooth LED fading via PWM


Results 1 to 40 of 55

Threaded View

  1. #22
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    so I'm running out of program memory, I'm presently using the subroutine below to lookup a counter value (count1 below) to get a preset hpwm value (duty)....

    Code:
    Smooth_fade:    
    Lookup count1, [ _
      0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, _
      1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3, _
      3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5,5, _
      5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8,8,8,9,9, _
      9,9,10,10,10,10,10,11,11,11,11,12,12,12,13,13,13,13, _
      14,14,14,15,15,15,16,16,16,17,17,18,18,18,19,19,20,  _
      20,20,21,21,22,22,23,23,24,24,25,26,26,27,27,28,29,  _
      29,30,31,31,32,33,33,34,35,36,36,37,38,39,40,41,42,  _
      42,43,44,45,46,47,48,50,51,52,53,54,55,57,58,59,60,  _
      62,63,64,66,67,69,70,72,74,75,77,79,80,82,84,86,88,  _
      90,91,94,96,98,100,102,104,107,109,111,114,116,119,  _
      122,124,127,130,133,136,139,142,145,148,151,155,158, _
      161,165,169,172,176,180,184,188,192,196,201,205,210, _
      214,219,224,229,234,239,244,250,255], duty
      return
    ,....now since I've not much program space left , is there any way I can win some room back by for example stuffing the above 256 bytes into EEPROM and then look up the values similar to above? (EEPROM is a bit of a new area to me...I've never had to bother with it before!)

    If so....would you be so helpful to put me on the right track? (I'm figuring the 256 bytes will need writing into the PIC at the time of programming it & from thereon afterwards it can be read from EEPROM while the program is running?)
    Last edited by HankMcSpank; - 12th September 2011 at 19:59.

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