Hi, that worked a treat, here's the output after modifying with your snippets...

Code:
Gamma array size: 255
 Total PWM steps: 1023
Gamma correction: 2

DW   0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,  7,  8,  9,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18
DW  19, 20, 21, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 36, 37, 39, 40, 42, 44, 45, 47, 49, 51, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72
DW  74, 77, 79, 81, 83, 86, 88, 90, 93, 95, 98,100,103,105,108,111,113,116,119,121,124,127,130,133,136,139,141,144,148,151,154,157,160,163
DW 166,170,173,176,180,183,186,190,193,197,200,204,208,211,215,219,222,226,230,234,238,241,245,249,253,257,261,265,269,274,278,282,286,290
DW 295,299,303,308,312,317,321,326,330,335,339,344,349,353,358,363,368,373,377,382,387,392,397,402,407,412,417,423,428,433,438,444,449,454
DW 460,465,470,476,481,487,492,498,504,509,515,521,526,532,538,544,550,556,561,567,573,579,586,592,598,604,610,616,623,629,635,641,648,654
DW 661,667,674,680,687,693,700,707,713,720,727,734,740,747,754,761,768,775,782,789,796,803,810,817,825,832,839,846,854,861,868,876,883,891
DW 898,906,913,921,928,936,944,952,959,967,975,983,991,999,1007,1014,1023
Many thanks....this will save me a lot of time experimenting with different gamma values with the LUT going into the PIC