07.04.2013 Views

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.1 INTRODUCTION<br />

5.2 HIGHLIGHTS<br />

<strong>MPLAB</strong> ® C COMPILER FOR<br />

<strong>PIC24</strong> <strong>MCUs</strong> AND <strong>dsPIC</strong> ® <strong>DSCs</strong><br />

USER’S GUIDE<br />

Chapter 5. Data Types<br />

This section discusses the <strong>MPLAB</strong> C <strong>Compiler</strong> <strong>for</strong> <strong>PIC24</strong> <strong>MCUs</strong> <strong>and</strong> <strong>dsPIC</strong> ® <strong>DSCs</strong><br />

(<strong>for</strong>merly <strong>MPLAB</strong> C30) data types.<br />

Items discussed in this chapter are:<br />

• Data Representation<br />

• Integer<br />

• Floating Point<br />

• Pointers<br />

5.3 DATA REPRESENTATION<br />

5.4 INTEGER<br />

Multibyte quantities are stored in “little endian” <strong>for</strong>mat, which means:<br />

• The least significant byte is stored at the lowest address<br />

• The least significant bit is stored at the lowest-numbered bit position<br />

As an example, the long value of 0x12345678 is stored at address 0x100 as follows:<br />

0x100 0x101 0x102 0X103<br />

0x78 0x56 0x34 0x12<br />

As another example, the long value of 0x12345678 is stored in registers w4 <strong>and</strong> w5:<br />

w4 w5<br />

0x5678 0x1234<br />

Table 5-1 shows integer data types are supported in the compiler.<br />

TABLE 5-1: INTEGER DATA TYPES<br />

Type Bits Min Max<br />

char, signed char 8 -128 127<br />

unsigned char 8 0 255<br />

short, signed short 16 -32768 32767<br />

unsigned short 16 0 65535<br />

int, signed int 16 -32768 32767<br />

unsigned int 16 0 65535<br />

long, signed long 32 -2 31<br />

2 31 - 1<br />

unsigned long 32 0 2 32 - 1<br />

long long**, signed long long** 64 -2 63<br />

2 63 - 1<br />

unsigned long long** 64 0 2 64 ** ANSI-89 extension<br />

- 1<br />

© 2008 <strong>Microchip</strong> Technology Inc. DS51284H-page 79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!