久久国产欧美日韩精品APP_九九成人区_久久久久久久久免费观看_中文人文一二三区_综合福利精品区_欧美日韩中成人精品_成人麻豆AV_亚洲欧洲无码精品合集_国产女生操到高潮_国产一区二区在线视频观看

新聞詳情

OLED顯示屏與8051單片機的接口設計2

日期:2025-11-03 23:13
瀏覽次數:2990
摘要:

OLED顯示屏與8051單片機的接口設計2
接上一篇文章

4,OLED顯示屏 HGS128641主要指令集




更詳細的指令集請聯系清達光電 索取 010-62000662   13701081790

5,OLED顯示屏 與8051單片機典型應用




6, OLED顯示屏 HGS128641 典型應用程序
 /******************************************************************
      延時子程序
*****************************************************************/
void uDelay(unsigned char l)
{
 while(l--);
}


void delay(unsigned char n)
{
unsigned char i,j,k;

 for(k=0;k<n;k++)
 {
 for(i=0;i<120;i++)
  {_nop_();}}
}
void delay100ms(unsigned char n)
{
unsigned char i,j,k;

 for(k=0;k<n;k++)
 {
 for(i=0;i<100;i++)
  {delay(1);}}
}
#ifdef I80
/*********************************************************************
   寫入指令和數據
************************************************************************/
void WriteCommand(unsigned char Data)
{
 DC=0;
 CS=0;
        xData=Data;
 WR=0;
        _nop_();
        _nop_();
 WR=1;
        _nop_();
        _nop_();
 CS=1;
 DC=1;
}
void WriteData(unsigned char Data)
{
 DC=1;
 CS=0;
        xData=Data;
 WR=0;
         _nop_();
        _nop_();
 WR=1;
         _nop_();
        _nop_();
 CS=1;
 DC=1;
}
#endif

/*****************************************************************
    OLED初始化
*****************************************************************/
 void oled_init()
{
        _nop_();
        RES=0;      //oled reset
        _nop_();  _nop_();
        RES=1;
        _nop_(); _nop_();
/**********************************************************
// OLED HGS128646 Initialization Command
********************************************************/
// Column Address
   WriteCommand(0x15);  /* Set Column Address */
   WriteCommand(0x00);    /* Start = 0 */
   WriteCommand(0x3F);    /* End = 127 */

// Row Address
   WriteCommand(0x75);  /* Set Row Address */
   WriteCommand(0x0c);    /* Start = 0 */
   WriteCommand(0x4b);    /* End = 63 */

// Contrast Control
   WriteCommand(0x81);  /* Set Contrast Control */
   WriteCommand(0x7f);    /* 0 ~ 127 */

// Current Range
  WriteCommand(0x86);  /* Set Current Range84h:Quarter, 85h:Half,86h:Full*/

// Re-map
   WriteCommand(0xA0);  /* Set Re-map */
   WriteCommand(0x52);    /* [0]:MX, [1]:Nibble, [2]:H/Vaddress [4]:MY, [6]:Com Split Odd/Even "1000010"*/

// Display Start Line
   WriteCommand(0xA1);  /* Set Display Start Line */
   WriteCommand(0x0c);    /* Top */

// Display Offset
   WriteCommand(0xA2);  /* Set Display Offset */
   WriteCommand(0x4c);    /* No offset */

// Display Mode
   WriteCommand(0xA4);  /* Set DisplaMode,A4:Normal,A5:All ON, A6: All OFF,A7:Inverse */

// Multiplex Ratio
   WriteCommand(0xA8);  /* Set Multiplex Ratio */
   WriteCommand(0x3F);    /* [6:0]16~128, 64 rows=3Fh*/

// Phase Length
   WriteCommand(0xB1);  /* Set Phase Length */
  // WriteCommand(0x22);    /* [3:0]:Phase 1 period of 1~16clocks */
 WriteCommand(0x02);        /* [7:4]:Phase 2 period of 1~16clocks /* POR = 0111 0100 */
// Row Period
   WriteCommand(0xB2);  /* Set Row Period */
   WriteCommand(0x46);    /* [7:0]:18~255,K=P1+P2+GS15 (POR:4+7+29)*/

// Display Clock Divide
   WriteCommand(0xB3);  /* Set Clock Divide */
   WriteCommand(0x41);    /* [3:0]:1~16, [7:4]:0~16 */
                              /* POR = 0000 0001 */
// VSL
   WriteCommand(0xBF);  /* Set VSL */
   WriteCommand(0x0D);    /* [3:0]:VSL */

// CCOMH
   WriteCommand(0xBE);  /* Set VCOMH */
   WriteCommand(0x00);    /* [7:0]:VCOMH */

// VP
   WriteCommand(0xBC);  /* Set VP */
   WriteCommand(0x0B);    /* [7:0]:VP */

// Gamma
   WriteCommand(0xB8);  /* Set Gamma with next 8 bytes*/
   WriteCommand(0x01);    /* L1[2:1] */
   WriteCommand(0x11);    /* L3[6:4], L2[2:0] 0001 0001*/
   WriteCommand(0x22);    /* L5[6:4], L4[2:0] 0010 0010*/
   WriteCommand(0x32);    /* L7[6:4], L6[2:0] 0011 1011*/
   WriteCommand(0x43);    /* L9[6:4], L8[2:0] 0100 0100*/
   WriteCommand(0x54);    /* LB[6:4], LA[2:0] 0101 0101*/
   WriteCommand(0x65);    /* LD[6:4], LC[2:0] 0110 0110*/
   WriteCommand(0x76);    /* LF[6:4], LE[2:0] 1000 0111*/

// Set DC-DC
   WriteCommand(0xAD);  /* Set DC-DC */
   WriteCommand(0x02);    /* 03=ON, 02=Off */
          all_screen(0x00);
// Display ON/OFF
   WriteCommand(0xAF);  /* AF=ON, AE=Sleep Mode */
}

激情日日艹| 人妻精品一区| 日韩av一区二区三区| 91成人视频在线免费观看| 99热精品免费| 国产自偷综合| 综合久久久| 久久久精品波多野结衣AV| a级无码毛片| 女日韩在线观看| 在线视频一区二区三区| 黄大片久久久| 999久久久| 91成人电影视频| 国产91在线拍揄自揄拍无码九色| 久久久精品国产| www.91馃崋| 91色淘宝蜜桃视频在线| 无码人妻精品一区二区三区夜夜嗨 | 91频99| 无码电影网站| 色婷婷99二区| 91啪国自产最新91啪国自产| 久久国产精品在线视频| 国产色图乱伦| 欧美熟妇伦| 日韩五码专区| 久久精品午夜| 黄色无码网站91| 国产精品码在线观看0000| 热久久久久久久久久av| 操逼好视频| 九色成人国产在线| 99久网站| v与子敌伦刺激对白播放| 九视频黄片| 国产 性 乱伦 AV| 欧美97| 日本精品不卡一区| 一区两区小视频| 是韩成人精品 |