Hi Guys and thanks for the input.

As requested here is the complete brightness routine that works when using Darrels software PWM.

Code:
brightness:
 
Lcdout $FE,2
LCDOUT $FE,$80,"Set Max Brightness"
IF H_butt = 0 THEN GOSUB up
IF M_butt = 0 THEN GOSUB down
If (maxbright * 100)/255 = 100 then
LCDOUT $FE,$C0,"Channel 1 "
LCDOut $FE,$D4,dec3 (maxbright *100)/255,"%"
endif

If (maxbright * 100)/255 =0 or (maxbright * 100)/255 <10 then
LCDOUT$FE,$C0,"Channel 1 "
LCDOut $FE,$D4,dec1 (maxbright *100)/255,"% "
endif

if (maxbright * 100)/255 >=10 and (maxbright * 100)/255 <100 then
LCDOUT$FE,$C0,"Channel 1 "
LCDOut $FE,$D4,dec2 (maxbright *100)/255,"%   "
endif
    B_max = maxbright 
write 8,b_max      
    
If S_butt = 0 then
    pause 200 
    goto brightness2
endif 
goto brightness

brightness2: 
 
Lcdout $FE,2
LCDOUT $FE,$80,"Set Max Brightness"
IF H_butt = 0 THEN GOSUB up
IF M_butt = 0 THEN GOSUB down
If (maxbright * 100)/255 = 100 then
LCDOUT $FE,$C0,"Channel 2 "
LCDOut $FE,$D4,dec3 (maxbright *100)/255,"%"
endif

If (maxbright * 100)/255 =0 or (maxbright * 100)/255 <10 then
LCDOUT$FE,$C0,"Channel 2 "
LCDOut $FE,$D4,dec1 (maxbright *100)/255,"% "
endif

if (maxbright * 100)/255 >=10 and (maxbright * 100)/255 <100 then
LCDOUT$FE,$C0,"Channel 2 "
LCDOut $FE,$D4,dec2 (maxbright *100)/255,"%   "
endif
    
    W_max = maxbright
write 9,W_max 
pause 200
If S_butt = 0 then
    pause 200 
    LCDOUT $FE,1   
    goto mainmenu
endif
goto brightness2

up:
    maxbright = maxbright + 1
    IF maxbright > 255 THEN maxbright = 0
    pause 50
RETURN
down:
    maxbright = maxbright - 1
    IF maxbright = 0 THEN maxbright = 255
    pause 50
RETURN
I can't argue with the brackets - all I know when I enter that menu option I can press the up and down buttons and the LCD displays 0% - 100%, and when checked using a diagnostics section which displays the variable value it correctly shows 0 - 255 and 127 for a 50% value - However I'm now using a PCA 9685 chip, which has a resolution of 4095 steps, so the progression is nice and smooth, and all I need is to repeat this but with 4095 steps, ie so 100% = 4095, 1%=40.95 (or 41 as it would need to be an integer) and 50% would equal 2047, but just can't seem to get my head round the calculation (never was any good at percentages at school all those years ago !

Malcolm