Hint: this post is also available in English.

320160

这两片液晶其实是不同时间买的,不过都是最近才去点亮。其中较小的一块是带控制器的,10rmb/pcs,大的一块不带控制器,10rmb/pcs。

目测效果大的比小的好很多,因为对比度高了很多。大的那块屏幕应该可以算是我目前见过的最好的单色屏之一。

至于小的屏幕,使用的是uc1698u的主控,也就是cstn主控。因为cstn其实就是负性显示的stn加上彩色滤色片,而stn正负性显示只不过是偏振片方向的区别,所以cstn的控制器用来驱动单色的stn也是完全不成问题。不过还是有点蛋疼,就是一个横向坐标实际上代表的是3个像素点,cstn也不存在8色(也就是这里的单色)模式,所以每个像素点视色彩设置不同可能是4-6bit。RGB里面有565色彩模式,这里就变成了5bit 6bit 5bit,都是一样的黑色像素色深却不一样。于是就设定为RGB444,全屏16级灰度。

照片是这么拍的,然而其实桌子太乱,而且我本来应该在白天用自然光的……不过发也发了,不管它了咯

image

GY3216N1FRN6A

GY3216_A GY3216_B

基本信息

  • 型号:GY3216N1FRN6A
  • 类型:单色图形点阵
  • 模式:FSTN Positive
  • 分辨率:320*160
  • 灰度:-
  • 控制器:-
  • 尺寸:144.3*75.0(mm)

引脚定义

  1. FLM
  2. M
  3. LP
  4. XCK
  5. DISPOFF
  6. D0
  7. D1
  8. D2
  9. D3
  10. VDD
  11. GND
  12. VEE
  13. GND
  14. NC
  15. NC
  16. NC

驱动程序

void LCD_DispImg(unsigned char *d)
{
  unsigned char i,j;
  unsigned int p,q;
  unsigned char d1,d2,d3,d4;
  p = 0;
  q = 0;
  for (i=0;i<160;i++)
  {
    for (j=0;j<40;j++)
    {
      d1 = 0;
      d2 = 0;
      d3 = 0;
      d4 = 0;
      d1 = (d[q]&0x80)|((d[q]&0x08)<<3);
      d2 = ((d[q]&0x40)<<1)|((d[q]&0x04)<<4);
      d3 = ((d[q]&0x20)<<2)|((d[q]&0x02)<<5);
      d4 = ((d[q]&0x10)<<3)|((d[q]&0x01)<<6);
      q++;
      d1 |= ((d[q]&0x80)>>2)|((d[q]&0x08)<<1);
      d2 |= ((d[q]&0x40)>>1)|((d[q]&0x04)<<2);
      d3 |= ((d[q]&0x20))|((d[q]&0x02)<<3);
      d4 |= ((d[q]&0x10)<<1)|((d[q]&0x01)<<4);
      q++;
      d1 |= ((d[q]&0x80)>>4)|((d[q]&0x08)>>1);
      d2 |= ((d[q]&0x40)>>3)|((d[q]&0x04));
      d3 |= ((d[q]&0x20)>>2)|((d[q]&0x02)<<1);
      d4 |= ((d[q]&0x10)>>1)|((d[q]&0x01)<<2);
      q++;
      d1 |= ((d[q]&0x80)>>6)|((d[q]&0x08)>>3);
      d2 |= ((d[q]&0x40)>>5)|((d[q]&0x04)>>2);
      d3 |= ((d[q]&0x20)>>4)|((d[q]&0x02)>>1);
      d4 |= ((d[q]&0x10)>>3)|((d[q]&0x01));
      q++;
      LCD_FB_1[p] = d1;
      LCD_FB_2[p] = d2;
      LCD_FB_3[p] = d3;
      LCD_FB_4[p] = d4;
      p++;
    }
  }
}

void LCD_ReversePol()
{
  if ((GPIOD->IDR)&LCD_AC)
    LCD_AC_LOW();
  else
    LCD_AC_HIGH();
}

void LCD_RefreshI(unsigned char *fb)
{
  unsigned char i,j;
  
  LCD_FR_HIGH();
  for (i=0;i<160;i++)
  {
    for (j=0;j<40;j++)
    {
      LCD_XCK_HIGH();
      GPIOE->ODR=fb[i*40+j]>>4;
      LCD_XCK_LOW();
      LCD_XCK_HIGH();
      GPIOE->ODR=fb[i*40+j];
      LCD_XCK_LOW();
    }
    LCD_LP_HIGH();
    LCD_LP_LOW();
    LCD_FR_LOW();
  }
  for (i=0;i<4;i++)
  {
  
    for (j=0;j<40;j++)
    {
      LCD_XCK_HIGH();
      GPIOE->ODR=fb[159*40+j]>>4;
      LCD_XCK_LOW();
      LCD_XCK_HIGH();
      GPIOE->ODR=fb[159*40+j]>>4;
      LCD_XCK_LOW();
    }
    LCD_LP_HIGH();
    LCD_LP_LOW();
  }
  LCD_LP_HIGH();
  LCD_LP_LOW();
}

