• 大小: 120KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签:

资源简介

利用ZigBee技术实现短距离温湿度的实时采集存储等

资源截图

代码片段和文件信息

#include 
#include  
#include 
#include 
sbit   P12 = P1^2;
sbit   P13 = P1^3;

#define DATA   P12 //定义通讯数据端口
//#define DATA_IO TRISC7 //用于设置IO状态
#define SCK   P13 //定义通讯时钟端口

#define noACK 0       //继续传输数据,用于判断是否结束通讯
#define ACK   1       //结束数据传输;

                           //地址 命令
void init_uart(void);
void s_connectionreset(void);
void s_transstart(void);
char s_measure(unsigned char *p_value unsigned char *p_checksum unsigned char mode);
char s_write_byte(unsigned char value);
char s_read_byte(unsigned char ack);
void calc_sth11(float *p_humidity float *p_temperature);
float calc_dewpoint(float hfloat t);
void delay (unsigned int time);

union
{ unsigned int i;
float f;
}humi_valtemp_val; //定义两个共同体,一个用于湿度,一个用于温度


    unsigned int xdata m1 n2;
/*******************************************************************************
延时 1MS 带参数(int)子程序
*******************************************************************************/
void delay (unsigned int time){
unsigned int ab;
for(a=0;a   for(b=0;b<88;b++);
}
}


//----------------------------------------------------------------------------------
void s_connectionreset(void)
//----------------------------------------------------------------------------------
// 连接复位;
//       _____________________________________________________         ________
// DATA:                                                      |_______|
//          _    _    _    _    _    _    _    _    _        ___     ___
// SCK : __| |__| |__| |__| |__| |__| |__| |__| |__| |______|   |___|   |______

 
DATA=1; SCK=0;                    //准备
//for(i=0;i<9;i++)                  //DATA保持高,SCK时钟触发9次,发送启动传输,通迅即复位
//{ 
SCK=1;  _nop_();
   SCK=0;_nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
SCK=1;  _nop_();
   SCK=0; _nop_();
  
//}
s_transstart();                   //启动传输
}

//----------------------------------------------------------------------------------
void s_transstart(void)
//----------------------------------------------------------------------------------
// 启动传输
//       _____         ________
// DATA:      |_______|
//           ___     ___
// SCK : ___|   |___|   |______

   DATA=1; SCK=0;                   
   _nop_();  
   SCK=1;
   _nop_();   
   DATA=0;
   _nop_();   
   SCK=0; 
   _nop_();_nop_();_nop_(); _nop_();
   SCK=1;
   _nop_();   
   DATA=1;     
   _nop_();
   SCK=0;       
}
//----------------------------------------------------------------------------------
char s_measure (unsigned char *p_value unsigned char *p_checksum unsigned char mode)
//----------------------------------------------------------------------------------
// 进行温度

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      78146  2009-11-02 14:05  温湿度采集\c8051f320

     文件      23151  2009-11-02 14:05  温湿度采集\c8051f320.hex

     文件      86460  2009-11-02 14:05  温湿度采集\c8051f320.M51

     文件       3428  2009-11-02 19:35  温湿度采集\c8051f320.Opt

     文件        201  2009-11-02 16:42  温湿度采集\c8051f320.plg

     文件       2233  2009-11-02 14:07  温湿度采集\c8051f320.Uv2

     文件       8382  2009-08-27 15:02  温湿度采集\c8051f320sensor.c

     文件      13336  2009-11-02 14:05  温湿度采集\c8051f320sensor.LST

     文件      17026  2009-11-02 14:05  温湿度采集\c8051f320sensor.OBJ

     文件       3427  2009-11-02 16:43  温湿度采集\c8051f320_Opt.Bak

     文件       2232  2009-11-02 13:13  温湿度采集\c8051f320_Uv2.Bak

     文件         19  2009-10-29 10:14  温湿度采集\ExtDll.iex

     文件      11309  2009-10-29 08:43  温湿度采集\F32x_UART_STDIO.c

     文件      19741  2009-11-02 14:05  温湿度采集\F32x_UART_STDIO.LST

     文件      14834  2009-11-02 14:05  温湿度采集\F32x_UART_STDIO.OBJ

     文件       1131  2009-08-24 16:48  温湿度采集\file.h

     文件      19578  2009-08-25 15:15  温湿度采集\FLASH.C

     文件      33991  2009-11-02 14:05  温湿度采集\FLASH.LST

     文件      35774  2009-11-02 14:05  温湿度采集\FLASH.OBJ

     文件      33009  2009-08-25 12:59  温湿度采集\IIC.C

     文件      49717  2009-11-02 14:05  温湿度采集\IIC.LST

     文件      19261  2009-11-02 14:05  温湿度采集\IIC.OBJ

     文件        249  2009-08-25 17:13  温湿度采集\main.c

     文件       1228  2009-11-02 14:05  温湿度采集\main.LST

     文件       1654  2009-11-02 14:05  温湿度采集\main.OBJ

     文件       5115  2002-04-16 15:32  温湿度采集\STARTUP.A51

     文件      11772  2009-06-17 16:29  温湿度采集\STARTUP.lst

     目录          0  2010-09-04 21:43  温湿度采集

----------- ---------  ---------- -----  ----

               496404                    28

............此处省略1个文件信息

评论

共有 条评论

相关资源