コード例 #1
0
ファイル: LCD.c プロジェクト: vpcola/LPC1769_NYP
void LCD_Cmd(unsigned char cmd)
{
    LCD_DC(0); // Set to command mode
    LCD_CS(0);

    SSP0_Write(cmd);
    // Wait untill it sends out correctly
    SSP0_WaitBusy();
    LCD_DC(1);
}
コード例 #2
0
/******************************************************
 * 函数:display_chinese
 * 作用:显示单个汉字
 * 备注:
 ******************************************************/
void display_chinese(unsigned char row, unsigned char page,unsigned char *c) //row:列 page:页 dd:字符
{
	unsigned char i;

	set_pos(row*16, page*2);  //写数据 第一行起始地址设定,由于每个字符大小是6*12,占用两行
	for(i=0; i<16;i++)
          LCD_DC(c[i],1);//c代表在zifu数组中的位置

  	set_pos(row*16, page*2+1);//写数据 第二行起始地址设定
	for(i=16; i<32;i++)
          LCD_DC(c[i],1);
}
コード例 #3
0
/**************************************************
 * 函数:LCD_clear(void)
 * 作用:清屏
 * 备注:
 *************************************************/
void LCD_clear(void)
{
	unsigned char t;
	unsigned char k;
	LCD_DC(0x0c,0);
    LCD_DC(0x80,0);//设置首地址
	for(t=0;t<6;t++)//行
	{
		for(k=0;k<84;k++)//列
		{
			LCD_DC(0x00,1);		//写数据 0x00 清空

		}
	}
}
コード例 #4
0
/******************************************************
 * 函数:display_char(uchar x, uchar y,uchar c)
 * 作用:显示6x8的英文字符
 * 备注:
 *******************************************************/
void display_char6x8(uchar x, uchar y,uchar c)
{
	uchar line;

	 c -= 32;
	 set_pos(x*6,y);
	 for(line=0;line<6;line++)
	 {
		 LCD_DC(font6x8[c][line],1);
	 }
}
コード例 #5
0
ファイル: LCD.c プロジェクト: vpcola/LPC1769_NYP
void LCD_Hline(int x0, int x1, int y, int color)
{
    int w,j;
    w = x1 - x0 + 1;
    LCD_Window(x0,y,w,1);
    LCD_DC(0);
    LCD_CS(0);
    SSP0_Write(0x2C); // send pixel
    SSP0_WaitBusy();
    LCD_DC(1);
    SSP0_16(1);

    for (j=0; j<w; j++) {
        SSP0_Write(color);
    }
    SSP0_WaitBusy();
    SSP0_16(0);
    LCD_CS(1);
    LCD_WindowMax();
    return;
}
コード例 #6
0
ファイル: LCD.c プロジェクト: vpcola/LPC1769_NYP
void LCD_Vline(int x, int y0, int y1, int color)
{
    int h,y;
    h = y1 - y0 + 1;
    LCD_Window(x,y0,1,h);
    LCD_DC(0);
    LCD_CS(0);
    SSP0_Write(0x2C); // send pixel
    SSP0_WaitBusy();
    LCD_DC(1);
    SSP0_16(1);
    // switch to 16 bit Mode 3
    for (y=0; y<h; y++) {
        SSP0_Write(color);
    }
    SSP0_WaitBusy();
    SSP0_16(0);
    LCD_CS(1);
    LCD_WindowMax();
    return;
}
コード例 #7
0
/****************************************************
 * 函数:display_picture(x,y)
 * 功能:显示自定义图片
 * 备注:
 *****************************************************/
void display_picture(uchar x, uchar y, uchar lon,uchar high)
{
	uchar i,j;

	for(j=0;j<high;j++)
	{
		set_pos(x,y);
		for(i=0;i<lon;i++)
			{
				LCD_DC(picture[j][i],1);
			}
		y++;
	}

}
コード例 #8
0
/****************************************************
 * 函数:LCD_INIT(void)
 * 初始化液晶
 * 备注:
 ***************************************************/
void LCD_INIT(void)
{
    P6DIR |= BIT1+BIT2+BIT3+BIT4;
    P7DIR |= BIT0;
	REST_L;  	//0 使复位
  	delaylcd(1);
  	REST_H;  	//关复位
	CE_L;
	delaylcd(1);
	CE_H;
	delaylcd(1);
	LCD_DC(0x21,0);//初始化Lcd,功能设定使用扩充指令		0写指令
	LCD_DC(0xC8,0);//设定液晶偏置电压					0写指令
	LCD_DC(0x06,0);//温度校正							0写指令
    LCD_DC(0x13,0);//设置偏置系统(BSx) 1:48,设置为0x10~0x17 							0写指令
	LCD_DC(0x20,0);//使用基本指令,V=0,水平寻址			0写指令
    LCD_clear();
	LCD_DC(0x0C,0);//设定显示模式,正常显示				0写指令
	CE_L;
	delaylcd(200);
}
コード例 #9
0
/**********************************************
 * 函数:set_pos(uchar x, uchar y)
 * 作用:设置显示初始坐标
 * 备注
 **********************************************/
