Beispiel #1
0
int main(void)
{
    unsigned char c=3;
    char text[15];
    char *txt;

    Init_port();
    Init();
    LCD_Clear();
    
    while(1)
    {
        LCD_Write_INST(0x80);   //line 1
        c = Read23X08_17(GPIOB,PORTEXP_UBRD);
        if(c & 0b00000001)
        {
            //If downbutton is pressed
            sprintf(text," hello Will!!");
        }
        else
        {
            //If downbutton is released
            sprintf(text," hello Smith!!");
        }

        for(txt=text; *txt != 0; txt++)
            {LCD_Write_DATA(*txt);}
    }
}
void Write_LCD(unsigned char * text)
{
    LCD_Clear();
    unsigned char cnt;

    for (cnt = 0; text[cnt]; cnt++)
        LCD_Write_DATA(text[cnt]);
}
void ITDB02::drawCircle(int x, int y, int radius)
{
	int f = 1 - radius;
	int ddF_x = 1;
	int ddF_y = -2 * radius;
	int x1 = 0;
	int y1 = radius;
	char ch, cl;
	
	ch=((fcolorr&248)|fcolorg>>5);
	cl=((fcolorg&28)<<3|fcolorb>>3);
 
	*P_CS &= ~B_CS;
	setXY(x, y + radius, x, y + radius);
	LCD_Write_DATA(ch,cl);
	setXY(x, y - radius, x, y - radius);
	LCD_Write_DATA(ch,cl);
	setXY(x + radius, y, x + radius, y);
	LCD_Write_DATA(ch,cl);
	setXY(x - radius, y, x - radius, y);
	LCD_Write_DATA(ch,cl);
 
	while(x1 < y1)
	{
		if(f >= 0) 
		{
			y1--;
			ddF_y += 2;
			f += ddF_y;
		}
		x1++;
		ddF_x += 2;
		f += ddF_x;    
		setXY(x + x1, y + y1, x + x1, y + y1);
		LCD_Write_DATA(ch,cl);
		setXY(x - x1, y + y1, x - x1, y + y1);
		LCD_Write_DATA(ch,cl);
		setXY(x + x1, y - y1, x + x1, y - y1);
		LCD_Write_DATA(ch,cl);
		setXY(x - x1, y - y1, x - x1, y - y1);
		LCD_Write_DATA(ch,cl);
		setXY(x + y1, y + x1, x + y1, y + x1);
		LCD_Write_DATA(ch,cl);
		setXY(x - y1, y + x1, x - y1, y + x1);
		LCD_Write_DATA(ch,cl);
		setXY(x + y1, y - x1, x + y1, y - x1);
		LCD_Write_DATA(ch,cl);
		setXY(x - y1, y - x1, x - y1, y - x1);
		LCD_Write_DATA(ch,cl);
	}
	*P_CS |= B_CS;
	if (orient==PORTRAIT)
		setXY(0,0,239,319);
	else
		setXY(0,0,319,239);
}
static void init_lcm_registers(void)
{
#if defined(BUILD_UBOOT)
    printf("MYCAT LCD nt35510_yixuntong_BOE_mcu18_wvga");
#endif
    LCD_Write_COM(0xF0,0x00);    LCD_Write_DATA(0x00,0x55);
    LCD_Write_COM(0xF0,0x01);    LCD_Write_DATA(0x00,0xAA);
    LCD_Write_COM(0xF0,0x02);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xF0,0x03);    LCD_Write_DATA(0x00,0x08);
    LCD_Write_COM(0xF0,0x04);    LCD_Write_DATA(0x00,0x01);



    //Set AVDD Ratio
    LCD_Write_COM(0xB6,0x00);    LCD_Write_DATA(0x00,0x34);
    LCD_Write_COM(0xB6,0x01);    LCD_Write_DATA(0x00,0x34);
    LCD_Write_COM(0xB6,0x02);    LCD_Write_DATA(0x00,0x34);
    
        //Set AVDD 5.2V
    LCD_Write_COM(0xB0,0x00);    LCD_Write_DATA(0x00,0x09);
    LCD_Write_COM(0xB0,0x01);    LCD_Write_DATA(0x00,0x09);
    LCD_Write_COM(0xB0,0x02);    LCD_Write_DATA(0x00,0x09);
    
        //Set AVEE Ratio
    LCD_Write_COM(0xB7,0x00);    LCD_Write_DATA(0x00,0x24);
    LCD_Write_COM(0xB7,0x01);    LCD_Write_DATA(0x00,0x24);
    LCD_Write_COM(0xB7,0x02);    LCD_Write_DATA(0x00,0x24);

    //Set AVEE 5.2V
    LCD_Write_COM(0xB1,0x00);    LCD_Write_DATA(0x00,0x09);
    LCD_Write_COM(0xB1,0x01);    LCD_Write_DATA(0x00,0x09);
    LCD_Write_COM(0xB1,0x02);    LCD_Write_DATA(0x00,0x09);

    LCD_Write_COM(0xB8,0x00);    LCD_Write_DATA(0x00,0x34);
    LCD_Write_COM(0xB2,0x00);    LCD_Write_DATA(0x00,0x00);


    //Set VCL -2.5V
    LCD_Write_COM(0xB9,0x00);    LCD_Write_DATA(0x00,0x24);
    LCD_Write_COM(0xB9,0x01);    LCD_Write_DATA(0x00,0x24);
    LCD_Write_COM(0xB9,0x02);    LCD_Write_DATA(0x00,0x24);


    //VGH=15V(1V/step)	Free pump
    LCD_Write_COM(0xB3,0x00);    LCD_Write_DATA(0x00,0x05);		//08
    LCD_Write_COM(0xB3,0x01);    LCD_Write_DATA(0x00,0x05);		//08
    LCD_Write_COM(0xB3,0x02);    LCD_Write_DATA(0x00,0x05);		//08

       LCD_Write_COM(0xBF,0x00);    LCD_Write_DATA(0x00,0x01);

    //VGLX Ratio
    LCD_Write_COM(0xBA,0x00);    LCD_Write_DATA(0x00,0x34);
    LCD_Write_COM(0xBA,0x01);    LCD_Write_DATA(0x00,0x34);
    LCD_Write_COM(0xBA,0x02);    LCD_Write_DATA(0x00,0x34);
    
        //VGL_REG=-10(1V/step)
    LCD_Write_COM(0xB5,0x00);    LCD_Write_DATA(0x00,0x0b);
    LCD_Write_COM(0xB5,0x01);    LCD_Write_DATA(0x00,0x0b);
    LCD_Write_COM(0xB5,0x02);    LCD_Write_DATA(0x00,0x0b);

    //VGMP/VGSP=4.5V/0V
    LCD_Write_COM(0xBC,0x00);    LCD_Write_DATA(0x00,0x00);		//00
    LCD_Write_COM(0xBC,0x01);    LCD_Write_DATA(0x00,0xa3);		//C8 =5.5V/90=4.8V
    LCD_Write_COM(0xBC,0x02);    LCD_Write_DATA(0x00,0x00);		//01

    //VGMN/VGSN=-4.5V/0V
    LCD_Write_COM(0xBD,0x00);    LCD_Write_DATA(0x00,0x00); //00
    LCD_Write_COM(0xBD,0x01);    LCD_Write_DATA(0x00,0xa3); //90
    LCD_Write_COM(0xBD,0x02);    LCD_Write_DATA(0x00,0x00);

    //Vcom=-1.4V(12.5mV/step)
    LCD_Write_COM(0xBE,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xBE,0x01);    LCD_Write_DATA(0x00,0x5A); // 50
     
      
    LCD_Write_COM(0xD1,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD1,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD1,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD1,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD1,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD1,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD1,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD1,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD1,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD1,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD1,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD1,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD1,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD1,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD1,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD1,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD1,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD1,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD1,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD1,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD1,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD1,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD1,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD1,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD1,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD1,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD1,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD1,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD1,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD1,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD1,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD1,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD1,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD1,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD1,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD1,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD1,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD1,0x33);    LCD_Write_DATA(0x00,0xc1);





    //Gamma (G+)
    LCD_Write_COM(0xD2,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD2,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD2,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD2,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD2,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD2,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD2,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD2,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD2,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD2,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD2,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD2,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD2,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD2,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD2,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD2,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD2,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD2,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD2,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD2,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD2,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD2,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD2,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD2,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD2,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD2,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD2,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD2,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD2,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD2,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD2,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD2,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD2,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD2,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD2,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD2,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD2,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD2,0x33);    LCD_Write_DATA(0x00,0xc1);

    //Gamma (B+)
    LCD_Write_COM(0xD3,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD3,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD3,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD3,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD3,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD3,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD3,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD3,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD3,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD3,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD3,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD3,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD3,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD3,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD3,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD3,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD3,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD3,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD3,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD3,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD3,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD3,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD3,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD3,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD3,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD3,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD3,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD3,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD3,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD3,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD3,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD3,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD3,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD3,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD3,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD3,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD3,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD3,0x33);    LCD_Write_DATA(0x00,0xc1);

    //Gamma (R-)
    LCD_Write_COM(0xD4,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD4,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD4,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD4,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD4,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD4,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD4,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD4,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD4,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD4,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD4,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD4,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD4,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD4,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD4,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD4,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD4,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD4,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD4,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD4,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD4,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD4,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD4,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD4,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD4,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD4,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD4,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD4,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD4,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD4,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD4,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD4,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD4,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD4,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD4,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD4,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD4,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD4,0x33);    LCD_Write_DATA(0x00,0xc1);

    //Gamma (G-)
    LCD_Write_COM(0xD5,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD5,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD5,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD5,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD5,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD5,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD5,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD5,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD5,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD5,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD5,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD5,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD5,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD5,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD5,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD5,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD5,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD5,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD5,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD5,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD5,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD5,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD5,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD5,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD5,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD5,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD5,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD5,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD5,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD5,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD5,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD5,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD5,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD5,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD5,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD5,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD5,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD5,0x33);    LCD_Write_DATA(0x00,0xc1);

    //Gamma (B-)
    LCD_Write_COM(0xD6,0x00);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x01);    LCD_Write_DATA(0x00,0x37);
    LCD_Write_COM(0xD6,0x02);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x03);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xD6,0x04);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x05);    LCD_Write_DATA(0x00,0x7B);
    LCD_Write_COM(0xD6,0x06);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x07);    LCD_Write_DATA(0x00,0x99);
    LCD_Write_COM(0xD6,0x08);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x09);    LCD_Write_DATA(0x00,0xB1);
    LCD_Write_COM(0xD6,0x0A);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x0B);    LCD_Write_DATA(0x00,0xD2);
    LCD_Write_COM(0xD6,0x0C);    LCD_Write_DATA(0x00,0x00);
    LCD_Write_COM(0xD6,0x0D);    LCD_Write_DATA(0x00,0xf6);
    LCD_Write_COM(0xD6,0x0E);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD6,0x0F);    LCD_Write_DATA(0x00,0x27);
    LCD_Write_COM(0xD6,0x10);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD6,0x11);    LCD_Write_DATA(0x00,0x41);
    LCD_Write_COM(0xD6,0x12);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD6,0x13);    LCD_Write_DATA(0x00,0x8C);
    LCD_Write_COM(0xD6,0x14);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xD6,0x15);    LCD_Write_DATA(0x00,0xBE);
    LCD_Write_COM(0xD6,0x16);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD6,0x17);    LCD_Write_DATA(0x00,0x0B);
    LCD_Write_COM(0xD6,0x18);    LCD_Write_DATA(0x00,0x02);////////////////////
    LCD_Write_COM(0xD6,0x19);    LCD_Write_DATA(0x00,0x48);
    LCD_Write_COM(0xD6,0x1A);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD6,0x1B);    LCD_Write_DATA(0x00,0x4A);
    LCD_Write_COM(0xD6,0x1C);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD6,0x1D);    LCD_Write_DATA(0x00,0x7E);
    LCD_Write_COM(0xD6,0x1E);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD6,0x1F);    LCD_Write_DATA(0x00,0xBC);
    LCD_Write_COM(0xD6,0x20);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xD6,0x21);    LCD_Write_DATA(0x00,0xe1);
    LCD_Write_COM(0xD6,0x22);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x23);    LCD_Write_DATA(0x00,0x10);
    LCD_Write_COM(0xD6,0x24);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x25);    LCD_Write_DATA(0x00,0x31);
    LCD_Write_COM(0xD6,0x26);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x27);    LCD_Write_DATA(0x00,0x5A);
    LCD_Write_COM(0xD6,0x28);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x29);    LCD_Write_DATA(0x00,0x73);
    LCD_Write_COM(0xD6,0x2A);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x2B);    LCD_Write_DATA(0x00,0x94);
    LCD_Write_COM(0xD6,0x2C);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x2D);    LCD_Write_DATA(0x00,0x9F);
    LCD_Write_COM(0xD6,0x2E);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x2F);    LCD_Write_DATA(0x00,0xb3);
    LCD_Write_COM(0xD6,0x30);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x31);    LCD_Write_DATA(0x00,0xb9);
    LCD_Write_COM(0xD6,0x32);    LCD_Write_DATA(0x00,0x03);
    LCD_Write_COM(0xD6,0x33);    LCD_Write_DATA(0x00,0xc1);



     //PAGE0
    LCD_Write_COM(0xF0,0x00);    LCD_Write_DATA(0x00,0x55);
    LCD_Write_COM(0xF0,0x01);    LCD_Write_DATA(0x00,0xAA);
    LCD_Write_COM(0xF0,0x02);    LCD_Write_DATA(0x00,0x52);
    LCD_Write_COM(0xF0,0x03);    LCD_Write_DATA(0x00,0x08);
    LCD_Write_COM(0xF0,0x04);    LCD_Write_DATA(0x00,0x00);

    LCD_Write_COM(0xb0,0x00);    LCD_Write_DATA(0x00,0x08);
    LCD_Write_COM(0xb0,0x01);    LCD_Write_DATA(0x00,0x05);
    LCD_Write_COM(0xb0,0x02);    LCD_Write_DATA(0x00,0x02);
    LCD_Write_COM(0xb0,0x03);    LCD_Write_DATA(0x00,0x05);
    LCD_Write_COM(0xb0,0x04);    LCD_Write_DATA(0x00,0x02);


   

    //Source hold time (Nova non-used)
    LCD_Write_COM(0xB6,0x00);    LCD_Write_DATA(0x00,0x0A);

    //Gate EQ control	 (Nova non-used)
    LCD_Write_COM(0xB7,0x00);    LCD_Write_DATA(0x00,0x00);  //HSD:70;Nova:77
    LCD_Write_COM(0xB7,0x01);    LCD_Write_DATA(0x00,0x70);	//HSD:70;Nova:77

    //Source EQ control (Nova non-used)
    LCD_Write_COM(0xB8,0x00);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xB8,0x01);    LCD_Write_DATA(0x00,0x05);	//HSD:05;Nova:07	 //03
    LCD_Write_COM(0xB8,0x02);    LCD_Write_DATA(0x00,0x05);	//HSD:05;Nova:07	  //03
    LCD_Write_COM(0xB8,0x03);    LCD_Write_DATA(0x00,0x05);	//HSD:05;Nova:07	  03


     // LCD_Write_COM(0xBa,0x00);    LCD_Write_DATA(0x00,0x01);	//HSD:05;Nova:07	  03
    //Inversion mode: column
    LCD_Write_COM(0xBC,0x00);    LCD_Write_DATA(0x00,0x00);	//00: column
    LCD_Write_COM(0xBC,0x01);    LCD_Write_DATA(0x00,0x00);	//01:1dot
    LCD_Write_COM(0xBC,0x02);    LCD_Write_DATA(0x00,0x00);




    //LGD timing control(4H/4-Delay)
    LCD_Write_COM(0xCc,0x00);    LCD_Write_DATA(0x00,0x03);	//3H:0x50;4H:0xD0	 //D
    LCD_Write_COM(0xCc,0x01);    LCD_Write_DATA(0x00,0x00);  //HSD:05;Nova:02
    LCD_Write_COM(0xCc,0x02);    LCD_Write_DATA(0x00,0x00);	//HSD:05;Nova:50
    
    LCD_Write_COM(0xBd,0x00);    LCD_Write_DATA(0x00,0x01);
    LCD_Write_COM(0xBd,0x01);    LCD_Write_DATA(0x00,0x9F);	//HSD:05;Nova:07	 //03  84
    LCD_Write_COM(0xBd,0x02);    LCD_Write_DATA(0x00,0x07);	//HSD:05;Nova:07	  //03
    LCD_Write_COM(0xBd,0x03);    LCD_Write_DATA(0x00,0x31);	//HSD:05;Nova:07	  03
    LCD_Write_COM(0xBd,0x04);    LCD_Write_DATA(0x00,0x00);	//HSD:05;Nova:07	  03
    
    
     LCD_Write_COM(0xBA,0x00);    LCD_Write_DATA(0x00,0x01);	//HSD:05;Nova:07	  03
     
     
         LCD_Write_COM(0xFF,0x00);    LCD_Write_DATA(0x00,0xAA);	//HSD:05;Nova:07	  03
         LCD_Write_COM(0xFF,0x01);    LCD_Write_DATA(0x00,0x55);	//HSD:05;Nova:07	  03
         LCD_Write_COM(0xFF,0x02);    LCD_Write_DATA(0x00,0x25);	//HSD:05;Nova:07	  03
         LCD_Write_COM(0xFF,0x03);    LCD_Write_DATA(0x00,0x01);	//HSD:05;Nova:07	  03

   LCD_Write_COM(0x35,0x00);    LCD_Write_DATA(0x00,0x00);
   LCD_Write_COM(0x44,0x00);    LCD_Write_DATA(0x00,0x01);
   LCD_Write_COM(0x44,0x01);    LCD_Write_DATA(0x00,0x20);

   LCD_Write_COM(0x36,0x00);    LCD_Write_DATA(0x00,0x00);
   LCD_Write_COM(0x3A,0x00);    LCD_Write_DATA(0x00,0x66);


    //Sleep out
    LCD_Write_COM(0x11,0x00);	   // Sleep Out (1100h)
    delayms(160);
    //Display on
    LCD_Write_COM(0x29,0x00);
    MDELAY(200);
    send_ctrl_cmd(0x2C00);
    MDELAY(200);
    sw_clear_panel(0x0);    // Clean panel as black
    MDELAY(10);

}
void LCD_PutHex(unsigned char h)
{
    // Outputs a four-bit value as hex
    h = (h & 0x0f) + '0';
    LCD_Write_DATA(h <= '9' ? h : h + 7);
}
void LCD_AppendString(char *s)
{
    while (*s) { // Outputs a string
        LCD_Write_DATA(*s++);
    }
}
Beispiel #7
0
void UTFT::drawCircle(int x, int y, int radius)
{
	int f = 1 - radius;
	int ddF_x = 1;
	int ddF_y = -2 * radius;
	int x1 = 0;
	int y1 = radius;
 
	cbi(P_CS, B_CS);
	setXY(x, y + radius, x, y + radius);
	LCD_Write_DATA(fch,fcl);
	setXY(x, y - radius, x, y - radius);
	LCD_Write_DATA(fch,fcl);
	setXY(x + radius, y, x + radius, y);
	LCD_Write_DATA(fch,fcl);
	setXY(x - radius, y, x - radius, y);
	LCD_Write_DATA(fch,fcl);
 
	while(x1 < y1)
	{
		if(f >= 0) 
		{
			y1--;
			ddF_y += 2;
			f += ddF_y;
		}
		x1++;
		ddF_x += 2;
		f += ddF_x;    
		setXY(x + x1, y + y1, x + x1, y + y1);
		LCD_Write_DATA(fch,fcl);
		setXY(x - x1, y + y1, x - x1, y + y1);
		LCD_Write_DATA(fch,fcl);
		setXY(x + x1, y - y1, x + x1, y - y1);
		LCD_Write_DATA(fch,fcl);
		setXY(x - x1, y - y1, x - x1, y - y1);
		LCD_Write_DATA(fch,fcl);
		setXY(x + y1, y + x1, x + y1, y + x1);
		LCD_Write_DATA(fch,fcl);
		setXY(x - y1, y + x1, x - y1, y + x1);
		LCD_Write_DATA(fch,fcl);
		setXY(x + y1, y - x1, x + y1, y - x1);
		LCD_Write_DATA(fch,fcl);
		setXY(x - y1, y - x1, x - y1, y - x1);
		LCD_Write_DATA(fch,fcl);
	}
	sbi(P_CS, B_CS);
	clrXY();
}
Beispiel #8
0
void ITDB02::setXY(word x1, word y1, word x2, word y2)
{
    int tmp;

    if (orient==LANDSCAPE)
    {
        tmp=x1;
        x1=y1;
        y1=disp_y_size-tmp;
        tmp=x2;
        x2=y2;
        y2=disp_y_size-tmp;
        tmp=y1;
        y1=y2;
        y2=tmp;
    }

    switch(display_model)
    {
    case ITDB32:
        main_W_com_data(0x02,x1>>8);  // Column address start2
        main_W_com_data(0x03,x1);		// Column address start1
        main_W_com_data(0x04,x2>>8);  // Column address end2
        main_W_com_data(0x05,x2);		// Column address end1
        main_W_com_data(0x06,y1>>8);  // Row address start2
        main_W_com_data(0x07,y1);		// Row address start1
        main_W_com_data(0x08,y2>>8);  // Row address end2
        main_W_com_data(0x09,y2);		// Row address end1
        LCD_Write_COM(0x22);
        break;
    case ITDB32WC:  // Also TFT01_32W
        LCD_Write_COM(0x2a);
        LCD_Write_DATA(0x00,x1>>8);
        LCD_Write_DATA(0x00,x1);
        LCD_Write_DATA(0x00,x2>>8);
        LCD_Write_DATA(0x00,x2);
        LCD_Write_COM(0x2b);
        LCD_Write_DATA(0x00,y1>>8);
        LCD_Write_DATA(0x00,y1);
        LCD_Write_DATA(0x00,y2>>8);
        LCD_Write_DATA(0x00,y2);
        LCD_Write_COM(0x2c);
        break;
    case ITDB32S:  // Also TFT01_32
        main_W_com_data(0x44,(x2<<8)+x1);
        main_W_com_data(0x45,y1);
        main_W_com_data(0x46,y2);
        main_W_com_data(0x4e,x1);
        main_W_com_data(0x4f,y1);
        LCD_Write_COM(0x22);
        break;
    case TFT01_24:
        main_W_com_data(0x20,x1);	//Setting X
        main_W_com_data(0x21,y1);	//Setting Y
        main_W_com_data(0x50,x1);	//start X
        main_W_com_data(0x52,y1);	//start Y
        main_W_com_data(0x51,x2);	//end X
        main_W_com_data(0x53,y2);	//end Y
        LCD_Write_COM(0x22);
        break;
    }
}
Beispiel #9
0
void ITDB02::InitLCD(byte orientation)
{
    orient=orientation;

    *P_RST |= B_RST;
    delay(5);
    *P_RST &= ~B_RST;
    delay(15);
    *P_RST |= B_RST;
    delay(15);

    switch(display_model)
    {
    case ITDB32:
        main_W_com_data(0x46,0x00A4);
        main_W_com_data(0x47,0x0053);
        main_W_com_data(0x48,0x0000);
        main_W_com_data(0x49,0x0044);
        main_W_com_data(0x4a,0x0004);
        main_W_com_data(0x4b,0x0067);
        main_W_com_data(0x4c,0x0033);
        main_W_com_data(0x4d,0x0077);
        main_W_com_data(0x4e,0x0012);
        main_W_com_data(0x4f,0x004C);
        main_W_com_data(0x50,0x0046);
        main_W_com_data(0x51,0x0044);

        //240x320 window setting
        main_W_com_data(0x02,0x0000); // Column address start2
        main_W_com_data(0x03,0x0000); // Column address start1
        main_W_com_data(0x04,0x0000); // Column address end2
        main_W_com_data(0x05,0x00ef); // Column address end1
        main_W_com_data(0x06,0x0000); // Row address start2
        main_W_com_data(0x07,0x0000); // Row address start1
        main_W_com_data(0x08,0x0001); // Row address end2
        main_W_com_data(0x09,0x003f); // Row address end1

        // Display Setting
        main_W_com_data(0x01,0x0006); // IDMON=0, INVON=1, NORON=1, PTLON=0
        main_W_com_data(0x16,0x00C8); // MY=0, MX=0, MV=0, ML=1, BGR=0, TEON=0   0048
        main_W_com_data(0x23,0x0095); // N_DC=1001 0101
        main_W_com_data(0x24,0x0095); // PI_DC=1001 0101
        main_W_com_data(0x25,0x00FF); // I_DC=1111 1111

        main_W_com_data(0x27,0x0002); // N_BP=0000 0010
        main_W_com_data(0x28,0x0002); // N_FP=0000 0010
        main_W_com_data(0x29,0x0002); // PI_BP=0000 0010
        main_W_com_data(0x2a,0x0002); // PI_FP=0000 0010
        main_W_com_data(0x2C,0x0002); // I_BP=0000 0010
        main_W_com_data(0x2d,0x0002); // I_FP=0000 0010

        main_W_com_data(0x3a,0x0001); // N_RTN=0000, N_NW=001    0001
        main_W_com_data(0x3b,0x0000); // P_RTN=0000, P_NW=001
        main_W_com_data(0x3c,0x00f0); // I_RTN=1111, I_NW=000
        main_W_com_data(0x3d,0x0000); // DIV=00
        delay(1);
        main_W_com_data(0x35,0x0038); // EQS=38h
        main_W_com_data(0x36,0x0078); // EQP=78h
        main_W_com_data(0x3E,0x0038); // SON=38h
        main_W_com_data(0x40,0x000F); // GDON=0Fh
        main_W_com_data(0x41,0x00F0); // GDOFF

        // Power Supply Setting
        main_W_com_data(0x19,0x0049); // CADJ=0100, CUADJ=100, OSD_EN=1 ,60Hz
        main_W_com_data(0x93,0x000F); // RADJ=1111, 100%
        delay(1);
        main_W_com_data(0x20,0x0040); // BT=0100
        main_W_com_data(0x1D,0x0007); // VC1=111   0007
        main_W_com_data(0x1E,0x0000); // VC3=000
        main_W_com_data(0x1F,0x0004); // VRH=0011

        //VCOM SETTING
        main_W_com_data(0x44,0x004D); // VCM=101 0000  4D
        main_W_com_data(0x45,0x000E); // VDV=1 0001   0011
        delay(1);
        main_W_com_data(0x1C,0x0004); // AP=100
        delay(2);

        main_W_com_data(0x1B,0x0018); // GASENB=0, PON=0, DK=1, XDK=0, VLCD_TRI=0, STB=0
        delay(1);
        main_W_com_data(0x1B,0x0010); // GASENB=0, PON=1, DK=0, XDK=0, VLCD_TRI=0, STB=0
        delay(1);
        main_W_com_data(0x43,0x0080); //set VCOMG=1
        delay(2);

        // Display ON Setting
        main_W_com_data(0x90,0x007F); // SAP=0111 1111
        main_W_com_data(0x26,0x0004); //GON=0, DTE=0, D=01
        delay(1);
        main_W_com_data(0x26,0x0024); //GON=1, DTE=0, D=01
        main_W_com_data(0x26,0x002C); //GON=1, DTE=0, D=11
        delay(1);
        main_W_com_data(0x26,0x003C); //GON=1, DTE=1, D=11

        // INTERNAL REGISTER SETTING
        main_W_com_data(0x57,0x0002); // TEST_Mode=1: into TEST mode
        main_W_com_data(0x95,0x0001); // SET DISPLAY CLOCK AND PUMPING CLOCK TO SYNCHRONIZE
        main_W_com_data(0x57,0x0000); // TEST_Mode=0: exit TEST mode
        //main_W_com_data(0x21,0x0000);
        LCD_Write_COM(0x22);
        break;
    case ITDB32WC:  // Also TFT01_32W
        LCD_Write_COM(0xE9);
        LCD_Write_DATA(0x00,0x20);
        LCD_Write_COM(0x11); //Exit Sleep
        delay(100);
        LCD_Write_COM(0xD1);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x71);
        LCD_Write_DATA(0x00,0x19);
        LCD_Write_COM(0xD0);
        LCD_Write_DATA(0x00,0x07);
        LCD_Write_DATA(0x00,0x01);
        LCD_Write_DATA(0x00,0x08);
        LCD_Write_COM(0x36);
        LCD_Write_DATA(0x00,0x48);
        LCD_Write_COM(0x3A);
        LCD_Write_DATA(0x00,0x05);
        LCD_Write_COM(0xC1);
        LCD_Write_DATA(0x00,0x10);
        LCD_Write_DATA(0x00,0x10);
        LCD_Write_DATA(0x00,0x02);
        LCD_Write_DATA(0x00,0x02);
        LCD_Write_COM(0xC0); //Set Default Gamma
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x35);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x01);
        LCD_Write_DATA(0x00,0x02);
        LCD_Write_COM(0xC5); //Set frame rate
        LCD_Write_DATA(0x00,0x04);
        LCD_Write_COM(0xD2); //power setting
        LCD_Write_DATA(0x00,0x01);
        LCD_Write_DATA(0x00,0x44);
        LCD_Write_COM(0xC8); //Set Gamma
        LCD_Write_DATA(0x00,0x04);
        LCD_Write_DATA(0x00,0x67);
        LCD_Write_DATA(0x00,0x35);
        LCD_Write_DATA(0x00,0x04);
        LCD_Write_DATA(0x00,0x08);
        LCD_Write_DATA(0x00,0x06);
        LCD_Write_DATA(0x00,0x24);
        LCD_Write_DATA(0x00,0x01);
        LCD_Write_DATA(0x00,0x37);
        LCD_Write_DATA(0x00,0x40);
        LCD_Write_DATA(0x00,0x03);
        LCD_Write_DATA(0x00,0x10);
        LCD_Write_DATA(0x00,0x08);
        LCD_Write_DATA(0x00,0x80);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_COM(0x2A);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0xeF);
        LCD_Write_COM(0x2B);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x00);
        LCD_Write_DATA(0x00,0x01);
        LCD_Write_DATA(0x00,0x8F);
        LCD_Write_COM(0x29); //display on
        LCD_Write_COM(0x2C); //display on
        break;
    case ITDB32S:  // Also TFT01_32
        main_W_com_data(0x00,0x0001);
        main_W_com_data(0x03,0xA8A4);
        main_W_com_data(0x0C,0x0000);
        main_W_com_data(0x0D,0x080C);
        main_W_com_data(0x0E,0x2B00);
        main_W_com_data(0x1E,0x00B7);
        main_W_com_data(0x01,0x2B3F);
        main_W_com_data(0x02,0x0600);
        main_W_com_data(0x10,0x0000);
        main_W_com_data(0x11,0x6070);
        main_W_com_data(0x05,0x0000);
        main_W_com_data(0x06,0x0000);
        main_W_com_data(0x16,0xEF1C);
        main_W_com_data(0x17,0x0003);
        main_W_com_data(0x07,0x0233);
        main_W_com_data(0x0B,0x0000);
        main_W_com_data(0x0F,0x0000);
        main_W_com_data(0x41,0x0000);
        main_W_com_data(0x42,0x0000);
        main_W_com_data(0x48,0x0000);
        main_W_com_data(0x49,0x013F);
        main_W_com_data(0x4A,0x0000);
        main_W_com_data(0x4B,0x0000);
        main_W_com_data(0x44,0xEF00);
        main_W_com_data(0x45,0x0000);
        main_W_com_data(0x46,0x013F);
        main_W_com_data(0x30,0x0707);
        main_W_com_data(0x31,0x0204);
        main_W_com_data(0x32,0x0204);
        main_W_com_data(0x33,0x0502);
        main_W_com_data(0x34,0x0507);
        main_W_com_data(0x35,0x0204);
        main_W_com_data(0x36,0x0204);
        main_W_com_data(0x37,0x0502);
        main_W_com_data(0x3A,0x0302);
        main_W_com_data(0x3B,0x0302);
        main_W_com_data(0x23,0x0000);
        main_W_com_data(0x24,0x0000);
        main_W_com_data(0x25,0x8000);
        main_W_com_data(0x4f,0x0000);
        main_W_com_data(0x4e,0x0000);
        LCD_Write_COM(0x22);
        break;
    case TFT01_24:
        main_W_com_data(0x01, 0x0100); // set Driver Output Control
        main_W_com_data(0x02, 0x0200); // set 1 line inversion
        main_W_com_data(0x03, 0x1030); // set GRAM write direction and BGR=1.
        main_W_com_data(0x04, 0x0000); // Resize register
        main_W_com_data(0x08, 0x0207); // set the back porch and front porch
        main_W_com_data(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0]
        main_W_com_data(0x0A, 0x0000); // FMARK function
        main_W_com_data(0x0C, 0x0000); // RGB interface setting
        main_W_com_data(0x0D, 0x0000); // Frame marker Position
        main_W_com_data(0x0F, 0x0000); // RGB interface polarity
        //*************Power On sequence ****************//
        main_W_com_data(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
        main_W_com_data(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
        main_W_com_data(0x12, 0x0000); // VREG1OUT voltage
        main_W_com_data(0x13, 0x0000); // VDV[4:0] for VCOM amplitude
        main_W_com_data(0x07, 0x0001);
        delay(200); // Dis-charge capacitor power voltage
        main_W_com_data(0x10, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB
        main_W_com_data(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0]
        delay(50); // Delay 50ms
        main_W_com_data(0x12, 0x000D); // 0012
        delay(50); // Delay 50ms
        main_W_com_data(0x13, 0x1200); // VDV[4:0] for VCOM amplitude
        main_W_com_data(0x29, 0x000A); // 04  VCM[5:0] for VCOMH
        main_W_com_data(0x2B, 0x000D); // Set Frame Rate
        delay(50); // Delay 50ms
        main_W_com_data(0x20, 0x0000); // GRAM horizontal Address
        main_W_com_data(0x21, 0x0000); // GRAM Vertical Address
        // ----------- Adjust the Gamma Curve ----------//
        main_W_com_data(0x30, 0x0000);
        main_W_com_data(0x31, 0x0404);
        main_W_com_data(0x32, 0x0003);
        main_W_com_data(0x35, 0x0405);
        main_W_com_data(0x36, 0x0808);
        main_W_com_data(0x37, 0x0407);
        main_W_com_data(0x38, 0x0303);
        main_W_com_data(0x39, 0x0707);
        main_W_com_data(0x3C, 0x0504);
        main_W_com_data(0x3D, 0x0808);
        //------------------ Set GRAM area ---------------//
        main_W_com_data(0x50, 0x0000); // Horizontal GRAM Start Address
        main_W_com_data(0x51, 0x00EF); // Horizontal GRAM End Address
        main_W_com_data(0x52, 0x0000); // Vertical GRAM Start Address
        main_W_com_data(0x53, 0x013F); // Vertical GRAM Start Address
        main_W_com_data(0x60, 0xA700); // Gate Scan Line
        main_W_com_data(0x61, 0x0001); // NDL,VLE, REV
        main_W_com_data(0x6A, 0x0000); // set scrolling line
        //-------------- Partial Display Control ---------//
        main_W_com_data(0x80, 0x0000);
        main_W_com_data(0x81, 0x0000);
        main_W_com_data(0x82, 0x0000);
        main_W_com_data(0x83, 0x0000);
        main_W_com_data(0x84, 0x0000);
        main_W_com_data(0x85, 0x0000);
        //-------------- Panel Control -------------------//
        main_W_com_data(0x90, 0x0010);
        main_W_com_data(0x92, 0x0000);
        main_W_com_data(0x07, 0x0133); // 262K color and display ON
        break;
    }

    setColor(255, 255, 255);
    setBackColor(0, 0, 0);
    cfont.font=0;
}
Beispiel #10
0
word ITDB02tf::loadBitmap(int x, int y, int sx, int sy, char *filename)
{
	int res;
	int cx, cy, cp;
	word temp, result;
	byte r,g,b;

	res=file.openFile(filename, FILEMODE_BINARY);
	if (res==NO_ERROR)
	{
		*P_CS &= ~B_CS;
		cx=0;
		cy=0;
		result=512;
		if (orient==PORTRAIT)
		{
			setXY(x, y, x+sx-1, y+sy-1);
		}
		while (result==512)
		{
			result=file.readBinary();
			switch(result)
			{
				case ERROR_WRONG_FILEMODE:
					return ERROR_WRONG_FILEMODE;
					break;
				case ERROR_NO_FILE_OPEN:
					return ERROR_NO_FILE_OPEN;
					break;
				default:
					if (orient==PORTRAIT)
					{
						for (int i=0; i<result; i+=2)
							LCD_Write_DATA(file.buffer[i],file.buffer[i+1]);
					}
					else
					{
						cp=0;
						while (cp<result)
						{
							if (((result-cp)/2)<(sx-cx))
							{
								setXY(x+cx, y+cy, x+cx+((result-cp)/2)-1, y+cy);
								for (int i=(result-cp)-2; i>=0; i-=2)
									LCD_Write_DATA(file.buffer[cp+i],file.buffer[cp+i+1]);
								cx+=((result-cp)/2);
								cp=result;
							}
							else
							{
								setXY(x+cx, y+cy, x+sx-1, y+cy);
								for (int i=sx-cx-1; i>=0; i--)
									LCD_Write_DATA(file.buffer[cp+(i*2)],file.buffer[cp+(i*2)+1]);
								cp+=(sx-cx)*2;
								cx=0;
								cy++;
							}
						}
					}
					break;
			}              
		}
		file.closeFile();
		if (orient==PORTRAIT)
			setXY(0,0,239,319);
		else
			setXY(0,0,319,239);
		*P_CS |= B_CS;
		return 0;
	}
	else
	{
		return res;
	}
};
void InitLCD(char orientation){
  orient=orientation;
  
  LCD_DATA_DIR = 0x00;  //Output for All pins on DATA BUS
  LCD_DATA_BUS = 0x0000;

//Pin Mode for Control Pins!
//OLIMEX BOARDS (Arduino Like Boards, using SHIELDs)
#if defined(PIC32_PINGUINO) || defined(PIC32_PINGUINO_OTG)
  fastSetOutputMode(dLCD_RS);
  fastSetOutputMode(dLCD_WR);
  fastSetOutputMode(dLCD_CS);
  fastSetOutputMode(dLCD_REST);
  
  TRISDbits.TRISD4 = 1;		//RD4 is connected to D2, don't know why! :-P
  PORTDbits.RD4 = 0;
#else
  fastSetOutputMode(LCD_RS);
  fastSetOutputMode(LCD_WR);
  fastSetOutputMode(LCD_CS);
  fastSetOutputMode(LCD_REST);
#endif

  fastWriteHigh(LCD_REST);
  Delayms(5); 
  fastWriteLow(LCD_REST);
  Delayms(5);
  fastWriteHigh(LCD_REST);
  Delayms(5);

  fastWriteLow(LCD_CS);  
  //************* Start Initial Sequence **********//
  LCD_Write_COM(0x00,0xE5); 
  LCD_Write_DATA(0x78,0xF0); // set SRAM internal timing

  LCD_Write_COM(0x00,0x01); 
  LCD_Write_DATA(0x01,0x00); // set SS and SM bit

  LCD_Write_COM(0x00,0x02); 
  LCD_Write_DATA(0x07,0x00); // set 1 line inversion

  LCD_Write_COM(0x00,0x03); 
  LCD_Write_DATA(0x10,0x30); // set GRAM write direction and BGR=1.

  LCD_Write_COM(0x00,0x04); 
  LCD_Write_DATA(0x00,0x00); // Resize register

  LCD_Write_COM(0x00,0x08); 
  LCD_Write_DATA(0x02,0x07); // set the back porch and front porch

  LCD_Write_COM(0x00,0x09); 
  LCD_Write_DATA(0x00,0x00); // set non-display area refresh cycle ISC[3:0]

  LCD_Write_COM(0x00,0x0A); 
  LCD_Write_DATA(0x00,0x00); // FMARK function

  LCD_Write_COM(0x00,0x0C); 
  LCD_Write_DATA(0x00,0x00); // RGB interface setting

  LCD_Write_COM(0x00,0x0D); 
  LCD_Write_DATA(0x00,0x00); // Frame marker Position

  LCD_Write_COM(0x00,0x0F); 
  LCD_Write_DATA(0x00,0x00); // RGB interface polarity
  //*************Power On sequence ****************//
  LCD_Write_COM(0x00,0x10); 
  LCD_Write_DATA(0x00,0x00); // SAP, BT[3:0], AP, DSTB, SLP, STB
  LCD_Write_COM(0x00,0x11); 
  LCD_Write_DATA(0x00,0x07); // DC1[2:0], DC0[2:0], VC[2:0]
  LCD_Write_COM(0x00,0x12); 
  LCD_Write_DATA(0x00,0x00); // VREG1OUT voltage
  LCD_Write_COM(0x00,0x13); 
  LCD_Write_DATA(0x00,0x00); // VDV[4:0] for VCOM amplitude
  LCD_Write_COM(0x00,0x07); 
  LCD_Write_DATA(0x00,0x01);
  Delayms(50); // Dis-charge capacitor power voltage
  LCD_Write_COM(0x00,0x10); 
  LCD_Write_DATA(0x10,0x90); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB
  LCD_Write_COM(0x00,0x11); 
  LCD_Write_DATA(0x02,0x27); // DC1[2:0], DC0[2:0], VC[2:0]
  Delayms(50); // Delay 50ms
  LCD_Write_COM(0x00,0x12); 
  LCD_Write_DATA(0x00,0x1F); //001C// Internal reference voltage= Vci;
  Delayms(50); // Delay 50ms
  LCD_Write_COM(0x00,0x13); 
  LCD_Write_DATA(0x15,0x00); //0x1000//1400   Set VDV[4:0] for VCOM amplitude  1A00
  LCD_Write_COM(0x00,0x29); 
  LCD_Write_DATA(0x00,0x27); //0x0012 //001a  Set VCM[5:0] for VCOMH  //0x0025  0034
  LCD_Write_COM(0x00,0x2B); 
  LCD_Write_DATA(0x00,0x0D); // Set Frame Rate   000C
  Delayms(50); // Delay 50ms
  LCD_Write_COM(0x00,0x20); 
  LCD_Write_DATA(0x00,0x00); // GRAM horizontal Address
  LCD_Write_COM(0x00,0x21); 
  LCD_Write_DATA(0x00,0x00); // GRAM Vertical Address
  // ----------- Adjust the Gamma Curve ----------//
  LCD_Write_COM(0x00,0x30); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x31); 
  LCD_Write_DATA(0x07,0x07);
  LCD_Write_COM(0x00,0x32); 
  LCD_Write_DATA(0x03,0x07);
  LCD_Write_COM(0x00,0x35); 
  LCD_Write_DATA(0x02,0x00);
  LCD_Write_COM(0x00,0x36); 
  LCD_Write_DATA(0x00,0x08);//0207
  LCD_Write_COM(0x00,0x37); 
  LCD_Write_DATA(0x00,0x04);//0306
  LCD_Write_COM(0x00,0x38); 
  LCD_Write_DATA(0x00,0x00);//0102
  LCD_Write_COM(0x00,0x39); 
  LCD_Write_DATA(0x07,0x07);//0707
  LCD_Write_COM(0x00,0x3C); 
  LCD_Write_DATA(0x00,0x02);//0702
  LCD_Write_COM(0x00,0x3D); 
  LCD_Write_DATA(0x1D,0x04);//1604

    //------------------ Set GRAM area ---------------//
  LCD_Write_COM(0x00,0x50); 
  LCD_Write_DATA(0x00,0x00); // Horizontal GRAM Start Address
  LCD_Write_COM(0x00,0x51); 
  LCD_Write_DATA(0x00,0xEF); // Horizontal GRAM End Address
  LCD_Write_COM(0x00,0x52); 
  LCD_Write_DATA(0x00,0x00); // Vertical GRAM Start Address
  LCD_Write_COM(0x00,0x53); 
  LCD_Write_DATA(0x01,0x3F); // Vertical GRAM Start Address
  LCD_Write_COM(0x00,0x60); 
  LCD_Write_DATA(0xA7,0x00); // Gate Scan Line
  LCD_Write_COM(0x00,0x61); 
  LCD_Write_DATA(0x00,0x01); // NDL,VLE, REV
  LCD_Write_COM(0x00,0x6A); 
  LCD_Write_DATA(0x00,0x00); // set scrolling line
  //-------------- Partial Display Control ---------//
  LCD_Write_COM(0x00,0x80); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x81); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x82); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x83); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x84); 
  LCD_Write_DATA(0x00,0x00);
  LCD_Write_COM(0x00,0x85); 
  LCD_Write_DATA(0x00,0x00);
  //-------------- Panel Control -------------------//
  LCD_Write_COM(0x00,0x90); 
  LCD_Write_DATA(0x00,0x10);
  LCD_Write_COM(0x00,0x92); 
  LCD_Write_DATA(0x06,0x00);
  LCD_Write_COM(0x00,0x07); 
  LCD_Write_DATA(0x01,0x33); 
  fastWriteHigh(LCD_CS);

  setColor(255, 255, 255);
  setBackColor(0, 0, 0);
  fsize = FONT_SMALL;
}
Beispiel #12
0
void LCD_Writ_Bus(char VH,char VL, uint8_t mode)
{
	LCD_Write_DATA(VH,VL);
}
Beispiel #13
0
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
{
	LCD_Write_DATA(VH,VL);
}