typedef struct tagPORTBBITS {
unsigned RB0:1;
unsigned RB1:1;
unsigned RB2:1;
unsigned RB3:1;
unsigned RB4:1;
unsigned RB5:1;
unsigned RB6:1;
unsigned RB7:1;
unsigned RB8:1;
unsigned RB9:1;
unsigned RB10:1;
unsigned RB11:1;
unsigned RB12:1;
unsigned RB13:1;
unsigned RB14:1;
unsigned RB15:1;
} PORTBBITS;
extern volatile PORTBBITS PORTBbits __attribute__((__sfr__));
在以前的51单片机比如P0口的寄存器地址为0x80,我们会用sfr P0 = 0x80;将P0口所示对应到地址上,
对PIC单片机如上述代码所示,将PORTB对应到对应的地址是用extern volatile PORTBBITS PORTBbits __attribute__((__sfr__));实现的嘛?这里为什么没有明确的地址的呢? |