找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

帖子
查看: 10700|回復(fù): 10
打印 上一主題 下一主題
收起左側(cè)

PIC單片機(jī)+LCD12864顯示漢字程序

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:21069 發(fā)表于 2018-12-21 23:33 | 只看該作者 |只看大圖 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式


#include<pic.h>
#define RS RD2   
#define CS2 RD1   
#define CS1 RD0   
#define E RD4   
#define RW RD3   
#define BUSY RC7
const unsigned char tab2[]={
/*--  文字:  福  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x08,0x08,0x89,0xCE,0x28,0x18,0x02,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x02,0x00,
0x02,0x01,0x00,0xFF,0x01,0x02,0xFF,0x49,0x49,0x49,0x7F,0x49,0x49,0x49,0xFF,0x00,

/*--  文字:  建  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x42,0x62,0x5A,0xC6,0x10,0x54,0x54,0x54,0xFF,0x54,0x54,0x7C,0x10,0x10,0x00,
0x40,0x23,0x14,0x08,0x17,0x28,0x29,0x49,0x49,0x7F,0x49,0x49,0x49,0x49,0x40,0x00,

/*--  文字:  工  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,

/*--  文字:  程  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,
0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,

/*--  文字:  學(xué)  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,

/*--  文字:  院  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0xFE,0x02,0x32,0x4A,0x86,0x0C,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x0C,0x04,0x00,
0xFF,0x00,0x02,0x04,0x83,0x41,0x31,0x0F,0x01,0x01,0x7F,0x81,0x81,0x81,0xF1,0x00,

/*--  文字:  ,  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x58,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  環(huán)  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x22,0x22,0xFE,0x22,0x22,0x00,0x02,0xC2,0x32,0xFE,0x42,0x82,0x02,0x02,0x00,
0x00,0x04,0x04,0x03,0x12,0x0A,0x04,0x03,0x00,0x00,0xFF,0x00,0x00,0x03,0x0E,0x00,

/*--  文字:  境  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x20,0x20,0xFE,0x20,0x20,0x00,0x24,0xAC,0xB4,0xA5,0xA6,0xB4,0xAC,0x24,0x00,0x00,
0x10,0x30,0x1F,0x08,0x08,0x00,0x80,0x4F,0x3A,0x0A,0x0A,0x7A,0x8F,0x80,0xE0,0x00,

/*--  文字:  優(yōu)  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x40,0x20,0xF8,0x17,0x02,0x10,0x10,0xF0,0x1F,0xF0,0x12,0x1C,0x14,0x10,0x00,0x00,
0x00,0x00,0xFF,0x00,0x40,0x20,0x18,0x07,0x00,0x3F,0x40,0x40,0x40,0x78,0x20,0x00,

/*--  文字:  美  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x84,0x84,0x94,0x95,0x96,0x94,0xFC,0x94,0x96,0x95,0x94,0x94,0x84,0x80,0x00,
0x80,0x80,0x44,0x44,0x24,0x14,0x0C,0x07,0x0C,0x14,0x24,0x64,0xC4,0x44,0x00,0x00,

/*--  文字:  ,  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x58,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  歷  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0xFE,0x02,0x22,0x22,0x22,0x22,0xFA,0x22,0x22,0x22,0xE2,0x02,0x02,0x00,
0x40,0x30,0x0F,0x00,0x40,0x20,0x18,0x06,0x01,0x00,0x20,0x60,0x3F,0x00,0x00,0x00,

/*--  文字:  史  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00,
0x80,0x80,0x41,0x40,0x22,0x14,0x08,0x17,0x20,0x20,0x20,0x40,0x41,0xC0,0x40,0x00,

/*--  文字:  悠  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x20,0x10,0xFC,0x03,0xF8,0x20,0x10,0x0C,0x17,0xA4,0x44,0xB4,0x0C,0x04,0x04,0x00,
0x40,0x70,0x03,0x00,0x38,0x40,0x40,0x45,0x59,0x40,0x40,0x70,0x01,0x13,0x61,0x00,

/*--  文字:  久  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x80,0x40,0x30,0x0C,0x0B,0x08,0xC8,0xBC,0x08,0x00,0x00,0x00,0x00,0x00,
0x40,0x41,0x20,0x20,0x10,0x08,0x04,0x03,0x00,0x01,0x06,0x18,0x30,0x60,0x20,0x00,

/*--  文字:  。  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  歡  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00,

/*--  文字:  迎  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00,

/*--  文字:  你  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00,
0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00,

/*--  文字:  的  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0xF8,0x8C,0x8B,0x88,0xF8,0x40,0x30,0x8F,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,
0x00,0x7F,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x03,0x26,0x40,0x20,0x1F,0x00,0x00,

/*--  文字:  到  --*/
0x00,0x22,0x72,0x2A,0x26,0xE2,0x2A,0x72,0x22,0x00,0xF8,0x00,0x00,0xFF,0x00,0x00,
0x00,0x42,0xC2,0x42,0x22,0x3F,0x22,0x12,0x12,0x00,0x0F,0x40,0x80,0x7F,0x00,0x00,

/*--  文字:  來  --*/
0x00,0x80,0x84,0x84,0x94,0xA4,0xC4,0xFF,0x84,0xC4,0xB4,0x94,0x84,0x84,0x80,0x00,
0x20,0x20,0x10,0x10,0x08,0x04,0x02,0xFF,0x01,0x02,0x04,0x08,0x18,0x30,0x10,0x00,
/*--  文字:  !  --*/
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  電  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,

/*--  文字:  子  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xE2,0x12,0x0A,0x06,0x02,0x00,0x80,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,

/*--  文字:  信  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x80,0x40,0x30,0xFC,0x07,0x0A,0xA8,0xA8,0xA9,0xAE,0xAA,0xA8,0xA8,0x08,0x08,0x00,
0x00,0x00,0x00,0x7F,0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0x00,

/*--  文字:  息  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0xFC,0x54,0x54,0x56,0x55,0x54,0x54,0x54,0xFC,0x00,0x00,0x00,0x00,
0x00,0x20,0x38,0x01,0x3D,0x41,0x41,0x45,0x59,0x41,0x41,0x71,0x00,0x08,0x30,0x00,

/*--  文字:  工  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,

/*--  文字:  程  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,
0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,

/*--  文字:  !  --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*--  文字:     --*/
/*--  宋體12;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
               
//寫指令代碼(左)
void l_w_code(char l_code)
{
        //check_busy();
        PORTD=0x12;                        
        PORTC=l_code;
        E=1;
        E=0;
        asm("nop");
}
        
//寫顯示數(shù)據(jù)(左)        
void l_w_data(char l_data)
{
        //check_busy();
        PORTD=0x16;                                
        PORTC=l_data;
        E=1;
        E=0;
        asm("nop");
}
//寫指令代碼(右)
void r_w_code(char        r_code)
{
        //check_busy();
        PORTD=0x11;                                
        PORTC=r_code;
        E=1;
        E=0;
        //asm("nop");
}
        
//寫顯示數(shù)據(jù)(右)        
void r_w_data(char r_data)
{
        //check_busy();
        PORTD=0x15;                                       
        PORTC=r_data;
        E=1;
        E=0;
        asm("nop");
}        
void initializeLCD(void)
{
        l_w_code(0x3f);
        l_w_code(0xc0);               
        l_w_code(0xb8);               
        l_w_code(0x40);        
        r_w_code(0x3f);        
        r_w_code(0xc0);        
        r_w_code(0xb8);        
        r_w_code(0x80);        
}

void l_display(void)
{
        unsigned char m,n;
    unsigned char i;
    unsigned char x=0xb8;
    unsigned char y=0x40;
        unsigned int k=0;
        //k=0;
    l_w_code(x);                        //寫入頁(yè)地址
    l_w_code(y);                        //第一列開始
for(i=0;i<4;i++)
{

        for(y=0x40;y<0x80;y+=0x10)
        {
          for (m=0;m<2;m++)
          {
             l_w_code(x);                        //寫入頁(yè)地址
             l_w_code(y);                        //第一列開始
             for(n=0;n<16;n++)
             {
                          l_w_data(tab2[k++]);
             }
              x+=0x01;
          }
          x=x-0x02;
     }

     for(y=0x40;y<0x80;y+=0x10)
         {
          for (m=0;m<2;m++)
          {
            r_w_code(x);                        //寫入頁(yè)地址
            r_w_code(y);                        //第一列開始
            for(n=0;n<16;n++)
            {
                         r_w_data(tab2[k++]);
            }
             x+=0X01;
          }  
         x-=0x02;
     }
   x+=0x02;
}
}
void delaycnt(unsigned int cnt)
{
        while(--cnt);
}
void main(void)
{
        //port_init();
        TRISC=0X00;
        TRISD=0X00;
        initializeLCD();
        while(1)
        {
                l_display();
            delaycnt(65535);

        }
}
        
        
PIC顯示漢字.rar (3.84 KB, 下載次數(shù): 102)

               
               
               
               



評(píng)分

參與人數(shù) 8黑幣 +128 收起 理由
yoxi + 15 很給力!
鉆牛尖滴劉尖尖 + 10
areyouok + 10 很給力!
shuisheng + 15
Trump1438 + 10 贊一個(gè)!
#include51.h + 8 贊一個(gè)!
Sawardeakar + 10 很給力!
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

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

使用道具 舉報(bào)

沙發(fā)
ID:472242 發(fā)表于 2019-2-3 21:13 | 只看該作者
做的很漂亮,收下了

評(píng)分

參與人數(shù) 5黑幣 +107 收起 理由
站著說話不腰疼 + 12
Trump1438 + 15
shuisheng + 35
刀刀見紅 + 35
areyouok + 10

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

板凳
ID:472325 發(fā)表于 2019-2-7 00:04 | 只看該作者
好樣的,這就是所要的

評(píng)分

參與人數(shù) 2黑幣 +27 收起 理由
找人PK + 12
#include51.h + 15

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

地板
ID:472268 發(fā)表于 2019-2-7 00:32 | 只看該作者
真的不錯(cuò)!值得學(xué)習(xí)了

評(píng)分

參與人數(shù) 2黑幣 +60 收起 理由
就你**** + 25
Sawardeakar + 35

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

5#
ID:471066 發(fā)表于 2019-2-7 15:09 | 只看該作者
這就是很好的!

評(píng)分

參與人數(shù) 2黑幣 +47 收起 理由
站著說話不腰疼 + 12
刀刀見紅 + 35

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

6#
ID:474670 發(fā)表于 2019-2-9 14:00 | 只看該作者
非常好的東東
回復(fù)

使用道具 舉報(bào)

7#
ID:509052 發(fā)表于 2019-4-10 19:28 | 只看該作者
您的原理圖是什么軟件畫的?
回復(fù)

使用道具 舉報(bào)

8#
ID:556500 發(fā)表于 2019-6-6 15:10 | 只看該作者
您的原理圖是什么軟件畫的?
回復(fù)

使用道具 舉報(bào)

9#
ID:615610 發(fā)表于 2020-4-1 21:30 | 只看該作者
做的漂亮
回復(fù)

使用道具 舉報(bào)

10#
ID:729144 發(fā)表于 2020-4-14 17:32 | 只看該作者
支持,PIC單片機(jī)的資料不太多。
回復(fù)

使用道具 舉報(bào)

11#
ID:964960 發(fā)表于 2021-9-8 20:09 | 只看該作者
Yunuis 發(fā)表于 2019-6-6 15:10
您的原理圖是什么軟件畫的?

PROTEUS軟件
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表