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

📄 bitoperation.h

📁 这是一个AVR单片机的头文件
💻 H
字号:
/***********************************************************/
/*  支持库名: bitm16                                       */
/*  平台:     ATMage16L                                    */
/*  版本:     swust v1.0                                   */
/*                                                         */
/*  作者:    王坤朋                                       */
/*  日期:    2007年9月1日                                 */
/*  修改:    王坤朋                                       */
/*  修改时间:                                              */
/*         
    联系方式:wkphapy8888@163.com
    QQ:       125790376
/***********************************************************/
# include <avr/io.h>
//# include <macros.h>
#ifndef  _User_bitm16
# define _User_bitm16


/***********************************************************/
/*       端口宏定义                                        */
/***********************************************************/

/***********************************************************/
/*     高级端口宏定义                                      */
/***********************************************************/
struct PORT_BIT
{
    unsigned Bit0:1;
	unsigned Bit1:1;
    unsigned Bit2:1;
	unsigned Bit3:1;
    unsigned Bit4:1;
	unsigned Bit5:1;
    unsigned Bit6:1;
	unsigned Bit7:1;	
}
 PORTA_BIT,PORTB_BIT,PORTC_BIT,PORTD_BIT,PORTE_BIT,PORTF_BIT,PORTG_BIT,
 DDRA_BIT,DDRB_BIT,DDRC_BIT,DDRD_BIT,DDRE_BIT,DDRF_BIT,DDRG_BIT,
 PINA_BIT,PINB_BIT,PINC_BIT,PIND_BIT,PINE_BIT,PINF_BIT,PING_BIT;

/**********************************************************/
/*  函数说明:高级端口扩展初始化                          */
/**********************************************************/
#define PORTA_BIT (*( struct PORT_BIT *)0x3B)
#define PORTB_BIT (*( struct PORT_BIT *)0x38)
#define PORTC_BIT (*( struct PORT_BIT *)0x35)
#define PORTD_BIT (*( struct PORT_BIT *)0x32)
#define PORTE_BIT (*( struct PORT_BIT *)0x23)
#define PORTF_BIT (*( struct PORT_BIT *)0x62)
#define PORTG_BIT (*( struct PORT_BIT *)0x65)
	
#define DDRA_BIT  (*( struct PORT_BIT *)0x3A)
#define DDRB_BIT  (*( struct PORT_BIT *)0x37)
#define DDRC_BIT  (*( struct PORT_BIT *)0x34)
#define DDRD_BIT  (*( struct PORT_BIT *)0x31)
#define DDRE_BIT  (*( struct PORT_BIT *)0x22)
#define DDRF_BIT  (*( struct PORT_BIT *)0x61)
#define DDRG_BIT  (*( struct PORT_BIT *)0x64)

#define PINA_BIT  (*( struct PORT_BIT *)0x39)
#define PINB_BIT  (*( struct PORT_BIT *)0x36)
#define PINC_BIT  (*( struct PORT_BIT *)0x33)
#define PIND_BIT  (*( struct PORT_BIT *)0x30) 
#define PINE_BIT  (*( struct PORT_BIT *)0x21)  
#define PINF_BIT  (*( struct PORT_BIT *)0x20)  
#define PING_BIT  (*( struct PORT_BIT *)0x63)        


# define DDR_PA0     (DDRA_BIT).Bit0
# define DDR_PA1     (DDRA_BIT).Bit1
# define DDR_PA2     (DDRA_BIT).Bit2
# define DDR_PA3     (DDRA_BIT).Bit3
# define DDR_PA4     (DDRA_BIT).Bit4
# define DDR_PA5     (DDRA_BIT).Bit5
# define DDR_PA6     (DDRA_BIT).Bit6
# define DDR_PA7     (DDRA_BIT).Bit7


# define DDR_PB0     (DDRB_BIT).Bit0
# define DDR_PB1     (DDRB_BIT).Bit1
# define DDR_PB2     (DDRB_BIT).Bit2
# define DDR_PB3     (DDRB_BIT).Bit3
# define DDR_PB4     (DDRB_BIT).Bit4
# define DDR_PB5     (DDRB_BIT).Bit5
# define DDR_PB6     (DDRB_BIT).Bit6
# define DDR_PB7     (DDRB_BIT).Bit7

