SW006010 Microchip Technology, SW006010 Datasheet - Page 27

no-image

SW006010

Manufacturer Part Number
SW006010
Description
MPLAB 17C SOFTWARE
Manufacturer
Microchip Technology
Datasheets

Specifications of SW006010

Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC17C
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
MPLAB®
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
 2002 Microchip Technology Inc.
Differences Between MPLAB C17 and ANSI C
2.6.9.2
If the value being returned is 8 bits wide, it is returned in
returned in the
2.6.10
The MPLAB C17 compiler supports all of the standard C operators.
2.6.11
A
The switch statement has two limitations:
• The
• The
2.6.12
EXAMPLE 2-1:
Because the PICmicro MCU family of microcontrollers uses separate program
memory and data memory address busses in their design, MPLAB C17 requires ANSI
extensions to distinguish between data located in ROM and data located in RAM. The
ANSI/ISO C standard allows for code and data to be in separate address spaces, but
this is not sufficient to locate data in the code space as well. To this purpose, MPLAB
C17 introduces the
identifiers just as the
The primary use of ROM data is for static strings. In keeping with this, MPLAB C17
automatically places all string literals in ROM. This type of a string literal is “array of
char located in ROM.”
When using MPLAB C17, a string table in program memory can be declared as:
rom const char table[][20] =
rom const char *rom table2[] = { “string 1”, “string 2”,
The declaration of
long, and so takes 40 words of program memory.
pointers to ROM. The
well. All of the strings in
so
efficient than accesses to
indirection required by the pointer.
An important consequence of the separate ROM and RAM address spaces for
MPLAB C17 is that pointers to data in ROM and pointers to data in RAM are not
compatible. That is, two pointer types are not compatible unless they point to objects
of compatible types and the objects they point to are located in the same address
space. For example, a pointer to a string in ROM and a pointer to a string in RAM are
not compatible because they refer to different address spaces. To copy data from
ROM to RAM, an explicit copy is required. For simple types, this entails only a simple
assignment, but for arrays and other complex data-types it may require more.
Note: At this time, you should use manual pointer arithmetic. See the file
switch
table2
switch
case
statement is functionally equivalent to multiple
README.C17
RETURNING VALUES FROM FUNCTIONS
Operators
switch Statement
Initializing Arrays
takes 3*4 = 12 words of program memory. Accesses to
values must be constant values.
expression must be an 8-bit integer data type
WREG/FSR1
table
rom
INITIALIZING ARRAYS
const
rom
for more information.
and
table2
declares an array of four strings that are each 20 characters
table
qualifier after the * places the array of pointers in ROM as
and
ram
pair. Otherwise, it is returned on the software stack.
are 3 words long, and the array is four elements long,
, however, because of the additional level of
volatile
qualifiers. Syntactically, these qualifiers bind to
{ “string 1”, “string 2”,
“string 3”, “string 4” };
“string 3”, “string 4” };
qualifiers do in strict ANSI C.
table2
WREG
if-else
is declared as an array of
. If it is 16 bits wide, it is
table2
statements.
apRNOVM^-page 21
may be less
Part
Part
Part
Part
1
2
3
4

Related parts for SW006010