源程序
#include <reg52.h>
#include "intrins.h"
#define u8 unsigned char
#define u16 unsigned int
#define uchar unsigned char
#define uint unsigned int
uchar yushe_wendu=50;
uchar yushe_yanwu=45;
uint wendu;
uchar yanwu;
uchar Mode=0;
sbit LED_wendu= P1^4;
sbit LED_yanwu= P1^5;
sbit baojing= P3^3;
sbit Led_Reg =P1^5;
sbit Led_Yellow =P1^4;
sbit Buzzer =P3^3;
void delay_ms(u16 ms)
{
u16 i;
do{
i = 12000000 / 13000;
while(--i) ;
}while(--ms);
}
sbit LCDRS = P1^6;
sbit LCDEN = P1^7;
sbit D0 = P2^7;
sbit D1 = P2^6;
sbit D2 = P2^5;
sbit D3 = P2^4;
sbit D4 = P2^3;
sbit D5 = P2^2;
sbit D6 = P2^1;
sbit D7 = P2^0;
void LCDdelay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=10;y>0;y--);
}
void LCD_WriteData(u8 dat)
{
if(dat&0x01)D0=1;else D0=0;
if(dat&0x02)D1=1;else D1=0;
if(dat&0x04)D2=1;else D2=0;
if(dat&0x08)D3=1;else D3=0;
if(dat&0x10)D4=1;else D4=0;
if(dat&0x20)D5=1;else D5=0;
if(dat&0x40)D6=1;else D6=0;
if(dat&0x80)D7=1;else D7=0;
}
链接:https://pan.baidu.com/s/1gtG67l8bZXfPlaGhWkm9Lg 提取码:3cak
|