Documents

cc5x-35.pdf

Categories
Published
of 119
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Description
CC5X C Compiler for the PICmicro Devices Version 3.5 User's Manual B Knudsen Data Trondheim - Norway CC5X C Compiler B Knudsen Data 2 This manual and the CC5X compiler is protected by Norwegian copyright laws and thus by corresponding copyright laws agreed to internationally by mutual consent. The manual and the compiler may not be copied, partially or as a whole without written consent from the aut
Transcript
  CC5X C Compiler for thePICmicro Devices Version 3.5 User's Manual B Knudsen DataTrondheim - Norway  CC5X C Compiler B Knudsen Data 2This manual and the CC5X compiler is protected by Norwegian copyright laws and thus bycorresponding copyright laws agreed to internationally by mutual consent. The manual and the compiler may not be copied, partially or as a whole without written consent from the author. The PDF-edition of the manual can be printed to paper for private or local use, but not for distribution. Modification of themanual or the compiler is strongly prohibited. All rights reserved.  LICENSE AGREEMENT: By using the CC5X compiler, you agree to be bound by this agreement.Only one person may use a licensed edition of the CC5X compiler at the same time for each user license.If more than one person wants to use the compiler for each user license, then this has to be done by somemanual handshaking procedure (not electronic automated), for example by exchanging a printed copy of the CC5X User's Manual as a permission key. A site license allows an unlimited number of users withinthe same administration unit.You may make backup copies of the software, and copy it to multiple computers. You may not distributecopies of the compiler to others. B Knudsen Data assumes no responsibility for errors or defects in thedocumentation or in the compiler. This also applies to problems caused by such errors.Copyright © B Knudsen Data, Trondheim, Norway, 1992 - 2014This manual covers CC5X version 3.5 and related topics. New versions may contain changes without prior notice.Microchip and PICmicro are trademarks of Microchip Technology Inc., Chandler, AZ, U.S.A. COMPILER BUG REPORTS: The compiler has been carefully tested and debugged. It is, however, not possible to guarantee a 100 %error free product.If the compiler generates application code bugs, it is almost always possible to rewrite the programslightly in order to avoid the bug. #pragma optimize  can be used to avoid optimization bugs. Other  #pragma  statements are also useful.Please report cases of bad generated code and other serious program errors.1)   Investigate and describe the problem. If possible, please provide a complete C example program thatdemonstrates the problem. A fragment from the generated assembly file is sometimes enough.2)   This service is intended for difficult compiler problems (not application problems).3)   Language: English4)   State the compiler version.5)   Send your report to support@bknd.com.Document version: J  CC5X C Compiler B Knudsen Data 3 CONTENTS 1 INTRODUCTION..................................................................................................................................8 1.1 S UPPORTED DEVICES ..........................................................................................................................91.2 I  NSTALLATION AND S YSTEM R  EQUIREMENTS ....................................................................................9 Support for long file names ..................................................................................................................9User interface.......................................................................................................................................9 1.3 MPLAB S UPPORT ............................................................................................................................101.4 S UMMARY OF D ELIVERED F ILES ......................................................................................................101.5 S HORT P ROGRAM E XAMPLE .............................................................................................................111.6 D EFINING THE PIC MICRO D EVICE ....................................................................................................121.7 W HAT TO DO NEXT ...........................................................................................................................13 2 VARIABLES.........................................................................................................................................14 2.1 I  NFORMATION ON RAM ALLOCATION ..............................................................................................142.2 D EFINING V ARIABLES ......................................................................................................................15  Integer variables.................................................................................................................................15Floating point.....................................................................................................................................16  IEEE754 interoperability ...................................................................................................................16 Fixed point variables..........................................................................................................................17  Assigning variables to RAM addresses...............................................................................................19Supported type modifiers....................................................................................................................20 Local variables...................................................................................................................................21Temporary variables ..........................................................................................................................22 Arrays, structures and unions.............................................................................................................22 Large arrays on the Enhanced 14 bit core.........................................................................................23 Bitfields...............................................................................................................................................23Typedef...............................................................................................................................................23 2.3 U SING RAM B ANKS .........................................................................................................................23 The bank type modifier.......................................................................................................................24 RAM bank selection bits.....................................................................................................................25 Manual bank bit update regions.........................................................................................................25 2.4 P OINTERS .........................................................................................................................................25 Pointer models....................................................................................................................................26 The 12 bit Core...................................................................................................................................26 The 14 bit core: the IRP bit................................................................................................................28 2.5 C ONST D ATA S UPPORT .....................................................................................................................29 Storing 14 bit data..............................................................................................................................29 Data of size 16 bits or more ...............................................................................................................30Code pages.........................................................................................................................................30 Locating Const Data ..........................................................................................................................30 Merging data......................................................................................................................................31 Examples ............................................................................................................................................31 3 SYNTAX................................................................................................................................................32 3.1 S TATEMENTS ....................................................................................................................................32 if statement .........................................................................................................................................32while statement...................................................................................................................................32 for statement.......................................................................................................................................32do statement........................................................................................................................................33switch statement..................................................................................................................................33break statement...................................................................................................................................33continue statement..............................................................................................................................34return statement..................................................................................................................................34  CC5X C Compiler B Knudsen Data 4 goto statement.....................................................................................................................................34 3.2 A SSIGNMENT AND C ONDITIONS .......................................................................................................34 Special syntax examples.....................................................................................................................34Conditions ..........................................................................................................................................35 Bit variables .......................................................................................................................................35 Multiplication, division and modulo...................................................................................................36 Precedence of C operators.................................................................................................................36  Mixed variable sizes are allowed .......................................................................................................37  3.3 C ONSTANTS ......................................................................................................................................37 Constant expressions..........................................................................................................................37  Enumeration.......................................................................................................................................38 3.4 F UNCTIONS .......................................................................................................................................38 Function return values .......................................................................................................................38Parameters in function calls...............................................................................................................38 Internal functions ...............................................................................................................................39 3.5 T YPE C AST .......................................................................................................................................393.6 A CCESSING P ARTS OF A V ARIABLE ..................................................................................................413.7 C E XTENSIONS .................................................................................................................................413.8 P REDEFINED S YMBOLS .....................................................................................................................42  Extensions to the standard C keywords..............................................................................................42Standard C keywords used .................................................................................................................42The sizeof operator.............................................................................................................................43Function offsetof( struct_type, struct_member)..................................................................................43 Automatically defined macros and symbols .......................................................................................43 Macros __FILE__ and __LINE__......................................................................................................44 Macros __DATE__ and __TIME__....................................................................................................44 3.9 U PWARD C OMPATIBILITY .................................................................................................................44 4 PREPROCESSOR DIRECTIVES......................................................................................................45 #define................................................................................................................................................45 Macro concatenation..........................................................................................................................45 Macro stringification..........................................................................................................................45#include..............................................................................................................................................46 #undef.................................................................................................................................................46 #if........................................................................................................................................................46 #ifdef...................................................................................................................................................47 #ifndef.................................................................................................................................................47 #elif.....................................................................................................................................................47 #else....................................................................................................................................................47 #endif..................................................................................................................................................47 #error .................................................................................................................................................47 #warning.............................................................................................................................................48#message ............................................................................................................................................48 4.1 T HE PRAGMA S TATEMENT ................................................................................................................48 #pragma alignLsbOrigin <a> [ to <b>]...........................................................................................48#pragma asm2var 1............................................................................................................................48#pragma assert [/] <type> <text field>.............................................................................................48#pragma assume *<pointer> in rambank <n> .................................................................................48#pragma bit <name> @ <N.B or variable[.B]>...............................................................................48#pragma cdata[ADDRESS] = <VXS>, .., <VXS>...........................................................................49#pragma char <name> @ <constant or variable>...........................................................................49#pragma chip [=] <device> ..............................................................................................................49#pragma codepage [=] <0,1,2,3, ..15>.............................................................................................49#pragma computedGoto [=] <0,1,2>................................................................................................50#pragma config [<id>] = <state> [, <id> = <state>] ....................................................................50#pragma config_def [=] <value>......................................................................................................50
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks