欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4597|回復: 0
打印 上一主題 下一主題
收起左側

nokia5110 51單片機 控制 程序

[復制鏈接]
跳轉到指定樓層
樓主

51單片機控制Nokia5110uv4工程

部分源碼預覽:
  1. #include "lcd.h"  
  2. #include "font.h"  
  3.   
  4. /*--------------------------------------------------------------*/  
  5. //寫入一個字節(數據或指令)  
  6. //wByte:    待寫入的數據  
  7. //datOrCmd: 1-數據, 0-指令  
  8. void writeByte(unsigned char wByte, unsigned char datOrCmd)  
  9. {  
  10.     unsigned char i;  
  11.     CS = 0;         //使能  
  12.     DC = datOrCmd;  //1-數據  //0-指令  
  13.     for(i = 8; i; i--)  //8位數據, 先高后低  
  14.     {  
  15.         if(wByte & 0x80) {  
  16.             DIN = 1;  
  17.         }  
  18.         else             {  
  19.             DIN = 0;  
  20.         }  
  21.         CLK = 0;  
  22.         wByte <<= 1;  //移位(延時)  
  23.         CLK = 1;    //上升沿寫入  
  24.     }  
  25.     CS = 1;         //禁止  
  26. }  
  27.   
  28. void clear()//清屏  
  29. {  
  30.     unsigned int i;  
  31.     writeCmd(0x80);  
  32.     writeCmd(0x40);  
  33.     for(i = 504; i; i--){  
  34.         writeDat(0x00);//將所有RAM寫0  
  35.     }  
  36. }  
  37.   
  38. //x: 0 - 83  
  39. //y: 0 - 5  
  40. void moveTo(unsigned char x, unsigned char y)//設置寫數據位置  
  41. {  
  42.     writeCmd(x|0x80);  
  43.     writeCmd(y|0x40);  
  44. }  
  45.   
  46. //x:0~9  
  47. //y:0~2  
  48. void writeChar(unsigned char x, unsigned char y, unsigned char c) //寫一個字符  
  49. {  
  50.     unsigned char i, j;  
  51.     c -= 32;  
  52.     x <<= 3;        
  53.     y <<= 1;        
  54.     for(j = 0; j < 2; j++)  
  55.     {  
  56.         moveTo(x, (y + j));  
  57.         for(i = 0; i < 8; i++)  
  58.             writeDat(font[c][8 * j + i]);  
  59.     }  
  60. }  
  61.   
  62. //x:0~9  
  63. //y:0~2  
  64. void writeString(unsigned char x, unsigned char y, unsigned char *str)//寫一個字符串  
  65. {  
  66.     while(*str && x < 10)  
  67.     {  
  68.         writeChar(x++, y, *str);  
  69.         str++;  
  70.     }  
  71. }  
  72.   
  73. void LCDInit(void)  
  74. {  
  75.     RST = 0;   
  76.     RST = 1;//硬件復位  
  77.          
  78.     writeCmd(0x21);     //工作模式, 水平尋址, 擴展指令  
  79.     writeCmd(0x07);     //VLCD溫度系數,設置0x04~0x07,越小越黑

  80.     writeCmd(0x13);     //設置偏置系統(BSx) 1:48,設置為0x10~0x17   
  81.     writeCmd(128+25);      //設置電壓VLCD = 3.06 + 0.06*Vop, 對比度調整,設置為0x80~0xff;128+(0~127)  
  82.   
  83.     writeCmd(0x20);     //工作模式, 水平尋址, 常規指令  
  84.     writeCmd(0x0c);     //普通模式  
  85.     writeCmd(0x80);     //起始頁地址0  
  86.     writeCmd(0x40);     //起始列地址0  
  87.     clear();                //清全屏  
  88. }  
復制代碼


nokia 5110.zip

30.54 KB, 下載次數: 42, 下載積分: 黑幣 -5

工程

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

無效樓層,該帖已經被刪除
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表