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

📄 main.h

📁 M37546产品群智能水表的解决方案,请需要的朋友下载
💻 H
字号:
/************************************************************************/
/* Renesas System Solutions (Beijing) Co., LTD.							*/
/* All rights reserved.													*/
/*																		*/
/* File Name		: main.h											*/
/* Description		: 													*/
/*																		*/
/* Current Version	: 1.0												*/
/* Designer			: Feng Jun											*/
/* Start Date		: 2006-11-3											*/
/* Complete Date	: 2006-11-22										*/
/*																		*/
/* Lastest Version	:													*/
/* Designer			:													*/
/* Start Date		: 													*/
/* Complete Date	: 													*/
/************************************************************************/
#ifndef MAIN_H
#define MAIN_H

#include <intr740.h>
#include "sfr_7546.h"

/********************************************************
*  declare SFR bit                                      *
********************************************************/

	bit io_fluxcontrol	= P0.1;			/* IO pin of controlling detect flux */
	bit io_flow2		= P0.2;			/* IO pin of flow sensor 2 */
	bit io_flow1		= P0.3;			/* IO pin of flow sensor 1 */
	bit io_cardinside	= P0.4;			/* IO pin of detect card inside */
	bit io_cardCLK		= P0.6;			/* IO CLK of card */
	bit io_cardDAT		= P0.7;			/* IO DAT of card */
	
	bit io_GNDcontrol	= P1.0;			/* IO pin of controlling ground of card */
	bit io_powercontrol	= P1.1;			/* IO pin of controlling power of MCU */
	bit io_LCDCLK 		= P1.2;			/* IO CLK of LCD */
	bit io_LCDDI 		= P1.3;			/* IO DI of LCD */
	bit io_LCDCS 		= P1.4;			/* IO CS of LCD */
	
	bit io_openvalve 	= P2.0;			/* IO pin of open the valve		Open:	P2.0 H		P2.1 L */
	bit io_closevalve	= P2.1;			/* IO pin of close the valve 	Close:	P2.0 L		P2.1 H */
	bit io_valveopen	= P2.2;			/* IO pin of valve open (status) */
	bit io_valveclosed	= P2.3;			/* IO pin of valve closed (status) */
	bit io_lowvoltage	= P2.5;			/* IO pin of detect low voltage */
	
	bit io_EEPSDA		= P3.0;			/* IO SDA of EEPROM */
	bit io_EEPSCL		= P3.1;			/* IO SCL of EEPROM */
	bit io_EEPWP		= P3.2;			/* IO WP  of EEPROM */
	

/* Diretion of IO registers */
	bit ioD_fluxcontrol	= P0D.1;			/* IO direction of controlling detect flux */
	bit ioD_flow2		= P0D.2;			/* IO direction of flow sensor 2 */
	bit ioD_flow1		= P0D.3;			/* IO direction of flow sensor 1 */
	bit ioD_cardinside	= P0D.4;			/* IO direction of detect card inside */
	bit ioD_cardCLK		= P0D.6;			/* IO direction CLK of card */
	bit ioD_cardDAT		= P0D.7;			/* IO direction DAT of card */
	
	bit ioD_GNDcontrol	= P1D.0;			/* IO direction of controlling ground of card */
	bit ioD_powercontrol = P1D.1;			/* IO direction of power control */
	bit ioD_LCDCLK 		= P1D.2;			/* IO direction CLK of LCD */
	bit ioD_LCDDI 		= P1D.3;			/* IO direction DI of LCD */
	bit ioD_LCDCS 		= P1D.4;			/* IO direction CS of LCD */
	
	bit ioD_openvalve 	= P2D.0;			/* IO direction of open the valve		Open:	P2.0 H		P2.1 L */
	bit ioD_closevalve	= P2D.1;			/* IO direction of close the valve 	Close:	P2.0 L		P2.1 H */
	bit ioD_valveopen	= P2D.2;			/* IO direction of valve open (status) */
	bit ioD_valveclosed	= P2D.3;			/* IO direction of valve closed (status) */
	bit ioD_lowvoltage	= P2D.5;			/* IO direction of detect low voltage */
	
	bit ioD_EEPSDA		= P3D.0;			/* IO direction SDA of EEPROM */
	bit ioD_EEPSCL		= P3D.1;			/* IO direction SCL of EEPROM */
	bit ioD_EEPWP		= P3D.2;			/* IO direction WP  of EEPROM */

struct bit_def
	{
		char	b0:1;
		char	b1:1;
		char	b2:1;
		char	b3:1;
		char	b4:1;
		char	b5:1;
		char	b6:1;
		char	b7:1;
	};

union byte_def
	{
		struct	bit_def bita;
		char	byte;
	};

union byte_2
	{
		struct
		{
			unsigned char low;
			unsigned char high;
		}byte;
		unsigned int word;
	};

//extern union byte_def flag_addr;
//#define flag 			flag_addr.byte
//#define B_openvalve		flag_addr.bita.b0
//#define	B_closevalve	flag_addr.bita.b1

/* Definition of RAM area */


extern char g_statusA;
extern char g_timerA3s;
extern char g_timerA10s;
/* Definition of base section */
extern union byte_def detectflagaddr;
#define detectflag		detectflagaddr.byte
#define B_openvalve		detectflagaddr.bita.b0				/* The flag of opening the valve, if it is 1, valve will be opened */
#define B_closevalve	detectflagaddr.bita.b1			/* The flag of closing the valve, if it is 1, valve will be closed */
#define	B_timerAstart	detectflagaddr.bita.b2
#define B_dispvalve		detectflagaddr.bita.b3
#define	B_lowvoltage	detectflagaddr.bita.b4
#define	B_warning		detectflagaddr.bita.b5
#define B_dispnegative	detectflagaddr.bita.b6
#define	B_errorcard		detectflagaddr.bita.b7

extern union byte_def byteflagaddr;
#define B_erroreeprom	byteflagaddr.bita.b0

#define B_timerA3s		byteflagaddr.bita.b6
#define B_timerA10s		byteflagaddr.bita.b7

extern union byte_def fluxstatusaddr;
#define fluxstatus 		fluxstatusaddr.byte
#define B_flow1			fluxstatusaddr.bita.b0
#define B_flow2			fluxstatusaddr.bita.b1

extern union byte_def iofluxstatusaddr;
#define iofluxstatus 	iofluxstatusaddr.byte
#define B_ioflow1		iofluxstatusaddr.bita.b0
#define B_ioflow2		iofluxstatusaddr.bita.b1

//extern union byte_def detectflagaddr;
//extern union byte_def fluxstatusaddr;
//extern union byte_def iofluxstatusaddr;


#endif

⌨️ 快捷键说明

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