TA的每日心情 | 开心 2019-7-11 11:26 |
---|
签到天数: 1982 天 连续签到: 1 天 [LV.Master]伴坛终老
|
前段时间一直很忙,今天正好是周末,继续来写点进程吧。
今天写的主要是TFT液晶屏显示,本次主要是完成了图片显示(如下图中的我们爱板网的图标),并且这个图片可以定义显示的大小和显示的坐标;汉字的显示(“爱”“板”“网”三个字),汉字显示可以定义汉字的显示坐标以及显示的颜色;画线和圆(可以定义线的坐标,颜色,圆的颜色和圆心的坐标,圆的半径);可以显示字符串和数字符号,这些都可以定义字符的颜色和背景色,比如EEbord几个字定义的就是蓝色的背景。
由于该程序还打算修改,暂时不把整个程序传上来,等以后修改好后在传,目前先把驱动部分发出来。
void LCD_Init(void)
{
LCD_CS_H();
LCD_WR_H();
delay_ms(150);
write_cmd_data(0x0000,0x0001);
delay_ms(150);
DeviceCode = LCD_ReadReg(0x0000); //¶ÁÈ¡ÈκεØÖ·¶¼¿ÉÒÔ
write_cmd_data(0x0000,0x0000);
write_cmd_data(0x0001,0x0100); //ÖðÐÐɨÃ裬Êä³öµÄÒƶ¯·½Ïò´ÓS720µ½S1
write_cmd_data(0x0002,0x0400); //Ðе¹ÖÃ
write_cmd_data(0x0003,0x1030); //
write_cmd_data(0x0004,0x0000); //±ÈÀýËõ·ÅÉèÖ㺲»Ëõ·Å
write_cmd_data(0x0008, 0x0202); // set the back porch and front porch
write_cmd_data(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
write_cmd_data(0x000A, 0x0000); // FMARK function
write_cmd_data(0x000C, 0x0001); // 16Bit RGB interface setting
write_cmd_data(0x000D, 0x0000); // Frame marker Position
write_cmd_data(0x000F, 0x0000); // RGB interface polarity
delay_ms(50);
write_cmd_data(0x0007, 0x0101);
delay_ms(50);
write_cmd_data(0x10,(1<<12)|(0<<8)|(1<<7)|(1<<6)|(0<<4)); //Power Control 1.(0x16b0)
write_cmd_data(0x11,0x0007); //Power Control 2.(0x0001)
write_cmd_data(0x12,(1<<8)|(1<<4)|(0<<0)); //Power Control 3.(0x0138)
write_cmd_data(0x13,0x0b00); //Power Control 4.
write_cmd_data(0x29,0x0000); //Power Control 7.
write_cmd_data(0x2b,(1<<14)|(1<<4));
write_cmd_data(0x50,0); //Set X Star
//ˮƽGRAMÖÕֹλÖÃSet X End.
write_cmd_data(0x51,239); //Set Y Star
write_cmd_data(0x52,0); //Set Y End.t.
write_cmd_data(0x53,319); //
write_cmd_data(0x60,0x2700); //Driver Output Control.
write_cmd_data(0x61,0x0001); //Driver Output Control.
write_cmd_data(0x6a,0x0000); //Vertical Srcoll Control.
write_cmd_data(0x80,0x0000); //Display Position? Partial Display 1.
write_cmd_data(0x81,0x0000); //RAM Address Start? Partial Display 1.
write_cmd_data(0x82,0x0000); //RAM Address End-Partial Display 1.
write_cmd_data(0x83,0x0000); //Displsy Position? Partial Display 2.
write_cmd_data(0x84,0x0000); //RAM Address Start? Partial Display 2.
write_cmd_data(0x85,0x0000); //RAM Address End? Partial Display 2.
write_cmd_data(0x90,(0<<7)|(16<<0)); //Frame Cycle Contral.(0x0013)
write_cmd_data(0x92,0x0000); //Panel Interface Contral 2.(0x0000)
write_cmd_data(0x93,0x0001); //Panel Interface Contral 3.
write_cmd_data(0x95,0x0110); //Frame Cycle Contral.(0x0110)
write_cmd_data(0x97,(0<<8)); //
write_cmd_data(0x98,0x0000); //Frame Cycle Contral.
write_cmd_data(0x07,0x0173); //(0x0173) ¿ªÏÔʾ
LCD_BK_ON();//µãÁÁ±³¹â
LCD_Clear(WHITE);
}
void write_cmd(unsigned int cmd)
{
LCD_RS_L();
LCD_CS_L();
DATAOUT(cmd);
LCD_WR_L();
LCD_WR_H();
LCD_CS_H();
}
void write_data(unsigned int data)
{
LCD_RS_H();
LCD_CS_L();
DATAOUT(data);
LCD_WR_L();
LCD_WR_H();
LCD_CS_H();
}
void write_cmd_data(unsigned int cmd,u16 data)
{
write_cmd(cmd);
write_data(data);
}
显示汉字所用的取模软件是PCtolcd2002
图片显示所用的取模软件是Image2lcd
|
-
-
|