📄 d12-colour 128160.c
字号:
write_data1(0x3b); write_data1(0x3d); write_data1(0x40); write_data1(0x43); write_data1(0x45); //45 write_data1(0x48); write_data1(0x4b); write_data1(0x4e); write_data1(0x51); write_data1(0x53); //50 write_data1(0x56); write_data1(0x59); write_data1(0x5c); write_data1(0x60); write_data1(0x63); //55 write_data1(0x66); write_data1(0x69); write_data1(0x6c); write_data1(0x70); write_data1(0x73); //60 write_data1(0x76); write_data1(0x79); write_data1(0x7c); write_data1(0x7f); //64// write_command(0x08); //command explain at page 17// write_data1(0x00); //star address of X in the rectangle windows// write_command(0x09); //command explain at page 17// write_data1(0x9f); //end address of X in the rectangle windows// write_command(0x0a); //command explain at page 17// write_data1(0x00); //star address of Y in the rectangle windows// write_command(0x0b); //command explain at page 18// write_data1(0x7f); //end address of Y in the rectangle windows// write_command(0x0c); //command explain at page xx// write_data1(0x);// write_command(0x0d); //command explain at page 18// write_data1(0x00); //clock configuration PCLK = 1/2*MCLK// write_command(0x0e); //command explain at page xx// write_data1(0x);// write_command(0x0f); //command explain at page xx// write_data1(0x);// write_command(0x10); //command explain at page 19// write_data1(0x04); //screen save mode time 000:480 frame,current endure time 100:300 frame// write_command(0x11); //command explain at page 20// write_data1(0x95); //screen save time2// write_command(0x12); //command explain at page 20// write_data1(0x95); //screen save time3// write_command(0x13); //command explain at page 21// write_data1(0x95); ////screen save time4// write_command(0x14); //command explain at page 22// write_data1(0x00); //screen save pattern mode: off// write_command(0x15); //command explain at page 22// write_data1(0x00);// write_command(0x16); //command explain at page 23// write_data1(0x);// write_command(0x17); //command explain at page 24// write_data1(0x);// write_command(0x18); //command explain at page 24// write_data1(0x);// write_command(0x19); //command explain at page 25// write_data1(0x);// write_command(0x1a); //command explain at page 25// write_data1(0x);// write_command(0x1b); //command explain at page 26// write_data1(0x);// write_command(0x1c); //command explain at page 26// write_data1(0x);// write_command(0x1d); //command explain at page 26// write_data1(0x);// write_command(0x1e); //command explain at page 26// write_data1(0x);// write_command(0x1f); //command explain at page 26// write_data1(0x);// write_command(0x28); //command explain at page 29// write_data1(0x);// write_command(0x00); //all register reset over,display on// write_data1(0x80); // write_command(0x56); //bp2 bias current set,comand explan at page 33// write_data1(0x);// write_command(0xa1); //GPO set,comand explan at page 35// write_data1(0x00); //GPO=0,// write_command(0xa2); //test mode,comand explan at page 35// write_data1(0x00); //off 测试用// write_command(0xa3); //// write_data1(0x);// write_command(0xa4);// write_data1(0x); // write_command(0xa5);// write_data1(0x);// delay(3000); }void oled_test(){ uchar i,j; write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(0xfF,0xFF); //WHITE SCREEN } delay(2000);//************************************************************************* write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(0xf8,0x00); //R } delay(2000);//************************************************************************* write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(0x0F,0xE0); //G } delay(2000);//************************************************************ write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(0x00,0x1F); //B } delay(2000);}void oled_test1(){ uchar i,j; write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(0x00,0x00); //SCREEN BLACK } delay(3000); write_command(0x06); //command explain at page 17 write_data1(53); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(53); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(106); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<54;j++) write_data(0xFF,0xFF); //WHITE SCREEN } delay(3000);//************************************************************************* write_command(0x06); //command explain at page 17 write_data1(53); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(53); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(106); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<54;j++) write_data(0xf8,0x00); //R } delay(3000);//************************************************************************* write_command(0x06); //command explain at page 17 write_data1(53); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(53); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(106); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<54;j++) write_data(0x0F,0xE0); //G } delay(3000);//************************************************************ write_command(0x06); //command explain at page 17 write_data1(53); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(53); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(106); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<54;j++) write_data(0x00,0x1F); //B } delay(3000);}void led_test(){ uchar i; for(i=0;i<6;i++) { F_led=!F_led; delay(1000); }}void oled_display_pic(){ uint i,j; write_command(0x06); //command explain at page 17 write_data1(0x00); //X address write_command(0x07); //command explain at page 17 write_data1(0x00); //Y address write_command(0x08); //command explain at page 17 write_data1(0x00); //star address of X in the rectangle windows write_command(0x09); //command explain at page 17 write_data1(0x9f); //end address of X in the rectangle windows write_command(0x0a); //command explain at page 17 write_data1(0x00); //star address of Y in the rectangle windows write_command(0x0b); //command explain at page 18 write_data1(0x7f); //end address of Y in the rectangle windows write_command(0x05); //command explain at page 15 for(i=0;i<128;i++) { for(j=0;j<160;j++) write_data(olypic[(i<<8)+(i<<6)+(j<<1)+1],olypic[(i<<8)+(i<<6)+(j<<1)]); //olypic } delay(50000);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -