1602字符液晶滾動C源程序和仿真文件.zip
(88.69 KB, 售價: 1 E幣)
2021-4-21 22:58 上傳
點擊文件名下載附件
售價: 1 E幣 [記錄]
[ 購買]
3.png (5.4 KB)
下載附件
2021-4-21 22:58 上傳
一、電路設計此電路由AT89C51最小系統、LCD1602顯示模塊和獨立按鍵組成。
可實現文字的上下左右滾動
二、運行效果
仿真原理圖如下(proteus仿真工程文件和完整單片機C語言源碼可到本帖附件中下載)
1.png (102.46 KB)
下載附件
2021-4-21 22:56 上傳
2.png (102.42 KB)
下載附件
2021-4-21 22:56 上傳
三、部分單片機代碼
- /*************** ******************/
- #include <reg52.h>
- #include <string.h>
- #define uchar unsigned char
- #define uint unsigned int
- void Initialize_LCD();
- void ShowString(uchar,uchar,uchar *);
- sbit K1 = P3^0;
- sbit K2 = P3^1;
- sbit K3 = P3^2;
- uchar code Prompt[]="PRESS K1--K4 TO START DEMO PROG";
- uchar const Line_Count = 6;
- uchar code Msg[][80]=
- {
- "Many CAD users dismiss",
- "process of creating PCB",
- "of view.with PCB layout",
- "placement and track routing,",
- "can often be the most time",
- "And if you use circuit simulation",
- "you are going to spend even more"
- };
- uchar Disp_Buffer[32];
- void Delayxms(uint ms)
- {
- uchar i;
- while(ms--)
- {
- for(i=0;i<120;i++);
- }
- }
- void V_Scroll_Display()
- {
- uchar i,j,k = 0;
- uchar *p = Msg[0];
- uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
- while(p<q)
- {
- for(i=0;(i<16)&&(p<q);i++)
- {
- if(((i==0)||(i==15))&& *p == ' ')
- p++;
- if(*p != '\0')
- {
- Disp_Buffer[i] = *p++;
- }
- else
- {
- if(++k>Line_Count)
- break;
- p = Msg[k];
- Disp_Buffer[i] = *p++;
- }
- }
- for(j=i;j<16;j++)
- Disp_Buffer[j]=' ';
- while(F0)
- Delayxms(5);
- ShowString(0,0," ");
- Delayxms(150);
- while(F0)
- Delayxms(5);
- ShowString(0,1,Disp_Buffer);
- Delayxms(150);
- while(F0)
- Delayxms(5);
- ShowString(0,0,Disp_Buffer);
- ShowString(0,1," ");
- Delayxms(150);
- }
- ShowString(0,0," ");
- ShowString(0,1," ");
- }
- void H_Scroll_Display()
- {
- uchar m,n,t = 0,L=0;
- uchar *p = Msg[0];
- uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
- for(m=0;m<16;m++)
- Disp_Buffer[m]=' ';
- while(p<q)
- {
- if((m=16||m==31)&& *p == ' ')
- p++;
- for(m=16;m<32&&p<q;m++)
- {
- if(*p != '\0')
- {
- Disp_Buffer[m] = *p++;
- }
- else
- {
- if(++t>Line_Count)
- break;
- p = Msg[t];
- Disp_Buffer[m] = *p++;
- }
- }
- for(n=m;n<32;n++)
- Disp_Buffer[n]=' ';
- for(m=0;m<=16;m++)
- {
- while(F0)
- Delayxms(5);
- ShowString(0,L,Disp_Buffer+1);
- while(F0)
- Delayxms(5);
- Delayxms(20);
- }
- L = (L==0)? 1:0;
- Delayxms(200);
- }
- if(L==1)
- ShowString(0,1," ");
- }
- void EX_INT0() interrupt 0
- {
- F0 = !F0;
- }
- void main()
- {
- uint Count = 0;
- IE = 0x81;
- IT0 = 1;
- ……………………
- …………限于本文篇幅 余下代碼請下載附件…………
復制代碼
【必讀】版權免責聲明
1、本主題所有言論和內容純屬會員個人意見,與本論壇立場無關。2、本站對所發內容真實性、客觀性、可用性不做任何保證也不負任何責任,網友之間僅出于學習目的進行交流。3、對提供的數字內容不擁有任何權利,其版權歸原著者擁有。請勿將該數字內容進行商業交易、轉載等行為,該內容只為學習所提供,使用后發生的一切問題與本站無關。 4、本網站不保證本站提供的下載資源的準確性、安全性和完整性;同時本網站也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的損失或傷害。 5、本網站所有軟件和資料均為網友推薦收集整理而來,僅供學習用途使用,請務必下載后兩小時內刪除,禁止商用。6、如有侵犯你版權的,請及時聯系我們(電子郵箱1370723259@qq.com)指出,本站將立即改正。
|
|