久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

無字庫12864(GDRAM)顯示圖像的源碼 單片機初學者分享

[復制鏈接]
跳轉到指定樓層
樓主
制作出來實物圖如下,使用的是無字庫的12864液晶屏:


單片機源碼:
  1. # include<reg52.h>
  2. # define uchar unsigned char
  3. # define uint unsigned int
  4. # define LCD_date P0
  5. sbit dula = P2^7;
  6. sbit wela = P2^6;
  7. sbit lcden = P3^4;
  8. sbit lcdrs = P3^5;
  9. sbit lcdwr = P3^6;
  10. sbit lcdpsb = P3^7;
  11. uchar *addr;
  12. uchar code GDcode[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  13.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  14.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  15.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  16.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  17.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  18.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  19.                                                 0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  20.                                                 0x00,0x00,0x07,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  21.                                                 0x00,0x00,0x3F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  22.                                                 0x00,0x00,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  23.                                                 0x00,0x01,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x7F,0x80,0x00,0x00,
  24.                                                 0x00,0x03,0xFF,0xFF,0xFE,0x00,0x00,0x01,0xFF,0xE0,0x00,0x01,0xFF,0xE0,0x00,0x00,
  25.                                                 0x00,0x07,0xFF,0xFF,0xFE,0x00,0x00,0x07,0xFF,0xF0,0x00,0x07,0xFF,0xF0,0x00,0x00,
  26.                                                 0x00,0x0F,0xF9,0xFD,0xFF,0x00,0x00,0x0F,0xFF,0xF8,0x00,0x0F,0xFF,0xF8,0x00,0x00,
  27.                                                 0x00,0x0F,0xF0,0xF0,0xFF,0x80,0x00,0x1F,0xFF,0xFC,0x00,0x1F,0xFF,0xFC,0x00,0x00,
  28.                                                 0x00,0x1F,0xF0,0x70,0x7F,0x80,0x00,0x3F,0xFF,0xFC,0x00,0x3F,0xFF,0xFC,0x00,0x00,
  29.                                                 0x00,0x1F,0xE1,0x70,0x7F,0x80,0x00,0x7F,0xFF,0xFE,0x00,0x7F,0xFF,0xFE,0x00,0x00,
  30.                                                 0x00,0x3F,0xE1,0x66,0x7F,0xC0,0x00,0xFF,0xFF,0xFE,0x00,0xFF,0xFF,0xFE,0x00,0x00,
  31.                                                 0x00,0x3F,0xE3,0xE0,0x7F,0xC0,0x01,0xFF,0xFF,0xFE,0x01,0xFF,0xFF,0xFE,0x00,0x00,
  32.                                                 0x00,0x3F,0xE0,0x60,0x7F,0xE0,0x01,0xFF,0xEF,0xFF,0x01,0xFF,0xEF,0xFF,0x00,0x00,
  33.                                                 0x00,0x7F,0xF0,0xF0,0x7F,0xC0,0x03,0xFF,0x87,0xFF,0x03,0xFF,0x87,0xFF,0x00,0x00,
  34.                                                 0x00,0x3F,0xF0,0xF8,0xFF,0xE0,0x03,0xFF,0x83,0xFF,0x83,0xFF,0x81,0xFF,0x80,0x00,
  35.                                                 0x00,0x7F,0xFF,0xFF,0xFF,0xE0,0x07,0xFF,0x01,0xFF,0x07,0xFF,0x01,0xFF,0x00,0x00,
  36.                                                 0x00,0x7F,0xFF,0xFF,0xFF,0xF0,0x07,0xFF,0x00,0xFF,0x87,0xFF,0x00,0xFF,0x80,0x00,
  37.                                                 0x00,0x7F,0xE0,0x00,0xBF,0xF0,0x0F,0xFE,0x00,0xFF,0x8F,0xFE,0x00,0xFF,0x80,0x00,
  38.                                                 0x00,0xFF,0x80,0x00,0x0F,0xF0,0x0F,0xFE,0x00,0xFF,0x8F,0xFE,0x00,0xFF,0x80,0x00,
  39.                                                 0x00,0xFE,0x00,0x00,0x07,0xF0,0x1F,0xFC,0x00,0x7F,0x9F,0xFC,0x00,0x7F,0x80,0x00,
  40.                                                 0x00,0xFF,0xB0,0x00,0x5F,0xF0,0x0F,0xFC,0x00,0xFF,0x8F,0xFC,0x00,0x7F,0x80,0x00,
  41.                                                 0x01,0xFF,0xF8,0x01,0xFF,0xF0,0x1F,0xF8,0x3D,0xFF,0x9F,0xFC,0x3D,0xFF,0x80,0x00,
  42.                                                 0x01,0xFF,0xFF,0xDF,0xFF,0xF8,0x0F,0xFC,0x37,0x0F,0x8F,0xFC,0x37,0x9F,0x80,0x00,
  43.                                                 0x07,0xFF,0xFF,0xFF,0xFF,0xF8,0x1F,0xF8,0x66,0x07,0x1F,0xF8,0x26,0x0F,0x80,0x00,
  44.                                                 0x07,0xFF,0xFF,0xFF,0xFF,0xFC,0x0F,0xFC,0x6C,0x63,0x8F,0xFC,0x66,0x63,0x80,0x00,
  45.                                                 0x1F,0xC7,0xFF,0xFF,0xFC,0xFE,0x0F,0xFE,0xEC,0x80,0x8F,0xFE,0xED,0x80,0x80,0x00,
  46.                                                 0x1F,0xC3,0xFF,0xFF,0xF0,0x7E,0x07,0xFF,0xFC,0x00,0x07,0xFF,0xFE,0x80,0x00,0x00,
  47.                                                 0x3F,0xC7,0xFF,0xFF,0x80,0x7F,0x07,0xFF,0xFE,0x00,0x07,0xFF,0xFE,0x00,0x00,0x00,
  48.                                                 0x3F,0xC3,0xFD,0xFA,0x00,0x3F,0x01,0xFF,0xFF,0x00,0x21,0xFF,0xFF,0x00,0x20,0x00,
  49.                                                 0x3F,0x87,0xF0,0x00,0x00,0x3F,0x00,0xFF,0xFF,0x00,0x40,0xFF,0xFF,0x00,0x40,0x00,
  50.                                                 0x7F,0x83,0xF8,0x00,0x00,0x3F,0x00,0x1F,0xFF,0x80,0x40,0x1F,0xFF,0xC0,0xC0,0x00,
  51.                                                 0x7F,0x87,0xF0,0x00,0x00,0x3F,0x00,0x00,0x00,0xC1,0x80,0x00,0x00,0xE3,0x80,0x00,
  52.                                                 0x7F,0xC3,0xF8,0x00,0x00,0x3F,0x80,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,
  53.                                                 0x7B,0x83,0xF0,0x00,0x00,0x3F,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x1C,0x00,0x00,
  54.                                                 0x79,0xC1,0xF0,0x00,0x00,0x27,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  55.                                                 0x21,0xC0,0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  56.                                                 0x00,0xE0,0x00,0x00,0x00,0x40,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
  57.                                                 0x00,0xE0,0x00,0x00,0x00,0xC0,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
  58.                                                 0x00,0x30,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  59.                                                 0x00,0x38,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  60.                                                 0x00,0x9C,0x00,0x00,0x06,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  61.                                                 0x01,0x07,0x00,0x00,0x0C,0x60,0x07,0xF8,0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x70,
  62.                                                 0x01,0x81,0xC0,0x00,0x38,0x10,0x03,0x30,0x00,0x00,0x00,0x03,0x60,0x00,0x00,0x30,
  63.                                                 0x01,0x00,0xF8,0x00,0xE0,0x10,0x03,0x30,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x30,
  64.                                                 0x01,0x00,0x03,0xAD,0x00,0x10,0x01,0xE1,0xE3,0xF7,0xF8,0x06,0x01,0xE1,0xE1,0xF0,
  65.                                                 0x00,0xA0,0x0B,0x0E,0xA2,0xA0,0x01,0xE3,0x31,0xC3,0x30,0x06,0x03,0x33,0x33,0x30,
  66.                                                 0x00,0x00,0x54,0x00,0x00,0x00,0x01,0xE3,0xF1,0x81,0xE0,0x06,0xF3,0x33,0x33,0x30,
  67.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xE3,0x01,0x81,0xE0,0x06,0x63,0x33,0x33,0x30,
  68.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC3,0x31,0x80,0xC0,0x03,0x63,0x33,0x33,0x30,
  69.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC1,0xE3,0xE0,0xC0,0x01,0xC1,0xE1,0xE1,0xF8,
  70.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,
  71.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,
  72.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  73.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  74.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  75.                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  76. void delay(uint z)
  77. {
  78.         uint x,y;
  79.         for (x = z; x > 0; --x)
  80.                 for (y = 110; y > 0; --y);
  81. }
  82. void write_cmd(uchar cmd)
  83. {
  84.         lcdrs = 0;
  85.         lcdwr = 0;
  86.         lcden = 0;
  87.         P0 = cmd;
  88.         delay(5);
  89.         lcden = 1;
  90.         delay(5);
  91.         lcden = 0;
  92. }
  93. void write_dat(uchar dat)
  94. {
  95.         lcdrs = 1;
  96.         lcdwr = 0;
  97.         lcden = 0;
  98.         P0 = dat;
  99.         delay(5);
  100.         lcden = 1;
  101.         delay(5);
  102.         lcden = 0;        
  103. }
  104. void GDlcd_init()
  105. {
  106.         lcdpsb = 1;
  107.         write_cmd(0x36);  //執行時間為72us所以才延時
  108.         delay(10);
  109.         write_cmd(0x01);//4.6ms   
  110.         delay(10);

  111. }
  112. /*void cle_init()
  113. {
  114.         uchar m,n;
  115.         write_cmd(0x34);
  116.         for (m = 0; m < 32; ++m)
  117.                 {
  118.                         write_cmd(0x80+m);
  119.                         write_cmd(0x80);
  120.                         for (n = 0; n < 16; ++n)
  121.                                 {
  122.                                         write_dat(0x00);
  123.                                 }
  124.                 }
  125. }          */
  126. void dispicture()
  127. {
  128.         uint i,j;
  129.         //上半屏顯示
  130.         for (i = 0; i < 32; ++i)
  131.                 {
  132.                         write_cmd(0x80+i);
  133.                         write_cmd(0x80);
  134.                         for (j = 0; j < 16; ++j)
  135.                                 {
  136.                                         write_dat(*addr++);
  137.                                 }
  138.                 }
  139.         //下半屏顯示
  140.         for (i = 0; i < 32; ++i)
  141.                 {
  142.                         write_cmd(0x80+i);
  143.                         write_cmd(0x88);
  144.                         for(j = 0; j < 16; ++j)
  145.                                 {
  146.                                         write_dat(*addr++);
  147.                                 }
  148.                 }
  149. }
  150. void main()
  151. {
  152.         dula = 0;
  153.         wela = 0;
  154.         delay(10);
  155.         GDlcd_init();
  156. //        cle_init();
  157.           addr = GDcode;
  158.         dispicture();
  159.         while(1);
  160. }
復制代碼


評分

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

查看全部評分

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

使用道具 舉報

沙發
ID:339506 發表于 2018-6-4 16:25 | 只看該作者
并行連接
回復

使用道具 舉報

板凳
ID:483687 發表于 2019-3-7 09:31 | 只看該作者
如果是帶字庫的也一樣嗎
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日韩在线免费视频 | 亚洲精品久久区二区三区蜜桃臀 | 久久人 | 亚洲欧美在线观看 | 国产欧美视频一区二区三区 | 国产不卡在线观看 | 欧美黑人体内she精在线观看 | 日韩区 | 国产成人精品一区二三区在线观看 | 国产精品久久7777777 | 特黄色一级毛片 | 日韩中文在线观看 | 欧美 日韩 国产 成人 | 成人在线免费观看 | 在线一区二区三区 | 欧美日韩一区不卡 | 日韩一区二区三区四区五区 | 欧美xxxx在线 | 欧美日韩久久久 | 色综合视频在线 | 美女天天干天天操 | 欧美色成人 | 久久综合九色综合欧美狠狠 | 亚洲二区视频 | 欧美国产精品久久久 | 国产精品久久网 | 久草电影网 | 日本激情一区二区 | 欧美一区二区三区的 | 午夜精品一区二区三区免费视频 | 久久亚洲欧美日韩精品专区 | 欧美一级精品片在线看 | 美女国内精品自产拍在线播放 | 久久久夜色精品亚洲 | 天天草天天干 | 精品视频一区二区三区在线观看 | 欧美最猛黑人xxxx黑人 | 中文字幕高清av | 欧美日韩国产一区二区三区 | 一二三四在线视频观看社区 | 久久999|