<address>
\emph default
keyword, in addition to a storage class, e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
xdata
\end_inset
0x8000 unsigned char PORTA_8255 ;
-\newline
-
-\family default
+\layout Standard
-\newline
In the above example the PORTA_8255 will be allocated to the location 0x8000
of the external ram.
Note that this feature is provided to give the programmer access to
\newline
Absolute address can be specified for variables in all storage classes,
e.g.:
-\newline
+\layout Verse
-\newline
\family typewriter
bit
\end_inset
0x02 bvar;
-\newline
-
-\newline
+\layout Standard
-\family default
The above example will allocate the variable at offset 0x02 in the bit-addressab
le space.
There is no real advantage to assigning absolute addresses to variables
For example, if you have a routine that uses one or more of the microcontroller
I/O pins, and such pins are different for two different hardwares, you
can declare the I/O pins in you routine using
-\newline
+\layout Verse
-\family typewriter
-\newline
+\family typewriter
extern bit SDI;
\newline
extern bit SCLK;
}
\newline
}
-\newline
-
-\newline
+\layout Standard
-\family default
Then, someplace in the code for the first hardware you would use
-\newline
+\layout Verse
-\newline
\family typewriter
bit at 0x80 SDI;\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
/*This is a variable, let the linker allocate this one*/
-\newline
-
-\newline
+\layout Standard
-\family default
Similarly, for the second hardware you would use
-\newline
+\layout Verse
-\newline
\family typewriter
bit at 0x83 SDI;\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
/*This is a variable, let the linker allocate this one*/
-\newline
-
-\newline
+\layout Standard
-\family default
and you can use the same hardware dependant routine without changes, as
for example in a library.
This is somehow similar to sbit, but only one absolute address has to be
specified in the whole project.
-\family typewriter
-
-\newline
-
\layout Subsection
Startup Code