PCW C Compiler Reference Manual June 2012
Total Page:16
File Type:pdf, Size:1020Kb
PCW C Compiler Reference Manual June 2012 Table of Contents Overview ........................................................................................................................................... 1 PCB, PCM and PCH Overview ..................................................................................................... 1 PCW Overview .............................................................................................................................. 1 Installation ................................................................................................................................... 10 PCB, PCM, PCH, and PCD Installation: ...................................................................................... 10 PCW, PCWH, PCWHD, and PCDIDE Installation: ..................................................................... 10 Technical Support ....................................................................................................................... 10 Directories ................................................................................................................................... 11 File Formats ................................................................................................................................ 11 Invoking the Command Line Compiler ........................................................................................ 12 Program Syntax .............................................................................................................................. 15 Overall Structure ......................................................................................................................... 15 Comment ..................................................................................................................................... 15 Trigraph Sequences .................................................................................................................... 17 Multiple Project Files ................................................................................................................... 17 Multiple Compilation Units ........................................................................................................... 18 Example ...................................................................................................................................... 29 STATEMENTS ................................................................................................................................ 31 Statements ......................................................................................... Error! Bookmark not defined. if .................................................................................................................................................. 32 while ............................................................................................................................................ 33 do ................................................................................................................................................ 33 do-while ....................................................................................................................................... 33 for ................................................................................................................................................ 34 switch .......................................................................................................................................... 34 return ........................................................................................................................................... 35 goto ............................................................................................................................................. 35 label ............................................................................................................................................. 35 break ........................................................................................................................................... 36 continue ....................................................................................................................................... 36 expr ............................................................................................................................................. 36 ; ................................................................................................................................................... 37 stmt ............................................................................................................................................. 37 Expressions .................................................................................................................................... 39 Expressions ................................................................................................................................. 39 Operators .................................................................................................................................... 40 Operator Precedence .................................................................................................................. 41 Reference Parameters ................................................................................................................ 42 Variable Argument Lists .............................................................................................................. 42 Default Parameters ..................................................................................................................... 43 Overloaded Functions ................................................................................................................. 43 DATA DEFINITIONS....................................................................................................................... 45 Basic and Special types .............................................................................................................. 45 Declarations ................................................................................................................................ 48 Non-RAM Data Definitions .......................................................................................................... 48 Using Program Memory for Data ................................................................................................. 50 iii TEST PCW Function Definition....................................................................................................................... 52 Functional Overviews...................................................................................................................... 53 I2C............................................................................................................................................... 53 ADC ............................................................................................................................................. 54 Analog Comparator ..................................................................................................................... 55 CAN Bus ..................................................................................................................................... 56 CCP1 ........................................................................................................................................... 59 CCP2, CCP3, CCP4, CCP5, CCP6............................................................................................. 60 Configuration Memory ................................................................................................................. 60 Data Eeprom ............................................................................................................................... 62 Data Signal Modulator ................................................................................................................. 63 External Memory ......................................................................................................................... 64 General Purpose I/O ................................................................................................................... 65 Internal LCD ................................................................................................................................ 66 Internal Oscillator ........................................................................................................................ 67 Interrupts ..................................................................................................................................... 68 Linker .......................................................................................................................................... 69 Low Voltage Detect ..................................................................................................................... 69 PMP/EPMP ................................................................................................................................. 70 Power PWM ................................................................................................................................ 71 Program Eeprom ........................................................................................................................