Hi there...long time no post, dusted my pic stuff down & have dived straight back in....almost out the blocks I'm stumbling - not with the picbasic aspect but maths, logs etc! (knew I should have paid more attention in maths classes!)
Anyway, I want to fade an LED up & down so it appears linear to the eye ...if I just step the LED linearly, my eye (& I guess everybody elses eyes!), sees the main brightness changes at the lower end of the stepping scale (so for example with 256 bits....the main visual brightness steps happen at the lower end of the range 0-50 ....with less perceivable change in steps as you head on up to 255 bits)....the end result is a lumpy fade up/down.
Now then, I need to use a PWM frequency of about 20khz (in case you're wondering the LED still seems to react ok at this frequency!) ...this is beacause the LED will be going into an audio circuit & past attempts have proved that the PWM signal bleeds into the signal very easy so low PWM frequencies are out ...the kludge is to put it above the hearing range of most......at 16Mhz, a 20khz signal gives 800 bits of resolution, so what I'm wanting is for some maths savvy person to give me a hint at how I would use a LUT for 800 values in a way that would make the LEDappear to be fading up/down linearly?
Any ideas?
Bookmarks