# define DDR_PC0     (DDRC_BIT).Bit0
# define DDR_PC1     (DDRC_BIT).Bit1
# define DDR_PC2     (DDRC_BIT).Bit2
# define DDR_PC3     (DDRC_BIT).Bit3
# define DDR_PC4     (DDRC_BIT).Bit4
# define DDR_PC5     (DDRC_BIT).Bit5
# define DDR_PC6     (DDRC_BIT).Bit6
# define DDR_PC7     (DDRC_BIT).Bit7

# define DDR_PD0     (DDRD_BIT).Bit0
# define DDR_PD1     (DDRD_BIT).Bit1
# define DDR_PD2     (DDRD_BIT).Bit2
# define DDR_PD3     (DDRD_BIT).Bit3
# define DDR_PD4     (DDRD_BIT).Bit4
# define DDR_PD5     (DDRD_BIT).Bit5
# define DDR_PD6     (DDRD_BIT).Bit6
# define DDR_PD7     (DDRD_BIT).Bit7

# define DDR_PE0     (DDRE_BIT).Bit0
# define DDR_PE1     (DDRE_BIT).Bit1
# define DDR_PE2     (DDRE_BIT).Bit2
# define DDR_PE3     (DDRE_BIT).Bit3
# define DDR_PE4     (DDRE_BIT).Bit4
# define DDR_PE5     (DDRE_BIT).Bit5
# define DDR_PE6     (DDRE_BIT).Bit6
# define DDR_PE7     (DDRE_BIT).Bit7

# define DDR_PF0     (DDRF_BIT).Bit0
# define DDR_PF1     (DDRF_BIT).Bit1
# define DDR_PF2     (DDRF_BIT).Bit2
# define DDR_PF3     (DDRF_BIT).Bit3
# define DDR_PF4     (DDRF_BIT).Bit4
# define DDR_PF5     (DDRF_BIT).Bit5
# define DDR_PF6     (DDRF_BIT).Bit6
# define DDR_PF7     (DDRF_BIT).Bit7

# define DDR_PG0     (DDRG_BIT).Bit0
# define DDR_PG1     (DDRG_BIT).Bit1
# define DDR_PG2     (DDRG_BIT).Bit2
# define DDR_PG3     (DDRG_BIT).Bit3

# define _PA0        (PORTA_BIT).Bit0
# define _PA1        (PORTA_BIT).Bit1
# define _PA2        (PORTA_BIT).Bit2
# define _PA3        (PORTA_BIT).Bit3
# define _PA4        (PORTA_BIT).Bit4
# define _PA5        (PORTA_BIT).Bit5
# define _PA6        (PORTA_BIT).Bit6
# define _PA7        (PORTA_BIT).Bit7

# define _PB0        (PORTB_BIT).Bit0
# define _PB1        (PORTB_BIT).Bit1
# define _PB2        (PORTB_BIT).Bit2
# define _PB3        (PORTB_BIT).Bit3
# define _PB4        (PORTB_BIT).Bit4
# define _PB5        (PORTB_BIT).Bit5
# define _PB6        (PORTB_BIT).Bit6
# define _PB7        (PORTB_BIT).Bit7

# define _PC0        (PORTC_BIT).Bit0
# define _PC1        (PORTC_BIT).Bit1
# define _PC2        (PORTC_BIT).Bit2
# define _PC3        (PORTC_BIT).Bit3
# define _PC4        (PORTC_BIT).Bit4
# define _PC5        (PORTC_BIT).Bit5
# define _PC6        (PORTC_BIT).Bit6
# define _PC7        (PORTC_BIT).Bit7

# define _PD0        (PORTD_BIT).Bit0
# define _PD1        (PORTD_BIT).Bit1
# define _PD2        (PORTD_BIT).Bit2
# define _PD3        (PORTD_BIT).Bit3
# define _PD4        (PORTD_BIT).Bit4
# define _PD5        (PORTD_BIT).Bit5
# define _PD6        (PORTD_BIT).Bit6
# define _PD7        (PORTD_BIT).Bit7

