⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1602.c

📁 4X4矩阵键盘+LCD1602显示,可以开发好多功能
💻 C
字号:
#include<absacc.h>
#include <AT89X51.h> 
#include <intrins.h>

#define uchar unsigned char
#define uint  unsigned int
    uchar code lcd1[]={"input any press:"};
	uchar code lcd2[]={"^-^ count:    "};
   	uchar code lcd3[]={"0123456789abcdef"};
uchar d=0x00,e=0x00,i,j=0x00;
sbit RS=P2^0;
sbit RW=P2^1;
sbit EN=P2^2;
void Delay1ms( int ms)
{                           
	int i;
	while(ms--)
	{
	  for(i = 0; i< 250; i++)
	  {
	   _nop_();
	   _nop_();
	   _nop_();
	   _nop_();
	  }
	}
	}
bit check()
{                         
	bit busy;
	RS=0;
	RW=1;
	EN=1;
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	EN=0;
	return busy;
	}
 wzhilin(uchar zhi)
{
    while(check());
    RS=0;
    RW=0;
    EN=0;
 	_nop_();
    _nop_();
    P0=zhi;
    _nop_();
	_nop_();
	_nop_();
	_nop_();
	EN=1;	
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	EN=0;	 
 }
 wshuju(uchar shu)
 {
    while(check());
    RS=1;
	RW=0;
	EN=0;
	_nop_();
	_nop_();
	P0=shu;
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	EN=1;
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	EN=0;
	}
	chushihua()
	{
	 wzhilin(0x38);
	 Delay1ms(1);
	 wzhilin(0x0c);
	 Delay1ms(1); 
	 wzhilin(0x06);
	 Delay1ms(1);
     wzhilin(0x01); 
	 Delay1ms(1); 
	 }
	 jishu(uchar k)
	 {
	  wzhilin(0x80|k);
	  wshuju(lcd3[j]);
	 j++;
	 Delay1ms(100);
	 } 
	

	
	 
   
   

  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -