完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
2个回答
|
|
是那个IDE用的呀?
|
|
|
|
拿走不谢!
/********************************************************************** 头文件功能说明:AVR单片机 引脚 位操作 最后修改: SSTA_XJL 时间: 2009.3.28 **********************************************************************/ #ifndef _BIT_H_ #define _BIT_H_ /******************************位段定义*****************************************/ typedef struct{ unsigned BIT0 : 1 ; unsigned BIT1 : 1 ; unsigned BIT2 : 1 ; unsigned BIT3 : 1 ; unsigned BIT4 : 1 ; unsigned BIT5 : 1 ; unsigned BIT6 : 1 ; unsigned BIT7 : 1 ; }PBIT; /*******************************数据类型申明***************************************/ #ifndef uint #define uint unsigned int #endif #ifndef uchar #define uchar unsigned char #endif #ifndef ulong #define ulong unsigned long #endif /**********************************************************************************/ /***********************************************************************/ #define SET_ADDRESS(Var) (*((volatile PBIT *)&(Var))) /**************************************************************************/ #ifdef PORTA #define PORTA_BIT SET_ADDRESS(PORTA) #endif #ifdef PORTB #define PORTB_BIT SET_ADDRESS(PORTB) #endif #ifdef PORTC #define PORTC_BIT SET_ADDRESS(PORTC) #endif #ifdef PORTD #define PORTD_BIT SET_ADDRESS(PORTD) #endif #ifdef PORTE #define PORTE_BIT SET_ADDRESS(PORTE) #endif #ifdef PORTF #define PORTF_BIT SET_ADDRESS(PORTF) #endif #ifdef PORTG #define PORTG_BIT SET_ADDRESS(PORTG) #endif /*******************************************************************************/ #ifdef DDRA #define DDRA_BIT SET_ADDRESS(DDRA) #endif #ifdef DDRB #define DDRB_BIT SET_ADDRESS(DDRB) #endif #ifdef DDRC #define DDRC_BIT SET_ADDRESS(DDRC) #endif #ifdef DDRD #define DDRD_BIT SET_ADDRESS(DDRD) #endif #ifdef DDRE #define DDRE_BIT SET_ADDRESS(DDRE) #endif #ifdef DDRF #define DDRF_BIT SET_ADDRESS(DDRF) #endif #ifdef DDRG #define DDRG_BIT SET_ADDRESS(DDRG) #endif /**********************************************************/ #ifdef PINA #define PINA_BIT SET_ADDRESS(PINA) #endif #ifdef PINB #define PINB_BIT SET_ADDRESS(PINB) #endif #ifdef PINC #define PINC_BIT SET_ADDRESS(PINC) #endif #ifdef PIND #define PIND_BIT SET_ADDRESS(PIND) #endif #ifdef PINE #define PINE_BIT SET_ADDRESS(PINE) #endif #ifdef PINF #define PINF_BIT SET_ADDRESS(PINF) #endif #ifdef PING #define PING_BIT SET_ADDRESS(PING) #endif /******************************************************************************/ #ifdef PORTA #define PA_0 PORTA_BIT.BIT0 #define PA_1 PORTA_BIT.BIT1 #define PA_2 PORTA_BIT.BIT2 #define PA_3 PORTA_BIT.BIT3 #define PA_4 PORTA_BIT.BIT4 #define PA_5 PORTA_BIT.BIT5 #define PA_6 PORTA_BIT.BIT6 #define PA_7 PORTA_BIT.BIT7 #endif #ifdef PORTB #define PB_0 PORTB_BIT.BIT0 #define PB_1 PORTB_BIT.BIT1 #define PB_2 PORTB_BIT.BIT2 #define PB_3 PORTB_BIT.BIT3 #define PB_4 PORTB_BIT.BIT4 #define PB_5 PORTB_BIT.BIT5 #define PB_6 PORTB_BIT.BIT6 #define PB_7 PORTB_BIT.BIT7 #endif #ifdef PORTC #define PC_0 PORTC_BIT.BIT0 #define PC_1 PORTC_BIT.BIT1 #define PC_2 PORTC_BIT.BIT2 #define PC_3 PORTC_BIT.BIT3 #define PC_4 PORTC_BIT.BIT4 #define PC_5 PORTC_BIT.BIT5 #define PC_6 PORTC_BIT.BIT6 #define PC_7 PORTC_BIT.BIT7 #endif #ifdef PORTD #define PD_0 PORTD_BIT.BIT0 #define PD_1 PORTD_BIT.BIT1 #define PD_2 PORTD_BIT.BIT2 #define PD_3 PORTD_BIT.BIT3 #define PD_4 PORTD_BIT.BIT4 #define PD_5 PORTD_BIT.BIT5 #define PD_6 PORTD_BIT.BIT6 #define PD_7 PORTD_BIT.BIT7 #endif #ifdef PORTE #define PE_0 PORTE_BIT.BIT0 #define PE_1 PORTE_BIT.BIT1 #define PE_2 PORTE_BIT.BIT2 #define PE_3 PORTE_BIT.BIT3 #define PE_4 PORTE_BIT.BIT4 #define PE_5 PORTE_BIT.BIT5 #define PE_6 PORTE_BIT.BIT6 #define PE_7 PORTE_BIT.BIT7 #endif #ifdef PORTF #define PF_0 PORTF_BIT.BIT0 #define PF_1 PORTF_BIT.BIT1 #define PF_2 PORTF_BIT.BIT2 #define PF_3 PORTF_BIT.BIT3 #define PF_4 PORTF_BIT.BIT4 #define PF_5 PORTF_BIT.BIT5 #define PF_6 PORTF_BIT.BIT6 #define PF_7 PORTF_BIT.BIT7 #endif #ifdef PORTG #define PG_0 PORTG_BIT.BIT0 #define PG_1 PORTG_BIT.BIT1 #define PG_2 PORTG_BIT.BIT2 #define PG_3 PORTG_BIT.BIT3 #define PG_4 PORTG_BIT.BIT4 #define PG_5 PORTG_BIT.BIT5 #define PG_6 PORTG_BIT.BIT6 #define PG_7 PORTG_BIT.BIT7 #endif /**********************************************************************/ #ifdef DDRA #define DDRA_0 DDRA_BIT.BIT0 #define DDRA_1 DDRA_BIT.BIT1 #define DDRA_2 DDRA_BIT.BIT2 #define DDRA_3 DDRA_BIT.BIT3 #define DDRA_4 DDRA_BIT.BIT4 #define DDRA_5 DDRA_BIT.BIT5 #define DDRA_6 DDRA_BIT.BIT6 #define DDRA_7 DDRA_BIT.BIT7 #endif #ifdef DDRB #define DDRB_0 DDRB_BIT.BIT0 #define DDRB_1 DDRB_BIT.BIT1 #define DDRB_2 DDRB_BIT.BIT2 #define DDRB_3 DDRB_BIT.BIT3 #define DDRB_4 DDRB_BIT.BIT4 #define DDRB_5 DDRB_BIT.BIT5 #define DDRB_6 DDRB_BIT.BIT6 #define DDRB_7 DDRB_BIT.BIT7 #endif #ifdef DDRC #define DDRC_0 DDRC_BIT.BIT0 #define DDRC_1 DDRC_BIT.BIT1 #define DDRC_2 DDRC_BIT.BIT2 #define DDRC_3 DDRC_BIT.BIT3 #define DDRC_4 DDRC_BIT.BIT4 #define DDRC_5 DDRC_BIT.BIT5 #define DDRC_6 DDRC_BIT.BIT6 #define DDRC_7 DDRC_BIT.BIT7 #endif #ifdef DDRD #define DDRD_0 DDRD_BIT.BIT0 #define DDRD_1 DDRD_BIT.BIT1 #define DDRD_2 DDRD_BIT.BIT2 #define DDRD_3 DDRD_BIT.BIT3 #define DDRD_4 DDRD_BIT.BIT4 #define DDRD_5 DDRD_BIT.BIT5 #define DDRD_6 DDRD_BIT.BIT6 #define DDRD_7 DDRD_BIT.BIT7 #endif #ifdef DDRE #define DDRE_0 DDRE_BIT.BIT0 #define DDRE_1 DDRE_BIT.BIT1 #define DDRE_2 DDRE_BIT.BIT2 #define DDRE_3 DDRE_BIT.BIT3 #define DDRE_4 DDRE_BIT.BIT4 #define DDRE_5 DDRE_BIT.BIT5 #define DDRE_6 DDRE_BIT.BIT6 #define DDRE_7 DDRE_BIT.BIT7 #endif #ifdef DDRF #define DDRF_0 DDRF_BIT.BIT0 #define DDRF_1 DDRF_BIT.BIT1 #define DDRF_2 DDRF_BIT.BIT2 #define DDRF_3 DDRF_BIT.BIT3 #define DDRF_4 DDRF_BIT.BIT4 #define DDRF_5 DDRF_BIT.BIT5 #define DDRF_6 DDRF_BIT.BIT6 #define DDRF_7 DDRF_BIT.BIT7 #endif #ifdef DDRG #define DDRG_0 DDRG_BIT.BIT0 #define DDRG_1 DDRG_BIT.BIT1 #define DDRG_2 DDRG_BIT.BIT2 #define DDRG_3 DDRG_BIT.BIT3 #define DDRG_4 DDRG_BIT.BIT4 #define DDRG_5 DDRG_BIT.BIT5 #define DDRG_6 DDRG_BIT.BIT6 #define DDRG_7 DDRG_BIT.BIT7 #endif /*****************************************************************************/ #ifdef PINA #define PINA_0 PINA_BIT.BIT0 #define PINA_1 PINA_BIT.BIT1 #define PINA_2 PINA_BIT.BIT2 #define PINA_3 PINA_BIT.BIT3 #define PINA_4 PINA_BIT.BIT4 #define PINA_5 PINA_BIT.BIT5 #define PINA_6 PINA_BIT.BIT6 #define PINA_7 PINA_BIT.BIT7 #endif #ifdef PINB #define PINB_0 PINB_BIT.BIT0 #define PINB_1 PINB_BIT.BIT1 #define PINB_2 PINB_BIT.BIT2 #define PINB_3 PINB_BIT.BIT3 #define PINB_4 PINB_BIT.BIT4 #define PINB_5 PINB_BIT.BIT5 #define PINB_6 PINB_BIT.BIT6 #define PINB_7 PINB_BIT.BIT7 #endif #ifdef PINC #define PINC_0 PINC_BIT.BIT0 #define PINC_1 PINC_BIT.BIT1 #define PINC_2 PINC_BIT.BIT2 #define PINC_3 PINC_BIT.BIT3 #define PINC_4 PINC_BIT.BIT4 #define PINC_5 PINC_BIT.BIT5 #define PINC_6 PINC_BIT.BIT6 #define PINC_7 PINC_BIT.BIT7 #endif #ifdef PIND #define PIND_0 PIND_BIT.BIT0 #define PIND_1 PIND_BIT.BIT1 #define PIND_2 PIND_BIT.BIT2 #define PIND_3 PIND_BIT.BIT3 #define PIND_4 PIND_BIT.BIT4 #define PIND_5 PIND_BIT.BIT5 #define PIND_6 PIND_BIT.BIT6 #define PIND_7 PIND_BIT.BIT7 #endif #ifdef PINE #define PINE_0 PINE_BIT.BIT0 #define PINE_1 PINE_BIT.BIT1 #define PINE_2 PINE_BIT.BIT2 #define PINE_3 PINE_BIT.BIT3 #define PINE_4 PINE_BIT.BIT4 #define PINE_5 PINE_BIT.BIT5 #define PINE_6 PINE_BIT.BIT6 #define PINE_7 PINE_BIT.BIT7 #endif #ifdef PINF #define PINF_0 PINF_BIT.BIT0 #define PINF_1 PINF_BIT.BIT1 #define PINF_2 PINF_BIT.BIT2 #define PINF_3 PINF_BIT.BIT3 #define PINF_4 PINF_BIT.BIT4 #define PINF_5 PINF_BIT.BIT5 #define PINF_6 PINF_BIT.BIT6 #define PINF_7 PINF_BIT.BIT7 #endif #ifdef PING #define PING_0 PING_BIT.BIT0 #define PING_1 PING_BIT.BIT1 #define PING_2 PING_BIT.BIT2 #define PING_3 PING_BIT.BIT3 #define PING_4 PING_BIT.BIT4 #define PING_5 PING_BIT.BIT5 #define PING_6 PING_BIT.BIT6 #define PING_7 PING_BIT.BIT7 #endif #endif /*******************************************************************************/
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
277 浏览 0 评论
【敏矽微ME32G070开发板免费体验】之原厂2812测试例程解析
368 浏览 0 评论
766 浏览 2 评论
《DNESP32S3使用指南-IDF版_V1.6》第二十六章 INFRARED_RECEPTION实验
592 浏览 0 评论
879 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12034 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 21:52 , Processed in 0.582269 second(s), Total 80, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号