# define _PE0        (PORTE_BIT).Bit0
# define _PE1        (PORTE_BIT).Bit1
# define _PE2        (PORTE_BIT).Bit2
# define _PE3        (PORTE_BIT).Bit3
# define _PE4        (PORTE_BIT).Bit4
# define _PE5        (PORTE_BIT).Bit5
# define _PE6        (PORTE_BIT).Bit6
# define _PE7        (PORTE_BIT).Bit7

# define _PF0        (PORTF_BIT).Bit0
# define _PF1        (PORTF_BIT).Bit1
# define _PF2        (PORTF_BIT).Bit2
# define _PF3        (PORTF_BIT).Bit3
# define _PF4        (PORTF_BIT).Bit4
# define _PF5        (PORTF_BIT).Bit5
# define _PF6        (PORTF_BIT).Bit6
# define _PF7        (PORTF_BIT).Bit7

# define _PG0        (PORTG_BIT).Bit0
# define _PG1        (PORTG_BIT).Bit1
# define _PG2        (PORTG_BIT).Bit2
# define _PG3        (PORTG_BIT).Bit3

# define PIN_PA0    (PINA_BIT).Bit0
# define PIN_PA1    (PINA_BIT).Bit1
# define PIN_PA2    (PINA_BIT).Bit2
# define PIN_PA3    (PINA_BIT).Bit3
# define PIN_PA4    (PINA_BIT).Bit4
# define PIN_PA5    (PINA_BIT).Bit5
# define PIN_PA6    (PINA_BIT).Bit6
# define PIN_PA7    (PINA_BIT).Bit7

# define PIN_PB0    (PINB_BIT).Bit0
# define PIN_PB1    (PINB_BIT).Bit1
# define PIN_PB2    (PINB_BIT).Bit2
# define PIN_PB3    (PINB_BIT).Bit3
# define PIN_PB4    (PINB_BIT).Bit4
# define PIN_PB5    (PINB_BIT).Bit5
# define PIN_PB6    (PINB_BIT).Bit6
# define PIN_PB7    (PINB_BIT).Bit7

# define PIN_PC0    (PINC_BIT).Bit0
# define PIN_PC1    (PINC_BIT).Bit1
# define PIN_PC2    (PINC_BIT).Bit2
# define PIN_PC3    (PINC_BIT).Bit3
# define PIN_PC4    (PINC_BIT).Bit4
# define PIN_PC5    (PINC_BIT).Bit5
# define PIN_PC6    (PINC_BIT).Bit6
# define PIN_PC7    (PINC_BIT).Bit7

# define PIN_PD0    (PIND_BIT).Bit0
# define PIN_PD1    (PIND_BIT).Bit1
# define PIN_PD2    (PIND_BIT).Bit2
# define PIN_PD3    (PIND_BIT).Bit3
# define PIN_PD4    (PIND_BIT).Bit4
# define PIN_PD5    (PIND_BIT).Bit5
# define PIN_PD6    (PIND_BIT).Bit6
# define PIN_PD7    (PIND_BIT).Bit7

# define PIN_PE0    (PINE_BIT).Bit0
# define PIN_PE1    (PINE_BIT).Bit1
# define PIN_PE2    (PINE_BIT).Bit2
# define PIN_PE3    (PINE_BIT).Bit3
# define PIN_PE4    (PINE_BIT).Bit4
# define PIN_PE5    (PINE_BIT).Bit5
# define PIN_PE6    (PINE_BIT).Bit6
# define PIN_PE7    (PINE_BIT).Bit7

# define PIN_PF0    (PINF_BIT).Bit0
# define PIN_PF1    (PINF_BIT).Bit1
# define PIN_PF2    (PINF_BIT).Bit2
# define PIN_PF3    (PINF_BIT).Bit3
# define PIN_PF4    (PINF_BIT).Bit4
# define PIN_PF5    (PINF_BIT).Bit5
# define PIN_PF6    (PINF_BIT).Bit6
# define PIN_PF7    (PINF_BIT).Bit7

# define PIN_PG0    (PING_BIT).Bit0
# define PIN_PG1    (PING_BIT).Bit1
# define PIN_PG2    (PING_BIT).Bit2
# define PIN_PG3    (PING_BIT).Bit3


#endif

⌨️ 快捷键说明

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