主题中讨论的其他部件: MSP-GRLIB
工具/软件:Code Composer Studio
您好,
我使用的是MSP430G2553和Mikroelektronic LCD 320 x 240,通信是SPI和ILI9341库。 我按照数据表中提到的命令,它以potrait模式显示数据。 通过在内存访问控制(36h)中选择MV =1 (行/列交换),LCD已更改为横向,但LCD宽度一直工作到240 (240到320无,请参见随附的图片)。 我选择了液晶显示器背景黑色,水平显示黑色多达240。 请告诉我如何在LCD 320 x 240中访问全像素。 谢谢。
#define lcd_width 320
#define lcd_height 240
set_instruction (0,0x01);//软件重置
__DELAY周期(5);
set_instruction(0, 0x28);//显示关闭
//------------------
set_instruction(0, 0xcf);
set_instruction(1,0x00);
set_instruction(1,0x83);
set_instruction(1,0x30);
set_instruction(0, 0xED);
set_instruction(1,0x64);
set_instruction(1,0x03);
set_instruction(1,0x12);
set_instruction(1,0x81);
set_instruction(0, 0xe8);
set_instruction(1,0x85);
set_instruction(1,0x01);
set_instruction(1,0x79);
set_instruction(0, 0xcb);
set_instruction(1,0x39);
set_instruction(1,0x2C);
set_instruction(1,0x00);
set_instruction(1,0x34);
set_instruction(1,0x02);
set_instruction(0, 0xf7);
set_instruction(1,0x20);
set_instruction(0),0xEA;
set_instruction(1,0x00);
set_instruction(1,0x00);
//----------- 电源控制---------------------------
set_instruction(0, 0xc0);//电源控制
set_instruction(1,0x26);
set_instruction(0, 0xc1);//电源控制
set_instruction(1,0x11);
//----------- VCOM --- write_cmd(0xc5);//VCOM控件
set_instruction(0, 0xc5);//电源控制
set_instruction(1,0x35);//35
set_instruction (1,0x3e);//3E
set_instruction(0);//VCOM控件
set_instruction (1,0xbe);// 0x94
//----------- 内存访问控制---------------------------
set_instruction (0,0x36);//内存访问控制
set_instruction (1,0x28);// mv =1 Landscape
set_instruction(0, 0x3a);//像素格式集
set_instruction(1,0x55);//16位/pixel
//----------- 帧速率---------------------------
set_instruction(0, 0xb1);//帧速率
set_instruction(1,0x00);
set_instruction(1,0x1B);//70
//----------- 伽马--------
set_instruction (0,0xf2);// 3Gamma函数禁用
set_instruction(1,0x08);
set_instruction(0, 0x26);
set_instruction(1,0x01);// gamma set 4 gamma curve 01/02/04/08
set_instruction(0, 0xE0);//正gamma校正
set_instruction(1),0x1f;
set_instruction(1),0x1a;
set_instruction(1,0x18);
set_instruction(1),0x0a;
set_instruction(1,0x0F);
set_instruction(1,0x06);
set_instruction(1,0x45);
set_instruction(1,0x87);
set_instruction(1,0x32);
set_instruction(1),0x0a;
set_instruction(1,0x07);
set_instruction(1,0x02);
set_instruction(1,0x07);
set_instruction(1,0x05);
set_instruction(1,0x00);
set_instruction(0, 0xE1);//negamma校正
set_instruction(1,0x00);
set_instruction(1,0x25);
set_instruction(1,0x27);
set_instruction(1,0x05);
set_instruction(1,0x10);
set_instruction(1,0x09);
set_instruction(1),0x3a;
set_instruction(1,0x78);
set_instruction(1),0x4d;
set_instruction(1,0x05);
set_instruction(1,0x18);
set_instruction(1),0x0d;
set_instruction(1,0x38);
set_instruction(1),0x3a;
set_instruction(1),0x1f;
//----------- DDRAM --------
set_instruction(0, 0x2a);//列集
set_instruction(1,0x00);
set_instruction(1,0x00);
set_instruction(1),0xEF;
set_instruction(0, 0x2b);//页面地址集
set_instruction(1,0x00);
set_instruction(1,0x00);
set_instruction(1,0x01);
set_instruction(1,0x3F);
// set_instruction (0,0x34);//撕裂效应关闭
//set_instruction (0,0x35);//上的撕裂效应
// set_instruction(0);//显示反转
//set_instruction (1,0x00);
set_instruction(0, 0xb7);//输入模式设置
set_instruction(1,0x07);
//----------- 显示-----------------------
set_instruction(0, 0xb6);//显示功能控制
set_instruction(1),0x0a;
set_instruction(1,0x82);
set_instruction(1,0x27);
set_instruction(1,0x00);
set_instruction(0, 0x11);//睡眠输出
__DELAY周期(100);
set_instruction(0, 0x29);//显示打开
__DELAY周期(100);
set_instruction(0);//内存写入
Fill显示屏(LCD宽度,LCD高度,C黑色);
draW_STRING (0,0,"Hello World",0xF800,Transp,0,0);