基于单片机智能灌溉系统设计-毕设课设资料

百度网盘下载地址(1126):点击下载

#include <reg52.h>
#include <intrins.h>
#include <absacc.h>
#include <math.h>
  
#define uchar unsigned char
#define uint unsigned int

//定义四个输出端口
sbit Led_jiashi=P3^4;		//灌溉
sbit Led_qushi=P3^3;		
sbit Led_jiangwen=P3^1;		
sbit Led_shengwen=P3^2;		
//定义三个设置按键
sbit Key_SET = P2^0;
sbit Key_ADD = P2^1;
sbit Key_SUB = P2^2;
sbit Key_OK  = P2^3;
//定义24C02数据口
sbit SCL = P1^0;
sbit SDA = P1^1;
//定义DHT11数据口
sbit DATA = P1^7;
sbit buzz=P3^5;

//定义LCD1602端口
sbit E=P1^3;		//1602使能引脚
//sbit RW=P2^6;		//1602读写引脚	
sbit RS=P1^2;		//1602数据/命令选择引脚
//定义全局变量
uchar U8FLAG,U8temp,U8comdata,U8RH_data_H_temp,U8RH_data_L_temp,U8T_data_H_temp,U8T_data_L_temp,U8checkdata_temp;
uchar U8RH_data_H,U8RH_data_L,U8T_data_H,U8T_data_L,U8checkdata;
uchar Mode,humidity,temperature;
char TH,TL,HH,HL;
bit bdata FlagStartRH,hot,cold,humid,dry,BJ;

//定时器0初始化
void Timer0_Init()
{
	ET0 = 1;        //允许定时器0中断
	TMOD = 0x11;       //定时器工作方式选择
	TL0 = 0xFF;     
	TH0 = 0x4B;     //定时器赋予初值
	TR0 = 1;        //启动定时器
}

//定时器0中断
void Timer0_ISR (void) interrupt 1 using 0

posted @ 2021-02-20 16:12  roadroad  阅读(364)  评论(0编辑  收藏  举报
电设屋
上千套电子毕设课设方案