云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 电信0901--智能灌溉监控系统设计

电信0901--智能灌溉监控系统设计

  • 62 次阅读
  • 3 次下载
  • 2025/6/3 4:14:36

总结与体会

17

附录A 总程序

#include #include #include \#include \#include \

#define uchar unsigned char #define W_cmd 0xa0 //24c02写指令

#define R_cmd 0xa1 //24c02读指令

uint temp,humi;

value humi_val,temp_val; //定义两个共同体,一个用于湿度,一个用于温度

uchar error; //用于检验是否出现错误

uchar set_humi[4]; //保存设定的湿度

uchar idata temp_humi_cache[8]; //温湿度设置缓存 uint

//温度上限变量 uint

//温度下限变量 uint

//湿度上限变量 uint

//湿度下限变量 uchar

//按键次数变量 uchar //用于蜂鸣器

temp_high;

temp_low;

humi_high;

humi_low;

presskeynum;

nn;

uchar checksum; //CRC uchar code word1[]={%uchar TEMP_data[7]; //用于记录实测的温度

uchar HUMI_data[6]; //用于记录实测的湿度

uchar set_temp[5]; //保存设定的温度

18

of %uchar

code

word2[]={\

ELECTRONS%uchar

code

word3[]={\

Welcome........\sbit

k1=P3^2;

//按键 sbit //按键 sbit //按键 sbit {

k2=P3^3; delay(10);

if (k1==0)

k3=P3^4; {

presskeynum++;

k4=P3^5; if(presskeynum==5)

//按键

sbit beep=P1^4; sbit led1=P1^3; sbit led2=P1^5; sbit led3=P1^6; sbit led4=P1^7; sbit led5=P3^6; //延时函数 void

delay(uint

//z为毫秒数 {

int a,b;

for(a=z;a>0;a--) for(b=120;b>0;b--); }

void key() {

uchar m; if

//调整按键检测

{

presskeynum=0;

}

while(k1==0);

LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN); //清屏 }

z) }

if(presskeynum==1)//温度上限设置{

if(k2==0)// 加 {

delay(300); temp_high++; if (temp_high>99) temp_high=0;

(k1==0) if (temp_high<0)

temp_high=99;

19

// while(k2==0); //加上此句必须松按键才处理 }

if(k3==0)//减 {

delay(300); temp_high--; if (temp_high>99) temp_high=0; if (temp_high<0) temp_high=99;

// while(k3==0); //加上此句必须松按键才处理 } }

if(presskeynum==2)//温度下限设置 {

if(k2==0)// 加 {

delay(300); temp_low++; if (temp_low>99) temp_low=0; if (temp_low<0) temp_low=99;

20

// while(k2==0); }

if(k3==0) {

delay(300); temp_low--; if (temp_low>99) temp_low=0; if (temp_low<0) temp_low=99; // while(k3==0); } }

if(presskeynum==3)//湿度上限设置 {

if(k2==0)// 加 {

delay(300); humi_high++; if (humi_high>99) humi_high=0; if (humi_high<0) humi_high=99; // while(k2==0);

搜索更多关于: 电信0901--智能灌溉监控系统设计 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

总结与体会 17 附录A 总程序 #include #include #include \#include \#include \#define uchar unsigned char #define W_cmd 0xa0 //24c02写指令 #define R_cmd 0xa1 //24c02读指令 uint temp,humi; value humi_val,temp_val; //定义两个共同体,一个用于湿度,一个用于温度 uchar error; //用于检验是否出现错误 uchar set_humi[4]; //保存设定

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com