COSMIC自带文件Clanguage中很明确提到。忙不是理由啊
Absolute Addressing
The COSMIC compiler allows an object to be declared along with its
address when it is known at compile time (I/O registers). The address is
specified just after the declaration and is replacing the initialization
part. It is prefixed by the @ character:
volatile char PORTB @0x10;
Such a declaration is in fact equivalent to an extern declaration so it is
not possible to initialize such a variable. This can also be applied to a
function declaration if such a function already exists at a known address
in the application. This cannot be used to locate a function defined in
the application at a predefined address.
A bit variable can also be declared at an absolute location by defining
its byte address followed by a colon character and the bit position:
_Bool PB3 @0x10:3
or, if the variable PORTB has been previously declared as before:
_Bool PB3 @PORTB:3
详情回复
发表于 2010-12-1 21:29
Absolute Addressing
The COSMIC compiler allows an object to be declared along with its
address when it is known at compile time (I/O registers). The address is
specified just after the declaration and is replacing the initialization
part. It is prefixed by the @ character:
volatile char PORTB @0x10;
Such a declaration is in fact equivalent to an extern declaration so it is
not possible to initialize such a variable. This can also be applied to a
function declaration if such a function already exists at a known address
in the application. This cannot be used to locate a function defined in
the application at a predefined address.
A bit variable can also be declared at an absolute location by defining
its byte address followed by a colon character and the bit position:
_Bool PB3 @0x10:3
or, if the variable PORTB has been previously declared as before:
_Bool PB3 @PORTB:3