#include<reg51.h> #include <intrins.h> #include <math.h> #include <stdio.h> #define LCD_DB P0 sbit LCD_RS=P2^0; sbit LCD_RW=P2^1; sbit LCD_E=P2^2; sbit beep = P1^7; sbit key1 = P3^0; sbit key2 = P3^1; sbit key3 = P3^2; sbit key4 = P3^3; unsigned char Time; //用来存放定时时间 unsigned char Second; unsigned char w; //标志位 unsigned char wendumode = 0; unsigned char shidumode = 0; unsigned char wenduCB = 40; unsigned char shiduCB = 100; unsigned int wendu,shidu; /******定义函数****************/ #define uchar unsigned char #define uint unsigned int void LCD_init(void); //初始化函数 void LCD_write_command(uchar command); //写指令函数 void LCD_write_data(uchar dat); //写数据函数 void LCD_disp_char(uchar x,uchar y,uchar dat);//在某个屏幕位置上显示一个字符,X(0-15),y(1-2) void LCD_disp_str(uchar x,uchar y,uchar *str); //LCD1602显示字符串函数 void delay_n10us(uint n); //延时函数