I'm doing an RGB colour changing light.It has 255 PWM steps. I'm doing interrupt driven software PWM for 3 channels.
Xtal OSC = 4Mhz
Interrupt rate is 32uS.
PWM Period :32uS X 256 = 8192uS
PWM frequency is 122Hz.
I can fade an LED from 0 to 255 steps without a problem.Now I want to add an 64 level gamma table to the 8bit PWM steps.
My problem is there is only 64 gamma values but I have 255 PWM steps,How to scale this down?
The below code hangs when "Brightness" register comes to 65
Thanks
Xtal OSC = 4Mhz
Interrupt rate is 32uS.
PWM Period :32uS X 256 = 8192uS
PWM frequency is 122Hz.
I can fade an LED from 0 to 255 steps without a problem.Now I want to add an 64 level gamma table to the 8bit PWM steps.
My problem is there is only 64 gamma values but I have 255 PWM steps,How to scale this down?
The below code hangs when "Brightness" register comes to 65
Code:
incf Brightness,F ;increments from 0 to 255
movf Brightness,W
call Gamma_Table ;call gamma value (contains 64 values)
movwf W_Brightness ;load gamma value
Thanks