⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.h

📁 一款电力行业使用的温湿度控制器源代码 湿度传感器采用HF3223 温度采用DS18B20 单片机采用mega8 编程采用winavr2007
💻 H
字号:
/**************************************************************************
**	file name :		config.h
**	date:			2008
**  description: 	总头文件
**************************************************************************/



/***********************************************
*           general  includes                 *
***********************************************/
#ifndef _CONFIGURE_H
#define _CONFIGURE_H
	#ifndef BOOL
		typedef unsigned char BOOL;
	#else
		#error"BOOL has defined"
	#endif

	#ifndef TRUE
		#define TRUE    1
		#define true    1
		#define YES	    1
		#define OK      1
		#define ON      1
		#define on      1
	#endif
	
	#ifndef FALSE
		#define FALSE   0
		#define false   0
		#define NO	    0
		#define NOK     0
		#define OFF     0
		#define off     0
	#endif
	
	#define FAIL false
	#define SUCC true
/***********************************************
*           avrgcc  includes                   *
***********************************************/

    #include <inttypes.h>  //标准c裤头
    #include <stddef.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <setjmp.h>
    #include <math.h>
    
    #include <avr/io.h>    //avr c裤头
    #include <avr/wdt.h>
    #include <avr/sleep.h>
    #include <avr/Interrupt.h>
    #include <avr/pgmspace.h>
    #include <avr/eeprom.h>
    #include <util/delay.h>
    #include <util/crc16.h>

typedef unsigned char  unit8;   /***可移植数据类型*****/
typedef unsigned char  uint8;
typedef unsigned char  u08;


typedef signed   char  int8;  
typedef unsigned int   uint16;
typedef unsigned int   u16;
typedef signed   int   int16; 

typedef unsigned long  uint32;
typedef signed   long  int32; 


typedef unsigned long long int uint64;
typedef          long long int int64;


typedef  void ( * fptr  )() PROGMEM ;/*定义存放在flash中的函数指针,no input no output*/



/******************************************************
*           user   includes                   *
*******************************************************/
#include "inc/cpu.h"
#include "inc/key.h"
#include "inc/led.h"
#include "inc/eeprom.h"
#include "inc/keyproc.h"
#include "inc/relay.h"  
#include "inc/ds18b20.h"  
#include "inc/hf3223.h"

/*******用户配置入口********/
	


/*传感器路数定义*/
#define CH1	0
#define	CH2	1


/*温湿度采样相关*/
#define CH1_T_AD_CH 	0                               /*温度通道配置*/
#define CH1_H_AD_CH 	2                               /*湿度通道配置*/
#define CH1_BREAK_CH	6 								/*一路断线报警检测*/
#define	CH1_T_PULLUP	GET_BIT(PORTC).bit0				/*一路温度上拉使能*/
#define	CH1_H_PULLUP	GET_BIT(PORTC).bit2				/*一路湿度上拉使能*/

/*继电器端口配置*/
#define CH1_HEAT  	PORT(D,2) 	/*1路升温*/

#define HEAT 		CH1_HEAT	/*默认的升温继电器为1路*/

#define CH1_FAN	  	PORT(D,0)	/*1路降温*/

#define FAN 		CH1_FAN	    /*默认的降温继电器为1路*/

#define CH1_DEHUM	CH1_HEAT  	/*1路除湿*/

#define DEHUM		CH1_HEAT  	/*默认除湿继电器为1路*/


	
/*显示相关 IO定义*/
#define SEG_A	  	PORT(B,1)
#define SEG_B	  	PORT(B,7)
#define SEG_C	  	PORT(C,1)
#define SEG_D	  	PORT(C,2)
#define SEG_E	  	PORT(D,5)
#define SEG_F	  	PORT(B,2)
#define SEG_G	  	PORT(C,0)
#define SEG_DP	  	PORT(C,3)

#define LED0        PORT(B,3)
#define LED1        PORT(B,4)
#define LED2        PORT(B,5)
#define LED3        PORT(D,6)
#define LED4        PORT(D,7)
#define LED5        PORT(B,0)
#define LED6        PORT(B,6)

#define DIG1 5 //
#define DIG2 4
#define DIG3 3
#define DIG4 2
#define DIG5 1
#define DIG6 6
#define DIG7 7
#define DIG8 8
#define DIG9 9

#define DIGMAX 10

/*按键io定义*/
#define KEY_DEC 	PIN(C,5)
#define KEY_ADD		PIN(C,4)  //+ -与pcb相反
#define KEY_SET		PIN(D,1)

#define KEYCH		1
#define KEYADD		2
#define KEYDEC		3
#define KEYSET		4

//定时器控制索引号
#define _15MS  0
#define _500MS 1
#define _1S    2
#define _60S   3

//define the system running mode
#define AUTO_TH 0
#define MANU_TH 1






#endif 

/**************the end ************************/








⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -