欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
Proteus仿真HDM32GS12-B顯示驅動 單片機程序
[打印本頁]
作者:
對幾
時間:
2022-4-9 13:27
標題:
Proteus仿真HDM32GS12-B顯示驅動 單片機程序
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
1.png
(34.39 KB, 下載次數: 49)
下載附件
2022-4-9 13:19 上傳
這是在做傳感器實驗顯示的時候的副產物,可以顯示放在字庫文字,數字可以放在一個數組如uchar code xue[]={5,2,0,0,1,3,1,4,};不用在數字庫里面排序,優化了顯示代碼。顯示時可以不用分上下部分
單片機源程序如下:
#include <intrins.h>
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
#define LCD_DATA P0
sbit E1=P2^4;
sbit E2=P2^5;
sbit A0=P2^7;
sbit RW=P2^6;
uchar code xue[]={5,2,0,0,1,3,1,4,};
uchar code ziku[]=
{
/*-- 溫 --*/
0x10,0x60,0x02,0x8c,0x00,0x00,0xfe,0x92,0x92,0x92,0x92,0x92,0xfe,0x00,0x00,0x00,
0x04,0x04,0x7e,0x01,0x40,0x7e,0x42,0x42,0x7e,0x42,0x7e,0x42,0x42,0x7e,0x40,0x00,
/*-- 度 --*/
0x00,0x00,0xfc,0x24,0x24,0x24,0xfc,0x25,0x26,0x24,0xfc,0x24,0x24,0x24,0x04,0x00,
0x40,0x30,0x8f,0x80,0x84,0x4c,0x55,0x25,0x25,0x25,0x55,0x4c,0x80,0x80,0x80,0x00,
};
uchar code shuzi[]=
{
/*-- 0 --*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
/*-- 1 --*/
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
/*-- 2 --*/
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
/*-- 3 --*/
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,
/*-- 4 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,
/*-- 5 --*/
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,
/*-- 6 --*/
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,
/*-- 7 --*/
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
/*-- 8 --*/
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
/*-- 9 --*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,
};
void delay(uchar z)
{
int x;
for(x=z;x>0;x--);
}
void OUTMD(uchar i)//左頁
{
A0=1; //寫數據//發送數據
delay(5);
E1=1;
delay(10);
LCD_DATA=i;
delay(5);
E1=0;
}
void OUTSD(uchar i)//右頁
{
A0=1; //寫數據//發送數據
delay(5);
E2=1;
delay(10);
LCD_DATA=i;
delay(5);
E2=0;
}
void OUTMI(uchar i)//左頁
{
A0=0; //寫指令//發送命令
delay(5);
E1=1;
delay(10);
LCD_DATA=i;
delay(5);
E1=0;
}
void OUTSI(uchar i)//左頁
{
A0=0; //寫指令//發送命令
delay(5);
E2=1;
delay(10);
LCD_DATA=i;
delay(5);
E2=0;
}
void lcdini(void)//初始化
{
RW=0;
OUTMI(0XE2); OUTSI(0XE2);//??
OUTMI(0XAE); OUTSI(0XAE);//POWER
OUTMI(0XA4); OUTSI(0XA4);//????
OUTMI(0XA9); OUTSI(0XA9);//1/32???
OUTMI(0XA1); OUTSI(0XA1);//?????,????
OUTMI(0XE0); OUTSI(0XE0);//??-??-???
OUTMI(0XEE); OUTSI(0XEE);//??? ???-??-???
OUTMI(0X00); OUTMI(0XC0);//?????,?????
OUTSI(0X00); OUTSI(0XC0);
OUTMI(0XAF); OUTSI(0XAF);//POWER SAVE ??????,?????
}
void SetPage ( uchar page0,uchar page1)
{
OUTMI(0xB8|page1);
OUTSI(0xB8|page0);
}
void SetAddress ( uchar address0,uchar address1)
{
OUTMI(address1);
OUTSI(address0);
}
void PutCharR(uchar ch)
{
OUTSD(ch);
}
void PutCharL(uchar ch)
{
OUTMD(ch);
}
void clrscr(void)
{
uchar i;
uchar page;
for (page=0;page<4;page++)
{
SetPage ( page, page);
SetAddress(0,0);
for (i=0;i<61;i++)
{
PutCharR(0);
PutCharL(0);
}
}
}
void Draw_wordh (uint wei, uint d_where, uint x_add, bit layer, uchar width,uchar *p)
{ //???????
uchar x,address; //address?????????
bit window=0; //window??????
d_where = d_where*2*width;
//SetAddress(0,0);
for (x=0;x<width;x++)
{
if (x_add>=61) {window=1;address=x_add%61;}//判斷左右半屏
else address=x_add;
if(layer==0)
{ //??????????
SetPage(wei,wei);
SetAddress(address,address);
if(window==1)PutCharR(p[x+d_where]);//右半屏顯示上半部分
else PutCharL(p[x+d_where]);//左
}
else
{ //????????????
SetPage(wei+2,wei+2);
SetAddress(address,address);
if(window==1)PutCharR(p[x+d_where]);//??
else PutCharL(p[x+d_where]);
}
x_add++;
}}
復制代碼
Keil代碼與Proteus仿真下載:
顯示文字數字.zip
(64.29 KB, 下載次數: 15)
2022-4-9 13:18 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1