1
USB serial LCD backpack / Re: LCD BACKPACK on the DP USB stack, test hex file V1 here.
Code: [Select]
//backlight control
//the LED draws a lot of power when it comes on
void LCD_Backlight(unsigned char c){
unsigned char i;
if(c){
//turn on slowly with PWM
for(i=0; i<255; i++){
LCD_BL=1; //backlight ON
delayUS(i);//on for increasing us
LCD_BL=0; //backlight OFF
delayUS((255-i));//off for decreasing us
}
LCD_BL=1; //exit with light ON
}else{
LCD_BL=0; //backlight off
}
}
LCDproc sends backlight on command every time it sends something to the display so the backlight is flashing. We should not soft turn-on the screen if it is already on.
I think it should be something like this:
Code: [Select]
//backlight control
//the LED draws a lot of power when it comes on
void LCD_Backlight(unsigned char c){
unsigned char i;
if(c && !LCD_BL){
//turn on slowly with PWM
for(i=0; i<255; i++){
LCD_BL=1; //backlight ON
delayUS(i);//on for increasing us
LCD_BL=0; //backlight OFF
delayUS((255-i));//off for decreasing us
}
LCD_BL=1; //exit with light ON
}else if(!c){
LCD_BL=0; //backlight off
}
}