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

📄 define.h

📁 AVR单片机DIY编程器!源代码及原理图都有!
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                              
**                                  小松工程(ilan2003)出品   
**                               
** 文   件   名: define.h
** 最后修改日期: 2005-12-8 23:53
** 描        述: 宏定义
** 版	     本: V1.0
** 主  控  芯 片:M16  晶振频率:7.3728MHZ
** IDE:ICCAVR 6.31
 
**********************************************************************************************************/
	
	
//#define	UART_INTERUPT_USE	
	
	
/********************************************************************************

                            	  变量声明定义

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


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

                            	 DDRX寄存器初始化

********************************************************************************/
#define		DDRA_VALUE	0xEF
#define		DDRB_VALUE	0xFF   
#define		DDRC_VALUE	0x7F
#define		DDRD_VALUE	0xFE 

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

                            	 PORTX寄存器初始化

********************************************************************************/
#define		PORTA_VALUE	0xFF
#define		PORTB_VALUE	0x00
#define		PORTC_VALUE	0xFE
#define		PORTD_VALUE	0x0F  




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

                            	  串口波特率

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

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

                            	位变量的宏操作

********************************************************************************/
#define		SET_BIT(a,b)	(a)|=BIT(b)
#define		CLR_BIT(a,b)	(a)&=~BIT(b)
#define		TEST_BIT(a,b)	((a)&BIT(b))						 



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

                            	高压编程引脚的定义

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

#define		PIN_OE			PD2
#define		PIN_WR			PD3
#define		PIN_BS1			PC1
#define		PIN_XA0			PD5
#define		PIN_XA1			PD6
#define		PIN_PAGEL		PD7	
#define		PIN_RESET		PC0
#define		PIN_XTAL		PC6
#define		PIN_BS2			PA0
#define		PIN_RDY			PC7


#define		HVP_DATA_WR		PORTB
#define		HVP_DATA_RD		PINB
#define		HVP_DATA_IN		DDRB=0x00
#define		HVP_DATA_OUT	DDRB=0xFF
#define		SET_OE			SET_BIT(PORTD,PD2)			
#define		CLR_OE			CLR_BIT(PORTD,PD2)			
#define		SET_WR			SET_BIT(PORTD,PD3)	
#define		CLR_WR			CLR_BIT(PORTD,PD3)	
#define		SET_BS1			SET_BIT(PORTC,PC1)	
#define		CLR_BS1			CLR_BIT(PORTC,PC1)	
#define		SET_XA0			SET_BIT(PORTD,PD5)	
#define		CLR_XA0			CLR_BIT(PORTD,PD5)	
#define		SET_XA1			SET_BIT(PORTD,PD6)	
#define		CLR_XA1			CLR_BIT(PORTD,PD6)	
#define		SET_PAGEL		SET_BIT(PORTD,PD7)	
#define		CLR_PAGEL		CLR_BIT(PORTD,PD7)	
#define		SET_RESET		SET_BIT(PORTC,PC0)	
#define		CLR_RESET		CLR_BIT(PORTC,PC0)	
#define		SET_XTAL		SET_BIT(PORTC,PC6)	
#define		CLR_XTAL		CLR_BIT(PORTC,PC6)	
#define		SET_BS2			SET_BIT(PORTA,PA0)	
#define		CLR_BS2			CLR_BIT(PORTA,PA0)	
#define		STATUS_RDY		(TEST_BIT(PINC,PC7))	
	
/********************************************************************************

                            	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


#define		DELAY_PULSE		10













⌨️ 快捷键说明

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