void set_pos(uchar x, uchar y)
{
	LCD_DC(0x40|y, 0);// column		0100 0000	0写指令	0x40|Y指令集中设置行地址的指令,Y:0~5
	LCD_DC(0x80|x, 0);// row		1000 0000	0写指令	0x80|X指令集中设置列地址的指令,X:0~83
}
コード例 #10
0
ファイル: LCD.c プロジェクト: vpcola/LPC1769_NYP
// LCD Reset Sequence is copied from
// internet sources. There are a number of
// command registers needed to be set, some of
// which I wonder what they are being used for?
void LCD_Reset()
{
    //int i;
    LCD_CS(1);        // cs high
    LCD_DC(1);        // dc high
    LCD_RST(0);       // display reset

    // wait_us(50);
    Delay(1);         // Delay 1 ms
    LCD_RST(1);       // end hardware reset
    Delay(5);

    LCD_Cmd(0x01);    // SW reset
    Delay(5);
    LCD_Cmd(0x28);    // display off

    /* Start Initial Sequence */
    LCD_Cmd(0xCF);
    SSP0_Write(0x00);
    SSP0_Write(0x83);
    SSP0_Write(0x30);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xED);
    SSP0_Write(0x64);
    SSP0_Write(0x03);
    SSP0_Write(0x12);
    SSP0_Write(0x81);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xE8);
    SSP0_Write(0x85);
    SSP0_Write(0x01);
    SSP0_Write(0x79);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xCB);
    SSP0_Write(0x39);
    SSP0_Write(0x2C);
    SSP0_Write(0x00);
    SSP0_Write(0x34);
    SSP0_Write(0x02);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xF7);
    SSP0_Write(0x20);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xEA);
    SSP0_Write(0x00);
    SSP0_Write(0x00);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xC0);          // POWER_CONTROL_1
    SSP0_Write(0x26);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xC1);          // POWER_CONTROL_2
    SSP0_Write(0x11);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xC5);          // VCOM_CONTROL_1
    SSP0_Write(0x35);
    SSP0_Write(0x3E);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xC7);          // VCOM_CONTROL_2
    SSP0_Write(0xBE);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0x36);          // MEMORY_ACCESS_CONTROL
    SSP0_Write(0x48);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0x3A);          // COLMOD_PIXEL_FORMAT_SET
    SSP0_Write(0x55);        // 16 bit pixel
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xB1);          // Frame Rate
    SSP0_Write(0x00);
    SSP0_Write(0x1B);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xF2);          // Gamma Function Disable
    SSP0_Write(0x08);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0x26);
    SSP0_Write(0x01);        // gamma set for curve 01/2/04/08
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xE0);          // positive gamma correction
    SSP0_Write(0x1F);
    SSP0_Write(0x1A);
    SSP0_Write(0x18);
    SSP0_Write(0x0A);
    SSP0_Write(0x0F);
    SSP0_Write(0x06);
    SSP0_Write(0x45);
    SSP0_Write(0x87);
    SSP0_Write(0x32);
    SSP0_Write(0x0A);
    SSP0_Write(0x07);
    SSP0_Write(0x02);
    SSP0_Write(0x07);
    SSP0_Write(0x05);
    SSP0_Write(0x00);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xE1);          // negativ gamma correction
    SSP0_Write(0x00);
    SSP0_Write(0x25);
    SSP0_Write(0x27);
    SSP0_Write(0x05);
    SSP0_Write(0x10);
    SSP0_Write(0x09);
    SSP0_Write(0x3A);
    SSP0_Write(0x78);
    SSP0_Write(0x4D);
    SSP0_Write(0x05);
    SSP0_Write(0x18);
    SSP0_Write(0x0D);
    SSP0_Write(0x38);
    SSP0_Write(0x3A);
    SSP0_Write(0x1F);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_WindowMax();

    //LCD_Cmd(0x34);        // tearing effect off
    //LCD_CS(1);

    //LCD_Cmd(0x35);        // tearing effect on
    //LCD_CS(1);

    LCD_Cmd(0xB7);          // entry mode
    SSP0_Write(0x07);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0xB6);          // display function control
    SSP0_Write(0x0A);
    SSP0_Write(0x82);
    SSP0_Write(0x27);
    SSP0_Write(0x00);
    SSP0_WaitBusy();
    LCD_CS(1);

    LCD_Cmd(0x11);          // sleep out
    SSP0_WaitBusy();
    LCD_CS(1);

    // wait_ms(100);
    Delay(100);

    LCD_Cmd(0x29);          // display on
    SSP0_WaitBusy();
    LCD_CS(1);

    // wait_ms(100);
    Delay(100);


}