⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p1s_initial.c

📁 LGDP4216源代码(260K, 16bits or 18bits interface)1.77 inch(260k color)_LGDP4216 带驱动电路及驱动程序
💻 C
📖 第 1 页 / 共 2 页
字号:
//==============================================================//
//                   P1M128 (LGDP4216) Initial                  //
//==============================================================//
void SetCommand_P1S(unsigned int Command) {                     // Command
                                                                //
   WREG3=Command; // PORTD                                      // 
   WREG5=Command; // PORTB                                      //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("SWAP W5");                                             //
   RS =0; delay(3);                                             // 
   CSB=0; delay(3);                                             //  
   WRB=0; delay(3);                                             // 
   PORTD=WREG3;  delay(3);                                      //  
   PORTB=WREG5;  delay(3);                                      //  
   WRB=1; delay(3);                                             // 
   CSB=1; delay(3);                                             // 
   RS =1; delay(3);                                             // 
   }                                                            //
//--------------------------------------------------------------//
void Data_Write_P1S(unsigned int parament_data) {               // Parameter
                                                                //
   WREG3=parament_data; // PORTD                                // 
   WREG5=parament_data; // PORTB                                //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("RLNC W3,W4");                                          //
   asm ("RLNC W4,W3");                                          //
   asm ("SWAP W5");                                             //
   RS =1; delay(3);                                             // 
   CSB=0; delay(3);                                             //  
   WRB=0; delay(3);                                             // 
   PORTD=WREG3;  delay(3);                                      //  
   PORTB=WREG5;  delay(3);                                      //  
   WRB=1; delay(3);                                             // 
   CSB=1; delay(3);                                             // 
   RS =1; delay(3);                                             // 
   }                                                            //
//--------------------------------------------------------------//
//--------------------------------------------------------------//
void Data_Write18bit_P1S(unsigned int Red_data,unsigned int GB_data) {
                                                                //
   RS =1; delay(3);                                             // 
   CSB=0; delay(3);                                             // 
   WRB=0; delay(3);                                             // 
   PORTD=GB_data; delay(3);                                     //  
   PORTB=Red_data;delay(3);                                     //  
   WRB=1; delay(3);                                             // 
   CSB=1; delay(3);                                             // 
   RS =1; delay(3);                                             // 
   }                                                            //
//--------------------------------------------------------------//
void P1S_RESET(){                                               //
                                                                //
   RSTB=1;                                                      //
   delay(3);                                                    //
   RSTB=0;                                                      //     
   delay(3);                                                    //
   RSTB=1;                                                      //
   }                                                            //
