Kod: Markera allt
const rom unsigned char d_b_c[] = {..........}
Så här skriver uChip i MCC18 ug:
samt2.7.3 String Constants
The primary use of data located in program memory is for static strings. In keeping
with this, MPLAB C18 automatically places all string constants in program memory.
This type of a string constant is “array of char located in program memory”, (const
rom char []). The .stringtable section is a romdata (see 2.9.1 “#pragma
sectiontype”) section that contains all constant strings. For example the string
“hello” in the following would be located in the .stringtable section:
strcmppgm2ram (Foo, “hello”);
Due to the fact that constant strings are kept in program memory, there are multiple
versions of the standard functions that deal with strings. For example, the strcpy
function has four variants, allowing the copying of a string to and from data and
program memory
Så varför i h-te har mcc18 fått för sig att placera romdata i idata-sektionen.The rom keyword tells the compiler that a variable should be placed in program
memory. The compiler will allocate this variable into the current romdata type section.