📄 rd_atmega162.h
字号:
/***********************************************************
* 支持库名: ATMage162L Bit Driver *
* 源文件: RD_ATMage162L.h *
* 版本: v1.3 *
* 说明: AVR 通用位操作支持库 *
* *
* 作者: 傻孩子 *
* 日期: 2005年10月8日 *
* 修改: 傻孩子 *
* 修改时间: 2005年10月10日 *
* *
* [说明] *
* 1、使用前务必在端口初始化前加入PORTDefine()。 *
***********************************************************/
# include <iom162v.h>
# include <macros.h>
#ifndef _Use_AdvancedPortCommand
# define _Use_AdvancedPortCommand
/****************************
* 资源说明 *
****************************/
# define PAInUse 0xff
# define PBInUse 0xff
# define PCInUse 0xff
# define PDInUse 0xff
# define PEInUse 0x07
# define PFInUse 0x00
# define PGInUse 0x00
# define PHInUse 0x00
# define PIInUse 0x00
# define PJInUse 0x00
# define PKInUse 0x00
# define PLInUse 0x00
# define PMInUse 0x00
# define PNInUse 0x00
# define POInUse 0x00
# define PPInUse 0x00
# define PQInUse 0x00
# define PRInUse 0x00
# define PSInUse 0x00
# define PTInUse 0x00
# define PUInUse 0x00
# define PVInUse 0x00
# define PWInUse 0x00
# define PXInUse 0x00
# define PYInUse 0x00
# define PZInUse 0x00
/****************************
* 端口宏定义 *
****************************/
/****************************
* 高级端口宏定义 *
****************************/
struct PORTBIT
{
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,
*DDRA_BIT,*DDRB_BIT,*DDRC_BIT,*DDRD_BIT,*DDRE_BIT,
*PINA_BIT,*PINB_BIT,*PINC_BIT,*PIND_BIT,*PINE_BIT;
/***********************************************************
* 函数说明:高级端口扩展初始化 *
***********************************************************/
void PORTDefine(void)
{
PORTA_BIT = ( struct PORTBIT *)0x3b;
PORTB_BIT = ( struct PORTBIT *)0x38;
PORTC_BIT = ( struct PORTBIT *)0x35;
PORTD_BIT = ( struct PORTBIT *)0x32;
PORTE_BIT = ( struct PORTBIT *)0x27;
DDRA_BIT = ( struct PORTBIT *)0x3A;
DDRB_BIT = ( struct PORTBIT *)0x37;
DDRC_BIT = ( struct PORTBIT *)0x34;
DDRD_BIT = ( struct PORTBIT *)0x31;
DDRE_BIT = ( struct PORTBIT *)0x26;
PINA_BIT = ( struct PORTBIT *)0x39;
PINB_BIT = ( struct PORTBIT *)0x36;
PINC_BIT = ( struct PORTBIT *)0x33;
PIND_BIT = ( struct PORTBIT *)0x30;
PINE_BIT = ( struct PORTBIT *)0x25;
}
# 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 _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 Read_PA0 (*PINA_BIT).Bit0
# define Read_PA1 (*PINA_BIT).Bit1
# define Read_PA2 (*PINA_BIT).Bit2
# define Read_PA3 (*PINA_BIT).Bit3
# define Read_PA4 (*PINA_BIT).Bit4
# define Read_PA5 (*PINA_BIT).Bit5
# define Read_PA6 (*PINA_BIT).Bit6
# define Read_PA7 (*PINA_BIT).Bit7
# define Read_PB0 (*PINB_BIT).Bit0
# define Read_PB1 (*PINB_BIT).Bit1
# define Read_PB2 (*PINB_BIT).Bit2
# define Read_PB3 (*PINB_BIT).Bit3
# define Read_PB4 (*PINB_BIT).Bit4
# define Read_PB5 (*PINB_BIT).Bit5
# define Read_PB6 (*PINB_BIT).Bit6
# define Read_PB7 (*PINB_BIT).Bit7
# define Read_PC0 (*PINC_BIT).Bit0
# define Read_PC1 (*PINC_BIT).Bit1
# define Read_PC2 (*PINC_BIT).Bit2
# define Read_PC3 (*PINC_BIT).Bit3
# define Read_PC4 (*PINC_BIT).Bit4
# define Read_PC5 (*PINC_BIT).Bit5
# define Read_PC6 (*PINC_BIT).Bit6
# define Read_PC7 (*PINC_BIT).Bit7
# define Read_PD0 (*PIND_BIT).Bit0
# define Read_PD1 (*PIND_BIT).Bit1
# define Read_PD2 (*PIND_BIT).Bit2
# define Read_PD3 (*PIND_BIT).Bit3
# define Read_PD4 (*PIND_BIT).Bit4
# define Read_PD5 (*PIND_BIT).Bit5
# define Read_PD6 (*PIND_BIT).Bit6
# define Read_PD7 (*PIND_BIT).Bit7
# define Read_PE0 (*PINE_BIT).Bit0
# define Read_PE1 (*PINE_BIT).Bit1
# define Read_PE2 (*PINE_BIT).Bit2
# define Read_PE3 (*PINE_BIT).Bit3
# define Read_PE4 (*PINE_BIT).Bit4
# define Read_PE5 (*PINE_BIT).Bit5
# define Read_PE6 (*PINE_BIT).Bit6
# define Read_PE7 (*PINE_BIT).Bit7
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -