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

📄 1602h.txt

📁 LCD1602B基本驱动函数库 1、需要底层硬件驱动函数支持 基本的宏定义: LCD_RS LCD_RW LCD_E LCD_SetWriteData LCD_SetReadData
💻 TXT
📖 第 1 页 / 共 2 页
字号:
# 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 TimeInUse      0b00000111 
# define ExternIntInUse 0b00000011 
# define UARTInUse      0b00000001 
# define ADCount        6 


/**************************** 
*       端口宏定义          * 
****************************/ 
# 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;    
}*PORTA_BIT,*PORTB_BIT,*PORTC_BIT,*PORTD_BIT; 

/********************************************************************** 
*  函数说明:高级端口扩展初始化                                       * 
**********************************************************************/ 
void PORTDefine(void) 
{ 
PORTA_BIT = ( struct PORTBIT *)0x3b; 
PORTB_BIT = ( struct PORTBIT *)0x38; 
PORTC_BIT = ( struct PORTBIT *)0x35; 
PORTD_BIT = ( struct PORTBIT *)0x32; 
} 

# 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 



------------------------------------------------------------------ 
ATMega16L的位操作头文件 

/*********************************************************** 
*  支持库名: ATMega16L Robot Driver                        * 
*  源文件:   RD_ATMega16L.h                                * 
*  版本:     v0.1                                          * 
*                                                          * 
*  作者:    傻孩子                                        * 
*  日期:    2005年6月1日                                  * 
*  修改:    傻孩子                                        * 
*  修改时间: 2005年6月1日                                  * 
*                                                          * 
*  说明:    使用前要把 PORTDefine() 加入到端口初始化函数  * 
*            里面。否则位操作无效                          * 
***********************************************************/ 
# include <iom16v.h> 
# include <macros.h> 
#ifndef _Use_AdvancedPortCommand 
# define _Use_AdvancedPortCommand 

/**************************** 
*        资源说明           * 
****************************/ 
# define PAInUse        0xff 
# 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 TimeInUse      0b00000111 
# define ExternIntInUse 0b00000111 
# define UARTInUse      0b00000001 
# define ADCount        8 


/**************************** 
*       端口宏定义          * 
****************************/ 
# define Read_PA0       ((PINA<<7)>>7) 
# define Read_PA1       ((PINA<<6)>>7) 
# define Read_PA2       ((PINA<<5)>>7) 
# define Read_PA3       ((PINA<<4)>>7) 
# define Read_PA4       ((PINA<<3)>>7) 
# define Read_PA5       ((PINA<<2)>>7) 
# define Read_PA6       ((PINA<<1)>>7) 
# define Read_PA7       (PINA>>7) 

# 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;    
}*PORTA_BIT,*PORTB_BIT,*PORTC_BIT,*PORTD_BIT; 

/*********************************************************** 
*  函数说明:高级端口扩展初始化                            * 
***********************************************************/ 
void PORTDefine(void) 
{ 
PORTA_BIT = ( struct PORTBIT *)0x3b; 
PORTB_BIT = ( struct PORTBIT *)0x38; 
PORTC_BIT = ( struct PORTBIT *)0x35; 
PORTD_BIT = ( struct PORTBIT *)0x32; 
} 


# 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 

⌨️ 快捷键说明

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