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

📄 define.h

📁 AVR单片机DIY编程器!源代码及原理图都有!
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                               
**                                     开	发	部
**                                
** 文   件   名: define.h
** 最后修改日期: 2005-7-15 16:19
** 描        述: 宏定义
** 版	     本: V1.0
** 主  控  芯 片:M16  晶振频率:7.3728MHZ, 
**********************************************************************************************************/

/********************************************************************************

                            	数据类型的定义

********************************************************************************/
#define		uint08		unsigned char		
#define		uint16		unsigned int		
#define		uint32		unsigned long			
#define		sint08		signed char		
#define		sint16		signed int		
#define		sint32		signed long		


#define 	R0	(*(volatile unsigned char *)0x00)

/********************************************************************************

                            	  串口波特率

********************************************************************************/
#define 	BAUD19200	23
#define 	BAUD115200	3



/********************************************************************************

                            	位变量的宏操作

********************************************************************************/
#define		BIT_SET(a,b)	a|=BIT(b)
#define		BIT_CLR(a,b)	a&=~BIT(b)
#define		BIT_REV(a,b)	a^=BIT(b)
#define		BIT_TEST(a,b)	a&BIT(b)						 
#define		SET_BIT(a,b)	a|=BIT(b)
#define		CLR_BIT(a,b)	a&=~BIT(b)


/********************************************************************************

                            	LED控制

********************************************************************************/
#define		LED_ON_1		CLR_BIT(PORTA,PA1)	//LDE1 ON
#define		LED_OFF_1		SET_BIT(PORTA,PA1)	//LDE1 OFF
#define		LED_ON_2		CLR_BIT(PORTA,PA2)	//LDE2 ON
#define		LED_OFF_2		SET_BIT(PORTA,PA2)	//LDE2 OFF	
#define		LED_ON_3		CLR_BIT(PORTA,PA3)	//LDE3 ON
#define		LED_OFF_3		SET_BIT(PORTA,PA3)	//LDE3 OFF
#define		LED_FLASH_1		PORTA^=BIT(PA1);	//LDE1 FLASH
#define		LED_FLASH_2		PORTA^=BIT(PA2);	//LDE2 FLASH
#define		LED_FLASH_3		PORTA^=BIT(PA3);	//LDE3 FLASH



/********************************************************************************

                            	NOPS定义

********************************************************************************/
#define		NOP_2		NOP();NOP()
#define		NOP_3		NOP();NOP();NOP()
#define		NOP_4		NOP();NOP()NOP();NOP()
#define		NOP_5		NOP();NOP()NOP();NOP();NOP()



#define	 SPM_PAGESIZE	64







/********************************************************************************

				接 受 状 态 机
信息格式
MESSAGE_START
SEQUENCE_NUMBER 
MESSAGE_SIZE 
TOKEN 
MESSAGE_BODY 
CHECKSUM
/********************************************************************************/
#define		ST_START		0xF0	//0xF000
#define		ST_GET_SEQ_NUM		0xF1	//0xF001
#define 	ST_MSG_SIZE_1		0xF2	//0xF002
#define 	ST_MSG_SIZE_2		0xF3	//0xF003
#define 	ST_GET_TOKEN		0xF4	//0xF004
#define 	ST_GET_DATA		0xF5	//0xF005
#define		ST_GET_CHECK		0xF6	//0xF006




/********************************************************************************

				STK500 硬 件 固 件 配 置

/********************************************************************************/
#define CONFIG_PARAM_BUILD_NUMBER_LOW		12
#define CONFIG_PARAM_BUILD_NUMBER_HIGH		23
#define CONFIG_PARAM_HW_VER			0x12
#define CONFIG_PARAM_SW_MAJOR			2
#define CONFIG_PARAM_SW_MINOR			4	




#define SPI_SPEED_4MHZ				0
#define SPI_SPEED_2MHZ				1
#define SPI_SPEED_1MHZ				2	
#define SPI_SPEED_500KHZ			3
#define SPI_SPEED_250KHZ			4
#define SPI_SPEED_125KHZ			5
#define SPI_SPEED_62KHZ				6



#define		TOP_CARD_STK501			0xAA
#define		TOP_CARD_STK502			0x55		
#define		TOP_CARD_STK503			0xFA
#define		TOP_CARD_STK504			0xEE
#define		TOP_CARD_STK505			0xE4
#define		TOP_CARD_STK520			0xDD
















⌨️ 快捷键说明

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