I'm deep into a large project using a 7" TFT displey with an SSD1963 controller. I'm using the UTFT library made by Henning Karlsen (UTFT - Rinky-Dink Electronics) and I'm naturally very grateful for his tremendous effort. The library has its limitations though, like there's no support for some functions for SSD1963.
I looked up the data sheet for SSD1963, found the command codes for turning on and off the LCD and added them to the library. It works great. Like so:
void UTFT::lcdOff()
{
cbi(P_CS, B_CS);
switch (display_model)
{
case PCF8833:
LCD_Write_COM(0x28);
break;
case CPLD:
LCD_Write_COM_DATA(0x01,0x0000);
LCD_Write_COM(0x0F);
break;
case CTE70: //added by me
LCD_Write_COM(0x10);
break;
}
sbi(P_CS, B_CS);
}
void UTFT::lcdOn()
{
cbi(P_CS, B_CS);
switch (display_model)
{
case PCF8833:
LCD_Write_COM(0x29);
break;
case CPLD:
LCD_Write_COM_DATA(0x01,0x0010);
LCD_Write_COM(0x0F);
break;
case CTE70: // I added this part
LCD_Write_COM(0x11);
break;
}
sbi(P_CS, B_CS);
}
So that's pretty basic, just copy/pasting a command from the data sheet to the library since the LCD_Write_COM seems to work just fine.
But now I want to control the brightness of the backlight. It is, according to the data sheet, done by adjusting the PWM signal from one of the pins of the SSD1963:
Pin name: PWM Type: O Ref:VDDLCD Pin Nr:B5 or 51 Descr:PWM output for backlight driver
(datasheet page 14: https://pdf1.alldatasheet.com/datasheet-pdf/view/1179028/ETC2/SSD1963.html)
And so we reach the end of my understanding of how to speak to microcontrollers, pampered as I am by the Arduino environment. How do I send code to the SSD1963 that tells it to adjust the PWM output from that pin?
These are apparently the communication functions from the UTFT library:
void UTFT::LCD_Write_COM(char VL)
{
if (display_transfer_mode!=1)
{
cbi(P_RS, B_RS);
LCD_Writ_Bus(0x00,VL,display_transfer_mode);
}
else
LCD_Writ_Bus(0x00,VL,display_transfer_mode);
}
void UTFT::LCD_Write_DATA(char VH,char VL)
{
if (display_transfer_mode!=1)
{
sbi(P_RS, B_RS);
LCD_Writ_Bus(VH,VL,display_transfer_mode);
}
else
{
LCD_Writ_Bus(0x01,VH,display_transfer_mode);
LCD_Writ_Bus(0x01,VL,display_transfer_mode);
}
}
void UTFT::LCD_Write_DATA(char VL)
{
if (display_transfer_mode!=1)
{
sbi(P_RS, B_RS);
LCD_Writ_Bus(0x00,VL,display_transfer_mode);
}
else
LCD_Writ_Bus(0x01,VL,display_transfer_mode);
}
void UTFT::LCD_Write_COM_DATA(char com1,int dat1)
{
LCD_Write_COM(com1);
LCD_Write_DATA(dat1>>8,dat1);
}
void UTFT::LCD_Write_DATA_8(char VL)
{
sbi(P_RS, B_RS);
LCD_Write_Bus_8(VL);
}