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

📄 rd_atmega8l.h

📁 ATMEGA8做的595驱动1602
💻 H
字号:
#ifndef _Use_AdvancedPortCommand
# define _Use_AdvancedPortCommand
/***********************************************************
*  支持库名: ATMage8L Bit Driver                           *
*  源文件:   RD_ATMage162L.h                               *
*  版本:     v1.1                                          *
*  说明:    使用通用机器人通用引擎的底层驱动程序          *
*                                                          *
*  作者:    傻孩子                                        *
*  日期:    2005年10月8日                                 *
*  修改:    傻孩子                                        *
*  修改时间: 2005年10月8日                                 *
***********************************************************/
# include <iom8v.h>
# include <macros.h>

/****************************
*        资源说明           *
****************************/
# define PAInUse        0x00
# define PBInUse        0xff
# define PCInUse        0xff
# define PDInUse        0xff
# define PEInUse        0x00
# 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

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

# define Read_PB0       ((PINB<<7)>>7)
# define Read_PB1       ((PINB<<6)>>7)
# define Read_PB2       ((PINB<<5)>>7)
# define Read_PB3       ((PINB<<4)>>7)
# define Read_PB4       ((PINB<<3)>>7)
# define Read_PB5       ((PINB<<2)>>7)
# define Read_PB6       ((PINB<<1)>>7)
# define Read_PB7       (PINB>>7)

# define Read_PC0       ((PINC<<7)>>7)
# define Read_PC1       ((PINC<<6)>>7)
# define Read_PC2       ((PINC<<5)>>7)
# define Read_PC3       ((PINC<<4)>>7)
# define Read_PC4       ((PINC<<3)>>7)
# define Read_PC5       ((PINC<<2)>>7)
# define Read_PC6       ((PINC<<1)>>7)
# define Read_PC7       (PINC>>7)

# define Read_PD0       ((PIND<<7)>>7)
# define Read_PD1       ((PIND<<6)>>7)
# define Read_PD2       ((PIND<<5)>>7)
# define Read_PD3       ((PIND<<4)>>7)
# define Read_PD4       ((PIND<<3)>>7)
# define Read_PD5       ((PIND<<2)>>7)
# define Read_PD6       ((PIND<<1)>>7)
# define Read_PD7       (PIND>>7)

/****************************
*     高级端口宏定义        *
****************************/
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;	
}*PORTB_BIT,*PORTC_BIT,*PORTD_BIT,
 *DDRB_BIT,*DDRC_BIT,*DDRD_BIT;

/***********************************************************
*  函数说明:高级端口扩展初始化                            *
***********************************************************/
void PORTDefine(void)
{

    PORTB_BIT = ( struct PORTBIT *)0x38;
    PORTC_BIT = ( struct PORTBIT *)0x35;
    PORTD_BIT = ( struct PORTBIT *)0x32;

	DDRB_BIT = ( struct PORTBIT *)0x37;
	DDRC_BIT = ( struct PORTBIT *)0x34;
	DDRD_BIT = ( struct PORTBIT *)0x31;
}


# 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 _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

#endif



⌨️ 快捷键说明

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