|
12864自定義動態(tài)字符顯示,喜歡的朋友帶走
1.jpg (162.71 KB, 下載次數(shù): 96)
下載附件
2017-5-15 17:07 上傳
2.jpg (153.06 KB, 下載次數(shù): 119)
下載附件
2017-5-15 17:07 上傳
電路原理圖如下:
單片機(jī)接口圖.png (860.29 KB, 下載次數(shù): 103)
下載附件
2017-5-15 14:02 上傳
單片機(jī)源程序如下:
- #include <reg51.h>
- #include <intrins.h>
- #define uchar unsigned char
- #define uint unsigned int
- /************* 12864LCD???? *************/
- #define LCD_data P0 //???
- sbit LCD_RS = P3^5; //???????
- sbit LCD_RW = P3^6; //???/???
- sbit LCD_EN = P3^4; //??????
- sbit LCD_PSB = P3^2; //?/?????
- sbit LCD_RST = P3^7; //??????
- #define NOP(); {_nop_();_nop_();_nop_();_nop_();};
- /*********************************************************/
- uchar code DIS1[] = {"TEL:13321227852"};
- uchar code DIS2[] = {"QQ:1137035271.."};
- uchar code DIS3[] = {"ayangkm.88ka.cn"};
- uchar code DIS4[] = {"ayang520"};
- /*********************************************************/
- /*******************************************************************/
- /* */
- /* ???? */
- /* */
- /*******************************************************************/
- void delay(int ms)
- {
- while(ms--)
- {
- uchar i;
- for(i=0;i<255;i++)
- {
- _nop_();
- _nop_();
- _nop_();
- _nop_();
- }
- }
- }
-
- /*******************************************************************/
- /* */
- /*??LCD??? */
- /*lcd_busy?1?,?,???lcd-busy?0?,?,???????? */
- /* */
- /*******************************************************************/
- bit lcd_busy()
- {
- bit result;
- LCD_RS = 0;
- LCD_RW = 1;
- LCD_EN = 1;
- NOP();
- result = (bit)(P0&0x80);
- LCD_EN = 0;
- return(result);
- }
- /*******************************************************************/
- /* */
- /*??????LCD */
- /*RS=L,RW=L,E=???,D0-D7=???? */
- /* */
- /*******************************************************************/
- void lcd_wcmd(uchar cmd)
- {
- while(lcd_busy());
- LCD_RS = 0;
- LCD_RW = 0;
- LCD_EN = 0;
- _nop_();
- _nop_();
- P0 = cmd;
- NOP();
- LCD_EN = 1;
- NOP();
- LCD_EN = 0;
- }
- /*******************************************************************/
- /* */
- /*??????LCD */
- /*RS=H,RW=L,E=???,D0-D7=??? */
- /* */
- /*******************************************************************/
- void lcd_wdat(uchar dat)
- {
- while(lcd_busy());
- LCD_RS = 1;
- LCD_RW = 0;
- LCD_EN = 0;
- P0 = dat;
- NOP();
- LCD_EN = 1;
- NOP();
- LCD_EN = 0;
- }
- /*******************************************************************/
- /* */
- /* LCD????? */
- /* */
- /*******************************************************************/
- void lcd_init()
- {
- LCD_PSB = 1; //????
-
- LCD_RST = 0; //????
- delay(5);
- LCD_RST = 1;
- delay(5);
-
- lcd_wcmd(0x34); //??????
- delay(7);
- lcd_wcmd(0x30); //??????
- delay(7);
- lcd_wcmd(0x0C); //???,???
- delay(7);
- lcd_wcmd(0x01); //??LCD?????
- delay(7);
- }
- /*********************************************************/
- /* */
- /* ?????? */
- /* */
- /*********************************************************/
- void lcd_pos(uchar X,uchar Y)
- {
- uchar pos;
- if (X==1)
- {X=0x80;}
- else if (X==2)
- {X=0x90;}
- else if (X==3)
- {X=0x88;}
- else if (X==4)
- {X=0x98;}
- pos = X+Y ;
-
- lcd_wcmd(pos); //????
- }
- /*********************************************************
- * *
- * ???? *
- * *
- *********************************************************/
- void clr_screen()
- {
- lcd_wcmd(0x34); //??????
- delay(7);
- lcd_wcmd(0x30); //??????
- delay(7);
- lcd_wcmd(0x01); //??
- delay(7);
- }
- /*********************************************************
- * *
- * ??? *
- * *
- *********************************************************/
- void main()
- {
- uchar i;
- delay(200); //??,????
- lcd_init(); //???LCD
- while(1)
- {
- lcd_pos(1,0); //??????????
- for(i=0;i<16;i++)
- {
- lcd_wdat(DIS1[i]);
- delay(50);
- }
- lcd_pos(2,0); //??????????
- for(i=0;i<16;i++)
- {
- lcd_wdat(DIS2[i]);
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
0.png (65.17 KB, 下載次數(shù): 85)
下載附件
2017-5-15 17:05 上傳
所有資料51hei提供下載:
12864自定義動態(tài)字符顯示.zip
(1.13 KB, 下載次數(shù): 38)
2017-5-15 14:03 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評分
-
查看全部評分
|