Nokia5110驅動程序,篇幅限制,只截取了一段,全部資料在壓縮包
0.png (33.6 KB, 下載次數: 32)
下載附件
2019-7-23 03:28 上傳
- #include <AT89X52.H>
- #include "LCD5510_V3.H"
- #include "IMG_code.c"
- unsigned char code *str1 = {"Nokia 5510 Test, Haha^_^ I am so glad to see you agian! Do you think so?"};
- unsigned char code *str2 = {"I Love You AVR"};
- /*--------------------------------------------------------------*/
- //延時50000+0us 函數定義
- void delay50ms(void)
- {
- unsigned char i,j,k;
- for(i=167;i>0;i--)
- for(j=60;j>0;j--)
- for(k=1;k>0;k--);
- }
- //延時200000+0us 函數定義
- void delay200ms(void)
- {
- unsigned char i,j,k;
- for(i=201;i>0;i--)
- for(j=32;j>0;j--)
- for(k=14;k>0;k--);
- }
- //延時1000000+1us 函數定義
- void delay1s(void)
- {
- unsigned char i,j,k;
- for(i=167;i>0;i--)
- for(j=171;j>0;j--)
- for(k=16;k>0;k--);
- }
- /*--------------------------------------------------------------*/
- //主函數
- void main(void)
- {
- unsigned int i, j, k;
- unsigned char LCD_contrast = 0xc8; //此值對比度合適
- unsigned char *ptr;
- LCD5510_Init();
- ptr = str1;
- i = 0;
- while(i++ < 641-84)
- {
- LCD_prints(0, 5, ptr++);
- LCD_roll_picture(0, 0, 40, &img1[i*5]);// 40/8 = 5
- if(!(i%72)) ptr -= 72;
- LCD_clr_row(5);
- }
- i = 0;
- while(*str1)
- {
- LCD_prints(0, 0, str1++);
- delay200ms(); i++;
- LCD_clr_row(0);
- }
- str1 -= i;
- LCD_printsl(0, 0, str1);
- delay1s();
-
- LCD_clr_scr(); //清屏
- delay1s();
- LCD_picture(pic);
- delay1s(); delay1s();
-
- LCD_clr_scr(); //清屏
- delay1s();
- LCD_pos_picture(0, 0, 72, 14, pic1);
- delay1s();
- LCD_pos_picture(0, 2, 72, 28, pic2);
- delay1s(); delay1s();
- LCD_clr_scr(); //清屏
- LCD_showsh(0, 0, "我心★永恒");
- delay1s();
- LCD_showsh(0, 1, "永恒★我心");
- delay1s();
- LCD_showsh(0, 2, "永恒之心★");
- delay1s(); delay1s();
-
-
-
- LCD_clr_scr(); //清屏
- for(i = 0; i < 14; i++) {LCD_printc(i, 2, str2[i]); delay200ms();}
- LCD_printn(2, 3, 13140, 5);
- delay1s();
- LCD_prints(0, 4, ">--(*^_^*)--<");
- delay1s();
- LCD_prints(0, 0, "Blank Test ");
- delay1s();
- LCD_show_blank; //空白測試
- delay1s();
- LCD_prints(0, 0, "Normal Test");
- LCD_show_normal; //恢復正常
- delay1s();
- LCD_prints(0, 0, "Black Test ");
- delay1s();
- LCD_show_black; //全黑檢測壞點
- delay1s();
- LCD_show_normal; //恢復正常
- delay1s();
- LCD_prints(0, 0, "Inverse Test");
- LCD_show_inverse; //反色
- delay1s();
- LCD_prints(0, 0, "Normal again");
- LCD_show_normal; //恢復正常
- delay1s();
- LCD_clr_scr(); //清屏
- delay1s();
-
-
- i = 0; j = 0; k =0;
- LCD_prints(0, 5, "ASCII Code:");
- while(k++ < 100) //ASCII字符測試
- {
- LCD_printc(i, j, k + 32);
- delay50ms();
- i++; if(i == 14) {i = 0; j++;}
- if(j == 5) j = 0;
- LCD_printn(11, 5, k + 32, 3);
- }
- delay1s();
-
-
- LCD_clr_scr(); //清屏
- LCD_prints(2, 0, "Nokia 5510");
- LCD_prints(2, 2, "Alexi2008");
- LCD_prints(0, 4, "LCD_Contrast:");
- while(1) //對比度軟件調節
- {
- for(i = 0; i < 10; i++)
- {
- LCD_contrast++;
- LCD_write_cmd(0x21);//工作模式, 水平尋址, 擴展指令
- LCD_write_cmd(LCD_contrast);
- LCD_write_cmd(0x20);//工作模式, 水平尋址, 常規指令
- LCD_printc(13, 4, 129);
- LCD_printn(5, 5, LCD_contrast, 3);
- delay200ms();
- }
- for(i = 0; i < 20; i++)
- {
- LCD_contrast--;
- LCD_write_cmd(0x21);//工作模式, 水平尋址, 擴展指令
- LCD_write_cmd(LCD_contrast);
- LCD_write_cmd(0x20);//工作模式, 水平尋址, 常規指令
- LCD_printc(13, 4, 130);
- LCD_printn(5, 5, LCD_contrast, 3);
- delay200ms();
- }
- for(i = 0; i < 10; i++)
- {
- LCD_contrast++;
- LCD_write_cmd(0x21);//工作模式, 水平尋址, 擴展指令
- LCD_write_cmd(LCD_contrast);
- LCD_write_cmd(0x20);//工作模式, 水平尋址, 常規指令
- LCD_printc(13, 4, 129);
- LCD_printn(5, 5, LCD_contrast, 3);
- delay200ms();
- }
- }
- }
復制代碼 全部資料51hei下載地址:
Nokia5110.7z
(2.79 MB, 下載次數: 30)
2019-7-23 03:27 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|