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

📄 public.h

📁 MEGA32L 单片机的按键,LED,LCD等测试例程,ICCAVR编译器
💻 H
字号:
//======================================
//Write By ZhongBin 
//@All Rights Reversed 2004-2008
//======================================
//FileName=public.h
//LastTime=20071214
//======================================

#ifndef	_PUBLIC_H_
#define	_PUBLIC_H_

#define	MEGA8	  0
#define	MEGA16	  1
#define	MEGA32	  2
#define	MEGA64	  3
#define MEGA128	  4

#define	CPU_TYPE MEGA32

	#ifndef	_U_CHAR_ 									
	#define _U_CHAR_
		#define	uchar unsigned char
	#endif

	#ifndef	_U_INT_ 
	#define _U_INT_
		#define	uint unsigned int
	#endif

	#ifndef	_U_LONG_ 
	#define _U_LONG_
		#define	ulong unsigned long
	#endif
	
	#ifndef	_TRUE_ 
	#define _TRUE_
		#define	true	1
		#define false	(!true)
	#endif
	
	#ifndef	_SYS_FREQ_
	#define _SYS_FREQ_
		#define SYS_FREQ_MHZ	(float)8.0	//用户必须按照实际的晶振速度进行定义
	#endif
	
	#if (CPU_TYPE==MEGA8)
		#ifndef	_ATMEGAL_8_			//代码宏的定义
		#define	_ATMEGAL_8_	
				#include "iom8v.h"
				#define CONST_UINT_RAM_END      0x045f	//CPU最大的RAM地址
		#endif

	#elif (CPU_TYPE==MEGA16)	
		#ifndef	_ATMEGAL_16_			//代码宏的定义
		#define	_ATMEGAL_16_	
				#include "iom16v.h"
				#define CONST_UINT_RAM_END      0x045f	//CPU最大的RAM地址
		#endif

	#elif (CPU_TYPE==MEGA32)	
		#ifndef	_ATMEGAL_32_			//代码宏的定义
		#define	_ATMEGAL_32_	
				#include "iom32v.h"
				#define CONST_UINT_RAM_END      0x085f	//CPU最大的RAM地址
		#endif

	#elif (CPU_TYPE==MEGA64)	
		#ifndef	_ATMEGAL_64_			//代码宏的定义
		#define	_ATMEGAL_64_	
				#include "iom64v.h"
				#define CONST_UINT_RAM_END      0x105f	//CPU最大的RAM地址
		#endif

	#else
	     Waring("CPU Type Define Error!");
	#endif
	
	#define BIT(x)	(1 << (x))
	#define _WDR() 	asm("wdr")
	#define _SEI()	asm("sei")
	#define _CLI()	asm("cli")
	#define _NOP()	asm("nop")

	#define CODE_NOP5	_NOP(); _NOP(); _NOP(); _NOP(); _NOP()

#endif

//End Of PUBLIC.H

⌨️ 快捷键说明

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