void LCD_Refresh()//7-4-2-1
{
  LCD_RefreshI(LCD_FB_1);//1
  LCD_RefreshI(LCD_FB_2);//1
  LCD_ReversePol();
  LCD_RefreshI(LCD_FB_1);//2
  LCD_RefreshI(LCD_FB_3);//1
  LCD_ReversePol();
  LCD_RefreshI(LCD_FB_1);//3
  LCD_RefreshI(LCD_FB_4);//1
  LCD_ReversePol();
  LCD_RefreshI(LCD_FB_1);//4
  LCD_RefreshI(LCD_FB_2);//2
  LCD_ReversePol();
  LCD_RefreshI(LCD_FB_1);//5
  LCD_RefreshI(LCD_FB_3);//2
  LCD_ReversePol();
  LCD_RefreshI(LCD_FB_1);//6
  LCD_RefreshI(LCD_FB_2);//3
  LCD_ReversePol();
}

S60715-1-V04-SA-090412

!(S60715)[https://www.zephray.me/api/media/1508802089276-s60715_a.jpg]

基本信息

  • 型号:S60715-1-V04-SA-090412
  • 类型:单色图形点阵
  • 模式:FSTN Positive
  • 分辨率:320*160
  • 灰度:最大64级
  • 控制器:uc1698u
  • 尺寸:99.0*72.6(mm)

引脚定义

  1. NC
  2. D7
  3. D6
  4. D5
  5. D4
  6. D3
  7. D2
  8. D1
  9. D0
  10. RD
  11. CS
  12. RST
  13. DC
  14. WR
  15. NC
  16. NC
  17. GND
  18. VCC
  19. VCAP1P
  20. VCAP2P
  21. VCAP2N
  22. VCAP1N
  23. VCAP3P
  24. VCAP3N
  25. VOUT
  26. NC

驱动程序

void LCD_Init()
{
  LCD_GPIO_Config();
  LCD_RST_LOW();
  Delayms(50);
  LCD_RST_HIGH();
  Delayms(300);

  LCD_WriteCmd(0xe2);//system reset
  Delayms(50);   
  LCD_WriteCmd(0x25);
  LCD_WriteCmd(0x2b);
  Delayms(20);
  LCD_WriteCmd(0xc4);
  LCD_WriteCmd(0xa1);
  LCD_WriteCmd(0xd1);
  LCD_WriteCmd(0xd5);
  LCD_WriteCmd(0xc8);
  LCD_WriteCmd(0x00);
  LCD_WriteCmd(0xeb);
  LCD_WriteCmd(0xa6);
  LCD_WriteCmd(0xa4);
  LCD_WriteCmd(0x81);
  LCD_WriteCmd(0x50);//80
  LCD_WriteCmd(0xd8);
  LCD_WriteCmd(0xaf);
  Delayms(50);
}

void LCD_SetXY(unsigned char x,unsigned char y)  //x<128(per 3Dot) , y<160
{
  x += 0x0b;      //此屏第一列有11字节偏移.
  //LCD_WriteCmd( 0xf9 );      //关闭窗口模式
  
  LCD_WriteCmd( 0x00 | (x&0x0f) );
  LCD_WriteCmd( 0x10 | (x>>4) );

  LCD_WriteCmd( 0x60 | (y&0x0f) );
  LCD_WriteCmd( 0x70 | (y>>4) );
}

void LCD_SetWindow(u8 wL,u8 wU,u8 wR,u8 wD)
{
  LCD_WriteCmd(0xf8);    //窗口操作使能.
  
  LCD_WriteCmd(0xf4);    //窗口左边界.
  LCD_WriteCmd(wL);    //0bh=11,地址 11~ 116 控制一列318个点.

  LCD_WriteCmd(0xf5);    //窗口上边界.
  LCD_WriteCmd(wU);    //0
 
  LCD_WriteCmd(0xf6);    //窗口右边界.
  LCD_WriteCmd(wR);    //75h=117

  LCD_WriteCmd(0xf7);    //窗口下边界.
  LCD_WriteCmd(wD);    //9fh=159

  LCD_SetXY(0,0) ;
}

void LCD_DispImg(unsigned char *d)
{
  unsigned i,j,p;

  p = 0;
  LCD_SetWindow(0x0b,0x00,0x75,0x9f);
  for (i=0;i<160;i++)
  {
    LCD_SetXY(0,i);
    LCD_WriteDat(0x00);//2 empty pixel
    for (j=0;j<160;j++)
      LCD_WriteDat(d[p++]);
  }
}