查看: 4925|回复: 2

[GD32F450测试]6、采用ARMmbed[STM32F429工程]实验-TFTLCD驱显

[复制链接]
  • TA的每日心情
    开心
    2019-11-19 11:07
  • 签到天数: 226 天

    连续签到: 1 天

    [LV.7]常住居民III

    发表于 2017-6-13 16:06:31 | 显示全部楼层 |阅读模式
    分享到:
    实验5进行了采用STM32F429MBED工程开发GD32F450的尝试遇到不少问题,结果仔细分析用户手册和实际电路测量,基本上弄清楚了引脚的关系,pinNames.h的定义中的许多与实际不太符合,于是采样直接定义引脚的方式,实验从具有8位数据支持RGB565格式的并口2.2英寸TFTLCD做实验,简单介绍LCD的参数:2.2Inch TFT LCD,有200X176点分辨率,驱动芯片为S6D0128,8位数据线。为了程序简洁和易查看,单独写一个22lcd.h函数存放与LCD有关的定义和设置,代码如下,为了更好的说明,一段一段的写出:
    首先定义并行总线,也可以定义为8位长:
    BusOut busH(PA_7,PB_11,PB_12,PB_13,PA_2,PA_1,PC_1,PB_5);//LSB->MSB
    定义控制引脚:
    DigitalOut res(PC_13);
    DigitalOut pdc(PA_12);
    DigitalOut prd(PA_11);
    DigitalOut pwr(PA_10);
    DigitalOut pcs(PA_9);
    定义外部变量:
    extern int cor,colo;
    以下为ASCII点阵[8X16]和中文点阵[16X16]:
    const unsigned char asc2[][16]={//8X16 || Take Mode-Test
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//space
    {0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x18,0x00,0x00,0x00},//!
    {0x00,0x08,0x30,0x48,0x30,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//"
    {0x00,0x04,0x04,0x1F,0x04,0x1F,0x04,0x00,0x00,0x40,0xF8,0x40,0xF8,0x40,0x40,0x00},//#
    {0x00,0x0E,0x11,0x3F,0x10,0x0C,0x00,0x00,0x00,0x30,0x08,0xFE,0x88,0x70,0x00,0x00},//$
    {0x0E,0x11,0x0E,0x01,0x06,0x18,0x00,0x00,0x00,0x18,0x60,0x80,0x70,0x88,0x70,0x00},//%
    {0x00,0x0F,0x11,0x0F,0x01,0x01,0x00,0x00,0xF0,0x08,0xC8,0x28,0xF0,0x08,0x08,0x00},//&
    {0x08,0x68,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//'
    {0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00},//(
    {0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x00,0x04,0x08,0x30,0xC0,0x00,0x00,0x00},//)
    {0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00},//**/--10
    {0x01,0x01,0x01,0x0F,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00},//+
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x1A,0x1C,0x00,0x00,0x00,0x00,0x00},//,
    {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//-
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00},//.
    {0x00,0x00,0x00,0x01,0x06,0x38,0x40,0x00,0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00},///
    {0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00},//0
    {0x00,0x08,0x08,0x1F,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00},//1
    {0x00,0x0C,0x10,0x10,0x10,0x11,0x0E,0x00,0x00,0x18,0x28,0x48,0x88,0x08,0x18,0x00},//2
    {0x00,0x0C,0x10,0x11,0x11,0x12,0x0C,0x00,0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00},//3
    {0x00,0x01,0x02,0x04,0x1F,0x00,0x00,0x00,0x00,0xC0,0x40,0x48,0xF8,0x48,0x48,0x00},//4--20
    {0x00,0x1F,0x11,0x12,0x12,0x12,0x11,0x00,0x00,0x30,0x08,0x08,0x08,0x08,0xF0,0x00},//5
    {0x00,0x07,0x08,0x11,0x11,0x19,0x00,0x00,0x00,0xF0,0x88,0x08,0x08,0x08,0xF0,0x00},//6
    {0x00,0x1C,0x10,0x10,0x13,0x1C,0x10,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00},//7
    {0x00,0x0E,0x11,0x11,0x11,0x11,0x0E,0x00,0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00},//8
    {0x00,0x0F,0x10,0x10,0x10,0x09,0x07,0x00,0x00,0x00,0x98,0x88,0x88,0x10,0xE0,0x00},//9
    {0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00},//:
    {0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x0C,0x00,0x00,0x00,0x00},//;
    {0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00},//<
    {0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00},//=
    {0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00},//>--30
    {0x00,0x1C,0x20,0x20,0x20,0x21,0x1E,0x00,0x00,0x00,0x00,0x18,0xD8,0x00,0x00,0x00},//?
    {0x07,0x08,0x13,0x14,0x17,0x08,0x07,0x00,0xE0,0x10,0xE8,0x28,0xC8,0x28,0xD0,0x00},//@
    {0x00,0x00,0x07,0x18,0x07,0x00,0x00,0x00,0x08,0x78,0xC8,0x40,0xC8,0x78,0x08,0x00},//A
    {0x10,0x1F,0x11,0x11,0x11,0x12,0x0C,0x00,0x08,0xF8,0x08,0x08,0x08,0x88,0x70,0x00},//B
    {0x07,0x08,0x10,0x10,0x10,0x10,0x1C,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0x20,0x00},//C
    {0x10,0x1F,0x10,0x10,0x10,0x08,0x07,0x00,0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00},//D
    {0x10,0x1F,0x11,0x11,0x17,0x10,0x08,0x00,0x08,0xF8,0x08,0x08,0xC8,0x08,0x10,0x00},//E
    {0x10,0x1F,0x11,0x11,0x17,0x10,0x08,0x00,0x08,0xF8,0x08,0x00,0xC0,0x00,0x00,0x00},//F
    {0x07,0x08,0x10,0x10,0x10,0x1C,0x00,0x00,0xE0,0x10,0x08,0x08,0x48,0x70,0x40,0x00},//G
    {0x10,0x1F,0x11,0x01,0x11,0x1F,0x10,0x00,0x08,0xF8,0x08,0x00,0x08,0xF8,0x08,0x00},//H--40
    {0x00,0x10,0x10,0x1F,0x10,0x10,0x00,0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00},//I
    {0x00,0x00,0x10,0x10,0x1F,0x10,0x10,0x00,0x06,0x02,0x02,0x02,0xFC,0x00,0x00,0x00},//J
    {0x10,0x1F,0x11,0x03,0x14,0x18,0x10,0x00,0x08,0xF8,0x08,0x80,0x68,0x18,0x08,0x00},//K
    {0x10,0x1F,0x10,0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0x08,0x08,0x08,0x08,0x18,0x00},//L
    {0x10,0x1F,0x1E,0x01,0x1E,0x1F,0x10,0x00,0x08,0xF8,0x00,0xF8,0x00,0xF8,0x08,0x00},//M
    {0x10,0x1F,0x1C,0x03,0x10,0x1F,0x10,0x00,0x08,0xF8,0x08,0x80,0x70,0xF8,0x00,0x00},//N
    {0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00},//O
    {0x10,0x1F,0x11,0x11,0x11,0x11,0x0E,0x00,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00},//P
    {0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0xE0,0x10,0x28,0x28,0x18,0x14,0xE4,0x00},//Q
    {0x10,0x1F,0x11,0x11,0x11,0x0E,0x00,0x00,0x08,0xF8,0x08,0x80,0x60,0x18,0x08,0x00},//R--50
    {0x00,0x0E,0x11,0x11,0x10,0x10,0x1C,0x00,0x00,0x38,0x08,0x08,0x88,0x88,0x70,0x00},//S
    {0x18,0x10,0x10,0x1F,0x10,0x10,0x18,0x00,0x00,0x00,0x08,0xF8,0x08,0x00,0x00,0x00},//T
    {0x10,0x1F,0x10,0x00,0x10,0x1F,0x10,0x00,0x00,0xF0,0x08,0x08,0x08,0xF0,0x00,0x00},//U
    {0x10,0x1E,0x11,0x00,0x11,0x1E,0x10,0x00,0x00,0x00,0xE0,0x18,0xE0,0x00,0x00,0x00},//V
    {0x10,0x1F,0x00,0x1F,0x00,0x1F,0x10,0x00,0x00,0x80,0xF8,0x00,0xF8,0x80,0x00,0x00},//W
    {0x10,0x18,0x16,0x01,0x16,0x18,0x10,0x00,0x08,0x18,0x68,0x80,0x68,0x18,0x08,0x00},//X
    {0x10,0x1C,0x13,0x00,0x13,0x1C,0x10,0x00,0x00,0x00,0x08,0xF8,0x08,0x00,0x00,0x00},//Y
    {0x00,0x08,0x10,0x10,0x13,0x1C,0x10,0x00,0x00,0x08,0x38,0xC8,0x08,0x08,0x18,0x00},//Z
    {0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x00},//[
    {0x00,0x30,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x1C,0x02,0x00},//\//--60
    {0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00,0x00,0x00},//]
    {0x00,0x00,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//^
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00},//_
    {0x08,0x68,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//'
    {0x00,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x30,0x48,0x88,0x88,0xF8,0x08,0x00},//a
    {0x10,0x1F,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00},//b
    {0x00,0x00,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0x00},//c
    {0x00,0x01,0x02,0x02,0x02,0x12,0x1F,0x00,0x00,0xF0,0x08,0x08,0x08,0x10,0xF8,0x08},//d
    {0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x00,0x00,0xF0,0x88,0x88,0x88,0x88,0x90,0x00},//e
    {0x00,0x02,0x02,0x0F,0x12,0x12,0x18,0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00},//f--70
    {0x00,0x01,0x02,0x02,0x02,0x03,0x02,0x00,0x00,0xAC,0x52,0x52,0x52,0x92,0x0C,0x00},//g
    {0x10,0x1F,0x01,0x02,0x02,0x02,0x01,0x00,0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08},//h
    {0x00,0x02,0x1A,0x1B,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00},//i
    {0x00,0x00,0x00,0x02,0x1A,0x1B,0x00,0x00,0x00,0x06,0x02,0x02,0x02,0xFC,0x00,0x00},//j
    {0x10,0x1F,0x00,0x00,0x03,0x02,0x02,0x00,0x08,0xF8,0x48,0x80,0x68,0x18,0x08,0x00},//k
    {0x00,0x10,0x10,0x1F,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00},//l
    {0x02,0x03,0x02,0x03,0x02,0x01,0x00,0x00,0x08,0xF8,0x00,0xF8,0x00,0xF8,0x08,0x00},//m
    {0x02,0x03,0x01,0x02,0x02,0x02,0x01,0x00,0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08},//n
    {0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00},//o
    {0x02,0x03,0x01,0x02,0x02,0x02,0x01,0x00,0x02,0xFE,0x0A,0x08,0x08,0x08,0xF0,0x00},//p--80
    {0x00,0x01,0x02,0x02,0x02,0x02,0x03,0x00,0x00,0xF0,0x08,0x08,0x08,0x12,0xFE,0x02},//q
    {0x02,0x02,0x03,0x01,0x02,0x02,0x03,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00},//r
    {0x00,0x01,0x02,0x02,0x02,0x03,0x00,0x00,0x00,0x98,0x48,0x48,0x48,0x30,0x00,0x00},//s
    {0x00,0x02,0x02,0x0F,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0xF0,0x08,0x08,0x00,0x00},//t
    {0x02,0x03,0x00,0x00,0x00,0x02,0x03,0x00,0x00,0xF0,0x08,0x08,0x08,0x10,0xF8,0x08},//u
    {0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02,0x00,0x00,0xE0,0x18,0x20,0xC0,0x00,0x00},//v
    {0x02,0x03,0x00,0x03,0x00,0x03,0x02,0x00,0x00,0xC0,0x38,0xC0,0x38,0xC0,0x00,0x00},//w
    {0x00,0x02,0x03,0x00,0x02,0x03,0x02,0x00,0x00,0x08,0x18,0xE8,0xE0,0x18,0x08,0x00},//x
    {0x02,0x03,0x02,0x00,0x00,0x02,0x03,0x02,0x02,0x02,0xE2,0x1C,0x30,0xC0,0x00,0x00},//y
    {0x00,0x03,0x02,0x02,0x02,0x03,0x02,0x00,0x00,0x08,0x18,0x68,0x88,0x08,0x18,0x00},//z--90
    {0x00,0x00,0x00,0x01,0x7E,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x04,0x00,0x00},//{
    {0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00},//|
    {0x00,0x00,0x40,0x7E,0x01,0x00,0x00,0x00,0x00,0x00,0x04,0xFC,0x00,0x00,0x00,0x00},//}
    {0x00,0x60,0x80,0x80,0x40,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//~
    {0x00,0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//DEL--95
    //};unsigned char hanzi[][32]={//Chinese 16X16 ==Take Mode Test
    {0x00,0x22,0x22,0x3F,0x22,0x22,0x04,0x44,0x10,0x10,0xF0,0x20,0x24,0x08,0x30,0xC0},
    {0x47,0x44,0x44,0x47,0x44,0x04,0x00,0x00,0x00,0x00,0xF8,0x04,0x1C,0x00,0x00,0x00},//WAN--97
    {0x00,0x00,0xFF,0x80,0x84,0xA4,0xA7,0xA4,0x00,0xFC,0x08,0x28,0x48,0x88,0x08,0x08},
    {0xA4,0xA7,0xA4,0x84,0x80,0xFF,0x00,0x00,0xC8,0x28,0x68,0x08,0xFC,0x00,0x00,0x00},//YUAN--99
    {0x00,0x08,0x08,0xFF,0x08,0x04,0x3F,0x04,0x10,0x10,0xE0,0x20,0x00,0xF8,0x04,0x04},
    {0x08,0xFF,0x08,0x10,0x3F,0x00,0x00,0x00,0xE4,0x04,0x44,0xC4,0x1C,0x00,0x00,0x00},//DI--101
    {0x00,0x00,0x00,0x3F,0xA4,0x64,0x24,0x3F,0x10,0x10,0x90,0x90,0x90,0x90,0xFC,0x90},
    {0x24,0x64,0xA4,0x3F,0x00,0x00,0x00,0x00,0x90,0x90,0x90,0x10,0x10,0x00,0x00,0x00},//DAN--103
    {0x00,0x00,0x00,0x7F,0x08,0x08,0x08,0x08,0x04,0x08,0xF0,0x80,0x80,0x80,0x80,0x80},
    {0x08,0xF8,0x08,0x08,0x08,0x00,0x00,0x00,0x80,0xFC,0x00,0x00,0x00,0x00,0x00,0x00},//PIAN--105
    {0x00,0x10,0x13,0xFF,0x12,0x11,0x00,0x7F,0x80,0x00,0xFC,0x00,0x04,0x18,0xE0,0x00},
    {0x40,0x40,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x04,0x1C,0x00,0x00,0x00},//JI--107
    {0x00,0x00,0x1F,0x12,0x12,0x12,0x12,0xFF,0x00,0xE0,0x40,0x40,0x40,0x40,0xF8,0x44},
    {0x12,0x12,0x12,0x12,0x1F,0x00,0x00,0x00,0x44,0x44,0x44,0xC4,0x1C,0x00,0x00,0x00},//DIAN--109
    {0x00,0x00,0x00,0x7F,0x40,0x42,0x42,0x42,0x04,0x18,0xE0,0x04,0x04,0x04,0x04,0xFC},
    {0x5F,0x42,0x42,0x42,0x42,0x40,0x00,0x00,0x04,0x04,0x44,0x34,0x04,0x00,0x00,0x00},//YA--111
    {0x00,0x04,0x3C,0x04,0xFD,0x24,0x24,0x40,0x44,0x84,0x08,0xD0,0x20,0xC0,0x04,0xE8},
    {0x4F,0x58,0x6B,0x48,0x4F,0x40,0x00,0x00,0x10,0xE0,0x10,0xEC,0x00,0x00,0x00,0x00},//PING--113
    {0x00,0x08,0x25,0x22,0x20,0x24,0xAD,0x76,0xA0,0x20,0x20,0x20,0xA0,0xA0,0xFC,0xA0},
    {0x24,0x29,0x20,0x22,0x25,0x08,0x00,0x00,0xA0,0xE0,0x20,0x20,0xA0,0x00,0x00,0x00},//LV--115
    {0x00,0x04,0x84,0x67,0x00,0x04,0x04,0x04,0x00,0x00,0xF8,0x10,0x20,0x00,0x00,0x00},
    {0x04,0xFF,0x04,0x04,0x04,0x04,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//JI--117
    {0x00,0x52,0x34,0x19,0xFE,0x18,0x34,0x52,0x84,0xA4,0xE8,0x98,0x90,0xE8,0x04,0x00},
    {0x02,0x0C,0xF3,0x10,0x1F,0x10,0x00,0x00,0x04,0xC8,0x30,0xC8,0x04,0x00,0x00,0x00},//SHU--119
    {0x00,0x08,0x10,0x2F,0x49,0xC9,0x49,0x4F,0x04,0x18,0xE0,0x20,0x20,0x20,0xF8,0x20},
    {0x59,0x69,0x49,0x09,0x0F,0x00,0x00,0x00,0x20,0x24,0x24,0xFC,0x00,0x00,0x00,0x00},//JIAO--121
    {0x00,0x26,0x3A,0xE7,0x22,0x22,0x00,0x24,0x20,0x20,0xFC,0x40,0x40,0x00,0x80,0x80},
    {0x25,0x2E,0xF4,0x24,0x24,0x24,0x00,0x00,0x90,0x88,0x94,0xA0,0xC0,0x00,0x00,0x00},//ZHUAN--123
    {0x00,0x02,0x42,0x33,0x00,0x20,0x2F,0x29,0x04,0x08,0xF0,0x08,0x14,0x24,0x44,0x84},
    {0x29,0xFF,0x29,0x29,0x2F,0x20,0x00,0x00,0xFC,0x84,0x44,0x24,0x14,0x00,0x00,0x00},//SU--125
    {0x00,0x00,0x00,0x3F,0x28,0x28,0x3E,0xAA,0x04,0x18,0xE0,0x04,0x84,0xC8,0xA8,0x90},
    {0x6A,0x2A,0x2A,0x3E,0x28,0x28,0x00,0x00,0x90,0xA8,0xC8,0x84,0x04,0x00,0x00,0x00},//DU--127
    {0x00,0x08,0x44,0x21,0x00,0x7F,0x40,0x5F,0x18,0x60,0x80,0x04,0x88,0x30,0xC0,0x20},
    {0x40,0x7F,0x00,0x1F,0x00,0xFF,0x00,0x00,0x98,0x00,0xC4,0x04,0xFC,0x00,0x00,0x00},//CE--129
    {0x00,0x04,0x84,0x67,0x00,0x10,0x12,0x13,0x00,0x00,0xF8,0x10,0x28,0x08,0xF8,0x10},
    {0x12,0x10,0xFF,0x10,0x90,0x50,0x00,0x00,0x10,0x80,0x70,0x08,0x3C,0x00,0x00,0x00},//SHI--131
    {0x00,0x04,0x04,0x44,0x34,0x04,0x05,0xFF,0x10,0x10,0x20,0x40,0x80,0x00,0xFC,0x00},
    {0x05,0x04,0x14,0x64,0x04,0x04,0x00,0x00,0x80,0x40,0x20,0x10,0x10,0x00,0x00,0x00},//MI--133
    {0x00,0x00,0xFF,0x80,0xBF,0xA4,0xA4,0xA4,0x04,0xF8,0x04,0xA4,0xA4,0xA4,0xA4,0xFC},
    {0xBF,0xA4,0xA4,0xA4,0xBF,0x80,0x00,0x00,0xA4,0xA4,0xA4,0xA4,0x04,0x00,0x00,0x00},//LI--135
    {0x00,0x06,0x44,0x44,0x5C,0x54,0x54,0xD4,0x00,0x88,0xA8,0xA8,0xA8,0xA8,0xF8,0x54},
    {0x55,0x55,0x5D,0x45,0x44,0x06,0x00,0x00,0x54,0x54,0x14,0x04,0x0C,0x00,0x00,0x00},//HAO--137
    {0x00,0x04,0x08,0x3F,0xC0,0x08,0x08,0x08,0x00,0x00,0xFC,0x00,0x04,0x08,0x30,0xC0},
    {0x09,0xFE,0x09,0x48,0x38,0x08,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00,0x00,0x00},//FU--139
    {0x00,0x02,0x42,0x33,0x00,0x11,0x11,0xFF,0x04,0x08,0xF0,0x08,0x04,0x14,0xE4,0x04},
    {0x11,0x11,0x11,0xFF,0x11,0x11,0x00,0x00,0x04,0x04,0xF4,0x04,0x04,0x00,0x00,0x00},//JIN--141
    {0x00,0x02,0x42,0x33,0x00,0x00,0x7F,0x54,0x04,0x08,0xF0,0x08,0x04,0xF4,0x24,0x44},
    {0x56,0x55,0x54,0x7D,0x02,0x00,0x00,0x00,0x04,0x84,0x44,0x34,0x04,0x00,0x00,0x00},//TUI--143
    {0x00,0x02,0xF2,0x92,0x92,0x93,0xF2,0x06,0x40,0x7C,0xA4,0xA4,0x24,0x3C,0x00,0x3C},
    {0xF2,0x93,0x9A,0x96,0xF2,0x02,0x00,0x00,0x24,0xA4,0xA4,0x7C,0x40,0x00,0x00,0x00},//QI--145
    };
    以下是各种LCD控制模块代码:
    //Write plus
    void wri(){
    pwr=0;pwr=1;
    }
    //Write 2 byte to lcd[if a byte Ok]
    void d2l2(unsigned int dd,unsigned int com){
    pcs=0;
    prd=1;
    pdc=com;
    busH=(dd&0xFF00)>>8;
    wri();
    busH=dd&0x00FF;
    wri();
    prd=1;
    pcs=1;
    }
    //LCD Clear
    void lcdClear(){
    int i,j;
    d2l2(0x0020,0);d2l2(0x00B0,1);//GRAM horizontal Address
    d2l2(0x0021,0);d2l2(0x00DC,1);//GRAM Vertical Address
    d2l2(0x0050,0);d2l2(0x0000,1);//Horizontal GRAM Start Address
    d2l2(0x0051,0);d2l2(0x00B0,1);//Horizontal GRAM End Address=0xB2=0x00AF
    d2l2(0x0052,0);d2l2(0x0000,1);//Vertical GRAM Start Address
    d2l2(0x0053,0);d2l2(0x00DC,1);//Vertical GRAM Start Address=0xDC=0x00DB
    d2l2(0x0022,0);
    for(i=0;i<(0xDD);i++){for(j=0;j<(0xB0);j++){d2l2(0x0000,1);}}
    }
    //Set LCD x,y and Full ram
    void setXY(unsigned int x,unsigned int y,unsigned char zc){
    //x+=8;//
    y+=3;
    d2l2(0x0020,0);d2l2(x,1);//GRAM horizontal Address
    d2l2(0x0021,0);d2l2(y,1);//GRAM Vertical Address
    d2l2(0x0050,0);d2l2(x,1);//Horizontal GRAM Start Address
    d2l2(0x0051,0);d2l2(x+zc,1);//Horizontal GRAM End Address=0x00AF
    d2l2(0x0052,0);d2l2(y,1);//Vertical GRAM Start Address
    d2l2(0x0053,0);d2l2(y+zc,1);//Vertical GRAM End Address=0x00DB
    d2l2(0x0022,0);
    }
    //Set Display Partial
    void area(unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1){
    int i,j,xz,yz;
    xz=x1<<8;xz=xz||x0;yz=y1<<8;yz=yz||y0;
    d2l2(0x0050,0);d2l2(x0,1);//Horizontal GRAM Start Address
    d2l2(0x0051,0);d2l2(x1,1);//Horizontal GRAM End Address=0x00AF
    d2l2(0x0052,0);d2l2(y0,1);//Vertical GRAM Start Address
    d2l2(0x0053,0);d2l2(y1,1);//Vertical GRAM End Address=0x00DB
    d2l2(0x0022,0);//,0x0000);
    for(i=0;i<(x1-x0-1);i++){for(j=0;j<(y1-y0-1);j++){cor=0xFFFF-colo;d2l2(cor,1);}}
    }
    //Send a ASCII 8X16dots to LCD,pag[row],col:addr,c:asc2[][]
    void c2l(unsigned int pag,unsigned int col,unsigned char c){
    unsigned char i,j,zf;
    setXY(pag*8,col*8,7);
    for (j=0;j<8;j++){
      zf=asc2[c][j];
      for(i=0;i<8;i++){
       if(zf&0x80){cor=colo;}else{cor=0xFFFF-colo;}
       d2l2(cor,1);
       zf=zf<<1;
      }
    }
    setXY(pag*8,col*8+8,7);
    for (j=8;j<16;j++){
      zf=asc2[c][j];
      for(i=0;i<8;i++){
       if(zf&0x80){cor=colo;}else{cor=0xFFFF-colo;}
       d2l2(cor,1);
       zf=zf<<1;
      }
    }
    }
    //Send Chineses 16X16dots to LCD,pag[row],col:addr,c:hanzi[c][32]
    void h2l(unsigned char pag, unsigned char col,unsigned char c){
    c2l(pag,col,c*2+96);//1/2 chinese
    c2l(pag+1,col,c*2+97);//2/2 chinese
    }
    LCD初始化代码:
    //2.2 TFT LCD Initial IC=eR61503U
    void lcdInit(void){
    res=0;
    wait(0.1f);
    res=1;
    wait(0.1f);
    d2l2(0x0000,0);d2l2(0x0001,1);//OSC Start
    wait(0.05f);
    //Display Control
    d2l2(0x0001,0);d2l2(0x0100,1);//Driver Output Control:00000,SM,0,SS=0S1->S528|=0S528->S1,00000000=0500
    d2l2(0x0002,0);d2l2(0x0700,1);//LCD Driving Wave Control:000001,B/C,EOR,00000000=0700
    d2l2(0x0003,0);d2l2(0x4038,1);//Entry Mode:TRI,DFM1-0,BGR,00,HWM,000,I/D1-0,AM,000=1030
    d2l2(0x0007,0);d2l2(0x0233,1);//Display Control1:00,PTDE1-0,00,Base,000,GON,DTE,CL,0,D1-0=0133
    d2l2(0x0008,0);d2l2(0x0504,1);//Display Control2:0000,FP3-0,0000,BP3-0=0504
    d2l2(0x0009,0);d2l2(0x0000,1);//Display Control3:00000,PTS2-0,00,PTG1-0,ISC3-0=?
    d2l2(0x000C,0);d2l2(0x0002,1);//ExternalDisplsyInterfaceContro1l:0000000,RM,00,DM1-0,00,RIM1-0=0000
    d2l2(0x000F,0);d2l2(0x001B,1);//ExternalDisplayInterfaceControl2:00000000000,VSPL,HSPL,0,EPL,DPL
    //Power Control
    d2l2(0x0010,0);d2l2(0x11B0,1);//Power Control1:000,SAP,BT3-0,APE,AP1-0,0,DSTB,SLP,STB=11B0
    d2l2(0x0011,0);d2l2(0x0144,1);//Power Control2:00000,DCI2-0,0,DC2-0,0,VC2-0=0144
    d2l2(0x0012,0);d2l2(0x1137,1);//Power Control3:000,VON,000,VCMR,VREGIR,0,PSON,PON,VRH3-0=1137
    d2l2(0x0013,0);d2l2(0x007B,1);//Power Control4:VCOMG,000,VDV3-0,VCMSEL,00,VCM4-0=0070
    d2l2(0x0014,0);d2l2(0x8000,1);//Power Control5C5,000000000000000=8000
    wait(0.01f);
    d2l2(0x0018,0);d2l2(0x0000,1);//Power Control6:000000000000000PSE=0000
    wait(0.01f);
    //RAM Address
    d2l2(0x0020,0);d2l2(0x0000,1);//RAM Addr Set Horicomtal:00000000,AD7-0
    d2l2(0x0021,0);d2l2(0x00DC,1);//RAM Addr Set Vertical Addr:0000000,AD16-8
    wait(0.01f);
    //Gamma Control
    d2l2(0x0030,0);d2l2(0x0601,1);d2l2(0x0031,0);d2l2(0x0507,1);
    d2l2(0x0032,0);d2l2(0x0000,1);d2l2(0x0033,0);d2l2(0x0007,1);
    d2l2(0x0034,0);d2l2(0x0505,1);d2l2(0x0035,0);d2l2(0x0004,1);
    d2l2(0x0036,0);d2l2(0x0605,1);d2l2(0x0037,0);d2l2(0x0702,1);
    d2l2(0x0038,0);d2l2(0x0207,1);d2l2(0x0039,0);d2l2(0x0602,1);  
    d2l2(0x003A,0);d2l2(0x0000,1);
    wait(0.01f);
    //Windows Address Control
    d2l2(0x0050,0);d2l2(0x0000,1);//Horizontal RAM Start Addr:00000000,HSA7-0=0x0000
    d2l2(0x0051,0);d2l2(0x00B0,1);//Horizontal RAM End Addr:00000000,HEA7-0=0x00AF
    d2l2(0x0052,0);d2l2(0x0000,1);//Verical RAM Start Addr:0000000,VSA8-0=0x0000
    d2l2(0x0053,0);d2l2(0x00DC,1);//Vertical RAM End Addr:0000000,VEA8-0=0x00DB
    //Base Img Display Control
    d2l2(0x0070,0);d2l2(0x1B00,1);//Driver Output Control:GS=0G1->G220|=1G220->G1,00,NL4-0,000,SCN4-0=1B00
    d2l2(0x0071,0);d2l2(0x0003,1);//Base Image Display Control:00000000000000,VLE,REV=0x0001
    d2l2(0x007A,0);d2l2(0x0003,1);//Verical Scroll Control:00000000 000000,VLE=1EnScroll,REV=0x0000
    //Partial control instruction
    d2l2(0x0080,0);d2l2(0x0000,1);//Partial 1 Disp Position:00000000,PTDP07-00=0000
    d2l2(0x0081,0);d2l2(0x0000,1);//Partial Img1 RAM Start Addr:00000000,PTSA07-00=0100
    d2l2(0x0082,0);d2l2(0x00B0,1);//Partial Img1 RAM End Addr:00000000,PTEA07-00=0001
    d2l2(0x0083,0);d2l2(0x0000,1);//Partial Img2 Display Position:00000000,PTDP17-10=0001
    d2l2(0x0084,0);d2l2(0x0000,1);//Partial Img2 RAM Start Addr:00000000,PTSA17-10
    d2l2(0x0085,0);d2l2(0x00DC,1);//Partial Img2 RAM End Addr:00000000,PTEA17-10=0100
    wait(0.01f);
    //anel Interface Control
    d2l2(0x0090,0);d2l2(0x0000,1);//Panel Interface Control1:000000,DIVI1-0,0000,RTN3-0
    d2l2(0x0091,0);d2l2(0x0100,1);//Panel Interface Control2:00000,NOI2-0,00000000=0100
    d2l2(0x0092,0);d2l2(0x0003,1);//Panel Interface Control3:0000000000000,SDTI2-0
    d2l2(0x0093,0);d2l2(0x0000,1);//Panel Interface Control4:000000,DIVE1-0,00,RTNE5-0
    d2l2(0x0094,0);d2l2(0x0000,1);//Panel Interface Control5:0000,NOE3-0,00000000
    d2l2(0x0095,0);d2l2(0x0000,1);//Panel Interface Control6:0000000000000,SDTE2-0=0000
    wait(0.1f);
    }
    至此,TFTLCD的控制就完成了。下边编写mainBusLcd.cpp:
    连接函数:
    #include "mbed.h"
    #include "22lcd.h"
    类变量定义:
    DigitalOut led1(LED1);
    int colo=0x003F,cor=0x0000;
    //MAIN Programs
    int main(){
    float t0=1.0f;
    ioInit();
    lcdInit();
    colo=0x0000;cor=0xFFFF-colo;
    lcdClear();
    while(true){
      led1=!led1;
      dispAll();
      wait(t0);
      colo +=0x037F;cor=0xFFFF-colo;
      lcdClear();
    }
    }
    dispAll函数代码:
    //Display All Code
    void dispAll(void){
    int i,j,k;i=0;j=0;k=0;
    colo+=0x170F;
    cont:
    c2l(j,i*2,k%146);
    if(j<21){j++;
    }else{j=0;i++;colo+=0x0307;}
    k++;
    if(k<308) goto cont;
    }
    至此基于并口的TFTLCD的测试完成了。硬件连线见照片61,刷屏效果见照片62。
    结果评测,清屏速度大约需要近3秒钟,填充满屏的时间差不多也是近3秒钟。这就是采用模拟并口方案的问题。因为还没有找到采用辅助功能AF的设置方法,利用芯片本身的LCD驱动方式可能是主要的原因。现在还在进行测试,主要是两个方向:加入触屏检测——尽管此屏有电阻触摸屏,但没有专用的触摸芯片,需要自己模拟触屏的AD信号来检测;第二是继续进行芯片AF功能的探索。
    马上就到假期了,届时会有足够的时间进行测试。

    61-硬件连接

    61-硬件连接

    62-显示结果

    62-显示结果
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2017-6-6 13:23
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]偶尔看看II

    发表于 2017-6-14 00:14:13 | 显示全部楼层
    可以尝试用DMA方式来直写显示存储区域,这样刷屏就快些。
    快速刷屏是有技巧的。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2019-11-19 11:07
  • 签到天数: 226 天

    连续签到: 1 天

    [LV.7]常住居民III

     楼主| 发表于 2017-6-14 17:23:30 | 显示全部楼层
    wolfgang2015 发表于 2017-6-14 00:14
    可以尝试用DMA方式来直写显示存储区域,这样刷屏就快些。
    快速刷屏是有技巧的。 ...

    谢谢!实际上看了手册,此款芯片内带TFTLCD驱动,只是还不会通过设置辅助功能AF13的模式来实现此功能。目前采用的是mbed的定义并口方式,应该不是最佳的方法,只鞥说是最简的方法。用这种方法在其他芯片上试过,需要较高的系统时钟才可以使刷新几乎看不出来。
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-12-25 22:08 , Processed in 0.144226 second(s), 22 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.