//--------------------------------------------------------------//
void MODE_1() {                                                 // 140nit (P270)
                                                                //
   SetCommand_P1S(Scan_CONTROL);                                // 0x61
   Data_Write_P1S(0x0000);                                      //
   SetCommand_P1S(Scan_Volatage);                               // 0x60
   Data_Write_P1S(0x0000);                                      //
   SetCommand_P1S(LUT_BYPASS);                                  // 0x43
   Data_Write_P1S(0x0000);                                      //
   SetCommand_P1S(DISPLAY3);                                    // 0x02
   Data_Write_P1S(0x0300);                                      //
   SetCommand_P1S(Panel_Type);                                  // 0x03
   Data_Write_P1S(0x0100);                                      //
   SetCommand_P1S(BP_MODE);                                     // 0x27
   Data_Write_P1S(0x0100);                                      //
   SetCommand_P1S(Discharge_R);                                 // 0x20
   Data_Write_P1S(0x0200);                                      //   
   SetCommand_P1S(Discharge_G);                                 // 0x21
   Data_Write_P1S(0x0200);                                      //   
   SetCommand_P1S(Discharge_B);                                 // 0x22
   Data_Write_P1S(0x0200);                                      //   
   SetCommand_P1S(R_Peak_TIME);                                 // 0x23
   Data_Write_P1S(0x0300);                                      //   
   SetCommand_P1S(G_Peak_TIME);                                 // 0x24
   Data_Write_P1S(0x0300);                                      //   
   SetCommand_P1S(B_Peak_TIME);                                 // 0x25
   Data_Write_P1S(0x0300);                                      //   
   SetCommand_P1S(Dotcurrent_R);                                // 0x50
   Data_Write_P1S(0x6C00);                                      //   
   SetCommand_P1S(Dotcurrent_G);                                // 0x51
   Data_Write_P1S(0x2F00);                                      //   
   SetCommand_P1S(Dotcurrent_B);                                // 0x52
   Data_Write_P1S(0x3700);                                      //
   SetCommand_P1S(Peak_current_R);                              // 0x53
   Data_Write_P1S(0x0300);                                      //
   SetCommand_P1S(Peak_current_G);                              // 0x54
   Data_Write_P1S(0x0300);                                      //
   SetCommand_P1S(Peak_current_B);                              // 0x55
   Data_Write_P1S(0x0300);                                      //
   SetCommand_P1S(SCAN_TIME);                                   // 0x26
   Data_Write_P1S(0x0600);                                      //   
   SetCommand_P1S(Gray_Level);                                  // 0x5A
   Data_Write_P1S(0x0100);                                      //   
   SetCommand_P1S(DISPLAY1);                                    // 0x00 
   Data_Write_P1S(0x8000);                                      //
   SetCommand_P1S(DISPLAY2);                                    // 0x01 
   Data_Write_P1S(0x1000);                                      //
   SetCommand_P1S(AD_X);                                        // 0x06 
   Data_Write_P1S(0x9F00);                                      //
   SetCommand_P1S(AD_Y);                                        // 0x06 
   Data_Write_P1S(0x0000);                                      //
   SetCommand_P1S(GPO);                                         // 0xA1 
   Data_Write_P1S(0x0300);                                      //
//..............................................................//
   SetCommand_P1S(LUT_R);                                       // 0x40 
   Data_Write_P1S(0x0000);                                      // 1
   Data_Write_P1S(0x0000);                                      //
   Data_Write_P1S(0x0100);                                      //
   Data_Write_P1S(0x0100);                                      //
   Data_Write_P1S(0x0200);                                      // 5
                                                                //
   Data_Write_P1S(0x0200);                                      //
   Data_Write_P1S(0x0300);                                      //
   Data_Write_P1S(0x0300);                                      //
   Data_Write_P1S(0x0400);                                      //
   Data_Write_P1S(0x0500);                                      //10
                                                                //
   Data_Write_P1S(0x0600);                                      //
   Data_Write_P1S(0x0700);                                      //
   Data_Write_P1S(0x0800);                                      //
   Data_Write_P1S(0x0A00);                                      //
   Data_Write_P1S(0x0B00);                                      //15
                                                                //
   Data_Write_P1S(0x0D00);                                      //
   Data_Write_P1S(0x0E00);                                      //
   Data_Write_P1S(0x1000);                                      //
   Data_Write_P1S(0x1100);                                      //
   Data_Write_P1S(0x1300);                                      //20
                                                                //
   Data_Write_P1S(0x1500);                                      //
   Data_Write_P1S(0x1700);                                      //
   Data_Write_P1S(0x1900);                                      //
   Data_Write_P1S(0x1A00);                                      //
   Data_Write_P1S(0x1C00);                                      //25
                                                                //
   Data_Write_P1S(0x1E00);                                      //
   Data_Write_P1S(0x2000);                                      //
   Data_Write_P1S(0x2200);                                      //
   Data_Write_P1S(0x2400);                                      //
   Data_Write_P1S(0x2600);                                      //30
                                                                //
   Data_Write_P1S(0x2800);                                      //
   Data_Write_P1S(0x2A00);                                      //
   Data_Write_P1S(0x2C00);                                      //
   Data_Write_P1S(0x2F00);                                      //
   Data_Write_P1S(0x3100);                                      //35
                                                                //
   Data_Write_P1S(0x3300);                                      //
   Data_Write_P1S(0x3500);                                      //
   Data_Write_P1S(0x3800);                                      //
   Data_Write_P1S(0x3A00);                                      //
   Data_Write_P1S(0x3C00);                                      //40
                                                                //
   Data_Write_P1S(0x3F00);                                      //
   Data_Write_P1S(0x4200);                                      //
   Data_Write_P1S(0x4400);                                      //
   Data_Write_P1S(0x4600);                                      //
   Data_Write_P1S(0x4A00);                                      //45
                                                                //
   Data_Write_P1S(0x4C00);                                      //
   Data_Write_P1S(0x4F00);                                      //
   Data_Write_P1S(0x5100);                                      //
   Data_Write_P1S(0x5400);                                      //
   Data_Write_P1S(0x5600);                                      //50
                                                                //
   Data_Write_P1S(0x5900);                                      //
   Data_Write_P1S(0x5D00);                                      //
   Data_Write_P1S(0x5F00);                                      //

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -