微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 位域的方式做AVR的位定义

位域的方式做AVR的位定义

时间:11-29 来源:互联网 点击:
#ifndef __MEGA48IOBIT_H__
#define __MEGA48IOBIT_H__typedef struct _bit_field{unsigned bit0:1;unsigned bit1:1;unsigned bit2:1;unsigned bit3:1;unsigned bit4:1;unsigned bit5:1;unsigned bit6:1;unsigned bit7:1;}bit_field;#define _PIND   0x29#define PIND00   (*(volatile bit_field*)(_PIND)).bit0#define PIND01   (*(volatile bit_field*)(_PIND)).bit1#define PIND02   (*(volatile bit_field*)(_PIND)).bit2#define PIND03   (*(volatile bit_field*)(_PIND)).bit3#define PIND04   (*(volatile bit_field*)(_PIND)).bit4#define PIND05   (*(volatile bit_field*)(_PIND)).bit5#define PIND06   (*(volatile bit_field*)(_PIND)).bit6#define PIND07   (*(volatile bit_field*)(_PIND)).bit7#define _DDRD   0x2A#define DDRD00   (*(volatile bit_field*)(_DDRD)).bit0#define DDRD01   (*(volatile bit_field*)(_DDRD)).bit1#define DDRD02   (*(volatile bit_field*)(_DDRD)).bit2#define DDRD03   (*(volatile bit_field*)(_DDRD)).bit3#define DDRD04   (*(volatile bit_field*)(_DDRD)).bit4#define DDRD05   (*(volatile bit_field*)(_DDRD)).bit5#define DDRD06   (*(volatile bit_field*)(_DDRD)).bit6#define DDRD07   (*(volatile bit_field*)(_DDRD)).bit7#define _PORTD  0x2B#define PORTD00  (*(volatile bit_field*)(_PORTD)).bit0#define PORTD01  (*(volatile bit_field*)(_PORTD)).bit1#define PORTD02  (*(volatile bit_field*)(_PORTD)).bit2#define PORTD03  (*(volatile bit_field*)(_PORTD)).bit3#define PORTD04  (*(volatile bit_field*)(_PORTD)).bit4#define PORTD05  (*(volatile bit_field*)(_PORTD)).bit5#define PORTD06  (*(volatile bit_field*)(_PORTD)).bit6#define PORTD07  (*(volatile bit_field*)(_PORTD)).bit7#define _PINC   0x26#define PINC00   (*(volatile bit_field*)(_PINC)).bit0#define PINC01   (*(volatile bit_field*)(_PINC)).bit1#define PINC02   (*(volatile bit_field*)(_PINC)).bit2#define PINC03   (*(volatile bit_field*)(_PINC)).bit3#define PINC04   (*(volatile bit_field*)(_PINC)).bit4#define PINC05   (*(volatile bit_field*)(_PINC)).bit5#define PINC06   (*(volatile bit_field*)(_PINC)).bit6#define PINC07   (*(volatile bit_field*)(_PINC)).bit7#define _DDRC   0x27#define DDRC00   (*(volatile bit_field*)(_DDRC)).bit0#define DDRC01   (*(volatile bit_field*)(_DDRC)).bit1#define DDRC02   (*(volatile bit_field*)(_DDRC)).bit2#define DDRC03   (*(volatile bit_field*)(_DDRC)).bit3#define DDRC04   (*(volatile bit_field*)(_DDRC)).bit4#define DDRC05   (*(volatile bit_field*)(_DDRC)).bit5#define DDRC06   (*(volatile bit_field*)(_DDRC)).bit6#define DDRC07   (*(volatile bit_field*)(_DDRC)).bit7#define _PORTC  0x28#define PORTC00  (*(volatile bit_field*)(_PORTC)).bit0#define PORTC01  (*(volatile bit_field*)(_PORTC)).bit1#define PORTC02  (*(volatile bit_field*)(_PORTC)).bit2#define PORTC03  (*(volatile bit_field*)(_PORTC)).bit3#define PORTC04  (*(volatile bit_field*)(_PORTC)).bit4#define PORTC05  (*(volatile bit_field*)(_PORTC)).bit5#define PORTC06  (*(volatile bit_field*)(_PORTC)).bit6#define PORTC07  (*(volatile bit_field*)(_PORTC)).bit7#define _PINB   0x23#define PINB00   (*(volatile bit_field*)(_PINB)).bit0#define PINB01   (*(volatile bit_field*)(_PINB)).bit1#define PINB02   (*(volatile bit_field*)(_PINB)).bit2#define PINB03   (*(volatile bit_field*)(_PINB)).bit3#define PINB04   (*(volatile bit_field*)(_PINB)).bit4#define PINB05   (*(volatile bit_field*)(_PINB)).bit5#define PINB06   (*(volatile bit_field*)(_PINB)).bit6#define PINB07   (*(volatile bit_field*)(_PINB)).bit7#define _DDRB   0x24#define DDRB00   (*(volatile bit_field*)(_DDRB)).bit0#define DDRB01   (*(volatile bit_field*)(_DDRB)).bit1#define DDRB02   (*(volatile bit_field*)(_DDRB)).bit2#define DDRB03   (*(volatile bit_field*)(_DDRB)).bit3#define DDRB04   (*(volatile bit_field*)(_DDRB)).bit4#define DDRB05   (*(volatile bit_field*)(_DDRB)).bit5#define DDRB06   (*(volatile bit_field*)(_DDRB)).bit6#define DDRB07   (*(volatile bit_field*)(_DDRB)).bit7#define _PORTB  0x25#define PORTB00  (*(volatile bit_field*)(_PORTB)).bit0#define PORTB01  (*(volatile bit_field*)(_PORTB)).bit1#define PORTB02  (*(volatile bit_field*)(_PORTB)).bit2#define PORTB03  (*(volatile bit_field*)(_PORTB)).bit3#define PORTB04  (*(volatile bit_field*)(_PORTB)).bit4#define PORTB05  (*(volatile bit_field*)(_PORTB)).bit5#define PORTB06  (*(volatile bit_field*)(_PORTB)).bit6#define PORTB07  (*(volatile bit_field*)(_PORTB)).bit7#endif

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top