XC8 derleyicisindeki Port tanımlamalarına baktım amcalar şöyle bir şey yapmış.
// bitfield definitions
typedef union {
struct {
unsigned BF :1;
unsigned UA :1;
unsigned R_nW :1;
unsigned S :1;
unsigned P :1;
unsigned D_nA :1;
unsigned CKE :1;
unsigned SMP :1;
};
} SSP1STATbits_t;
extern volatile SSP1STATbits_t SSP1STATbits @ 0x214;
Şu kısmın ne anlama geldiğini kavrayamadım.SSP1STATbits_t SSP1STATbits ifadesine PIC in 0x214 adresinimi vermiş ?
SSP1STATbits @ 0x214;
Çünkü üst tarafta şöyle yapılmış
extern volatile unsigned char SSP1STAT @ 0x214;
#ifndef _LIB_BUILD
asm("SSP1STAT equ 0214h");
#endif
C dilinde at işareti yok. İnanmazsan dayıya sor: https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B (https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B)
xc8'de @ işaretinin özel bir anlamı var.
Peki bunu nerden öğreniyoruz, tabiki "MPLAB® XC8 C Compiler User's Guide" dökümanından: http://ww1.microchip.com/downloads/en/DeviceDoc/52053B.pdf (http://ww1.microchip.com/downloads/en/DeviceDoc/52053B.pdf)
sayfa 25'de diyorki:
Alıntı YapThe 8-bit compilers have used an @ symbol to specify an absolute address.
The 16- and 32-bit compilers have used the address attribute to specify an object's address.