欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: STC15單片機1602液晶屏比較方便輸出字符程序 [打印本頁]

作者: 保持微笑    時間: 2021-11-10 10:57
標題: STC15單片機1602液晶屏比較方便輸出字符程序
比較牛批的1602液晶程序,通過引號可以直接顯示在屏幕上

單片機源程序如下:
  1. #include "reg52.h"
  2. sbit rs=P2^0;  
  3. sbit rw=P2^1;
  4. sbit sn=P2^2;
  5. #define sjk P0
  6. void delay_ms(unsigned int q)
  7. {
  8.                         while(q--);
  9. }
  10. void Write_instruction_data1602(unsigned char q,w)
  11. {
  12.                         rs=q;
  13.                         delay_ms(1);
  14.                         sjk=w;
  15.                         sn=1;
  16.                         delay_ms(1);
  17.                         sn=0;
  18. }
  19. void liquid1602crystal()
  20. {
  21.                         Write_instruction_data1602(0,0x0c);
  22.                         Write_instruction_data1602(0,0x38);
  23.                         Write_instruction_data1602(0,0x06);
  24.                         Write_instruction_data1602(0,0x80+0x40) ;
  25. }
  26. void display_characters1602(bit q,unsigned char w,unsigned char *e)
  27. {
  28.                         if(q==0)
  29.         {
  30.                         Write_instruction_data1602(0,0x80+w);
  31.                         while(*e!='\0')
  32.                 {
  33.                         Write_instruction_data1602(1,*e);
  34.                         delay_ms(1);
  35.                         e++;
  36.                 }
  37.         }
  38.                         else
  39.         {
  40.                         Write_instruction_data1602(0,0x80+0x40+w);
  41.                         while(*e!='\0')
  42.                 {
  43.                         Write_instruction_data1602(1,*e);
  44.                         delay_ms(1);
  45.                         e++;
  46.                 }
  47.         }
  48. }
  49. void main()
  50. {
  51.                         rw=0;
  52.                         liquid1602crystal();
  53.                         display_characters1602(0,0,"2021/7/3 week6");
  54.                         display_characters1602(1,0,"20:30:56  27.0C");
  55.                         while(1);
  56. }
復制代碼

Keil代碼工程: Keil.7z (11.52 KB, 下載次數: 6)





歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1