久久久国产精品视频袁燕,99re久久精品国产,亚洲欧美日韩国产综合v,天天躁夜夜躁狠狠久久,激情五月婷婷激情五月婷婷

  • 回復(fù)
  • 收藏
  • 點贊
  • 分享
  • 發(fā)新帖

單片機(jī)學(xué)習(xí)(RT1602C字符型LCD運用)歡迎討論與指教

學(xué)習(xí)單片機(jī)快一年了,不知道是人笨還是怎樣,就是不能很深的理解.最近在市場上買了個TAC2051的試驗板,搞了個驅(qū)動程序,遇到了不少的問題.歡迎玩過RT1602 的師傅門多指教.
#include
#define uint unsigned int
#define uchar unsigned char
sbit rs=P3^4; // 數(shù)據(jù)/指令控制位
sbit r_w=P3^5;//讀/寫控制位
sbit end=P3^3;//勢能
uchar code man[]="TEL:021-57857288    ";
uchar code han[]="shanghai carl";

void delay(uchar x)  //延時
{
uchar a,b;
for(a=x;a>0;a--)
  {
   for(b=100;b>0;b--);
  }
}

void write_instruct(uchar  inst)//寫指令
{
P1=inst;
end=0;
delay(10);
rs=0;
r_w=0;
delay(10);
end=1;
delay(10);
end=0;
}
  
void write_data(uchar  date)//寫數(shù)據(jù)
{
P1=date;
end=0;
delay(10);
rs=1;
r_w=0;
delay(10);
end=1;
delay(10);
end=0;
}

void zhong ()//字符 中,地址0x02.
{
write_instruct(0x80);//第1行開始
delay(10);
write_instruct(0x50);//字摸地址
delay(10);
write_data(0x84);//第1行
delay(10);
write_data(0x9f);//第2行
delay(10);
write_data(0x95);//第3行
delay(10);
write_data(0x95);//第4行
delay(10);
write_data(0x95);//第5行
delay(10);
write_data(0x95);//第6行
delay(10);
write_data(0x9f);//第7行
delay(10);
write_data(0x84);//第8行
delay(10);
}

void guo ()//字符 國,地址0x01.
{
write_instruct(0x80);//第1行開始
delay(10);
write_instruct(0x48);//字摸地址
delay(10);
write_data(0x9f);//第1行
delay(10);
write_data(0x91);//第2行
delay(10);
write_data(0x9f);//第3行
delay(10);
write_data(0x95);//第4行
delay(10);
write_data(0x9f);//第5行
delay(10);
write_data(0x95);//第6行
delay(10);
write_data(0x9f);//第7行
delay(10);
write_data(0x9f);//第8行
delay(10);
}


void init()//復(fù)位
{
write_instruct(0x38);//功能設(shè)置 8位 兩行顯示 5X7點陣
delay(10);
write_instruct(0x0c);//顯示開 光標(biāo)顯示 光標(biāo)閃爍
delay(10);
write_instruct(0x06);//光標(biāo)右移 顯示不移
delay(10);
write_instruct(0x01);//清顯示
delay(10);
zhong();
guo ();
}

void main()
{
  uchar i,h;
  init();
  delay(50);
  write_instruct(0x80);//顯示位置
  delay(50);
  
  for(i=0;i<21;i++)
   {
     write_data(man[i]);
     delay(50);
   }
  write_instruct(0xc0);//顯示位置
  delay(50);
  for(h=0;h<13;h++)
   {
    write_data(han[h]);
    delay(50);
   }
  delay(50);
  write_data(0x02);
  delay(50);
  write_data(0x01);
  delay(50);
  //write_instruct(0x07);
  delay(200);
while(1);
}
程序運行后的結(jié)果見圖片:
全部回復(fù)(1)
正序查看
倒序查看
liuanjun
LV.5
2
2008-08-27 15:13
500) {this.resized=true; this.width=500; this.alt='這是一張縮略圖,點擊可放大。\n按住CTRL,滾動鼠標(biāo)滾輪可自由縮放';this.style.cursor='hand'}" onclick="if(!this.resized) {return true;} else {window.open('http://u.dianyuan.com/bbs/u/68/225991219821101.jpg');}" onmousewheel="return imgzoom(this);">

有哪位高手能讓顯示循環(huán)移動?搞了快一個星期還是沒搞好.
0
回復(fù)
發(fā)