1. Trang chủ
  2. » Công Nghệ Thông Tin

C Compiler Reference Manual August 2009 doc

357 2,7K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 357
Dung lượng 2,96 MB

Nội dung

C Compiler Reference Manual August 2009 This manual documents software version 4. Review the readme.txt file in the product directory for changes made since this version. Copyright © 1994, 2009 Custom Computer Services, Inc. All rights reserved worldwide. No part of this work may be reproduced or copied in any form or by any means- electronic, graphic, or mechanical, including photocopying, recording, taping, or information retrieval systems without prior permission. v Table Of Contents Overview 1 PCB, PCM and PCH Overview 1 Installation 1 Technical Support 2 Directories 2 File Formats 3 Invoking the Command Line Compiler 5 PCW Overview 6 Program Syntax 17 Overall Structure 17 Comment 17 Trigraph Sequences 19 Multiple Project Files 19 Multiple Compilation Units 20 Example 22 Statements 23 Statements 23 if 24 while 25 do 25 do-while 25 for 26 switch 26 return 27 goto 27 label 27 break 28 continue 28 expr 28 ; 29 stmt 29 Expressions 31 Expressions 31 Operators 31 operator precedence 33 Reference Parameters 34 Variable Argument Lists 34 Default Parameters 35 Overloaded Functions 36 Data Definitions 37 Basic and Special types 37 Declarations 41 Non-RAM Data Definitions 41 Using Program Memory for Data 43 Function Definition 45 C Compiler Reference Manual August 2009 vi Functional Overviews 47 I2C 47 ADC 48 Analog Comparator 49 CAN Bus 50 CCP1 52 CCP2, CCP3, CCP4, CCP5, CCP6 53 Configuration Memory 53 DAC 54 Data Eeprom 55 External Memory 56 General Purpose I/O 57 Internal LCD 58 Internal Oscillator 59 Interrupts 60 Linker 61 Low Voltage Detect 65 Power PWM 66 Program Eeprom 67 PSP 69 PMP 70 RS232 I/O 71 RTOS 73 SPI 75 Timer0 76 Timer1 77 Timer2 78 Timer3 79 Timer4 79 Timer5 79 USB 80 Voltage Reference 83 WDT or Watch Dog Timer 84 Pre-Processor Directives 85 PRE-PROCESSOR 85 #ASM #ENDASM 87 #BIT 90 #BUILD 91 #BYTE 92 #CASE 93 _DATE_ 93 #DEFINE 94 #DEVICE 95 _DEVICE_ 97 #ERROR 97 #EXPORT (options) 98 __FILE__ 99 __FILENAME__ 99 Table Of Contents vii #FILL_ROM 100 #FUSES 100 #HEXCOMMENT 101 #ID 101 #IF exp #ELSE #ELIF #ENDIF 102 #IFDEF #IFNDEF #ELSE #ELIF 103 #IGNORE_WARNINGS 104 #IMPORT (options) 104 #INCLUDE 106 #INLINE 106 #INT_xxxx 107 #INT_DEFAULT 110 #INT_GLOBAL 111 __LINE__ 111 #LIST 112 #LINE 112 #LOCATE 113 #MODULE 113 #NOLIST 114 #OPT 114 #ORG 115 #OCS 116 __PCB__ 117 __ PCM __ 117 __ PCH __ 118 #PIN_SELECT 118 #PRAGMA 119 #PRIORITY 119 #RESERVE 120 #ROM 120 #SEPARATE 121 #SERIALIZE 122 #TASK 123 __ TIME __ 124 #TYPE 124 #UNDEF 126 #USE DELAY 126 #USE DYNAMIC_MEMORY 127 #USE FAST_IO 128 #USE FIXED_IO 128 #USE I2C 129 #USE RS232 130 #USE RTOS 133 #USE SPI 134 #USE STANDARD_IO 136 #USE TOUCHPAD 136 #WARNING 137 #WORD 138 C Compiler Reference Manual August 2009 viii #ZERO_RAM 138 Built-in-Functions 139 BUILT-IN-FUNCTIONS 139 abs( ) 143 adc_done( ) 143 assert( ) 144 atoe( ) 145 atof( ) 145 atoi( ) atol( ) atoi32( ) 146 bit_clear( ) 147 bit_set( ) 147 bit_test( ) 148 brownout_enable( ) 148 bsearch( ) 149 calloc( ) 150 ceil( ) 150 clear_interrupt( ) 151 dac_write( ) 151 delay_cycles( ) 152 delay_ms( ) 152 delay_us( ) 153 diable_interrupts( ) 154 div( ) ldiv( ) 155 enable_interrupts( ) 156 erase_eeprom 156 erase_program_eeprom( ) 157 exp( ) 157 ext_int_edge( ) 158 fabs( ) 159 floor( ) 159 fmod( ) 160 free( ) 160 frexp( ) 161 get_timerx( ) 161 get_tris_x( ) 162 getc( ) getch( ) getchar( ) fgetc( ) 163 getenv( ) 164 gets( ) fgets( ) 166 goto_address( ) 167 i2c_isr_state( ) 167 i2c_poll( ) 168 I2C_read( ) 169 i2c_slaveaddr( ) 170 i2c_start( ) 170 i2c_stop( ) 171 i2c_write( ) 172 i2c_speed( ) 173 input( ) 173 Table Of Contents ix input_state( ) 174 input_x( ) 175 interrupt_active( ) 175 isalnum(char) isalpha(char) isdigit(char) islower(char) isspace(char) isupper(char) isxdigit(char) iscntrl(x) isgraph(x) isprint(x) ispunct(x) 176  isamong( ) 177 itoa( ) 177 jump_to_isr 178 kbhit( ) 179 label_address( ) 180 labs( ) 180 lcd_load( ) 181 lcd_symbol( ) 181 ldexp( ) 182 log( ) 183 log10( ) 184 longjmp( ) 184 make8( ) 185 make16( ) 185 make32( ) 186 malloc( ) 187 memcpy( ) memmove( ) 187 memset( ) 188 modf( ) 189 _mul( ) 189 nargs( ) 190 offsetof( ) offsetofbit( ) 191 output_x( ) 192 output_bit( ) 193 output_drive( ) 194 output_float( ) 194 output_high( ) 195 output_low( ) 196 output_toggle( ) 196 perror( ) 197 port_x_pullups ( ) 197 pow( ) pwr( ) 198 printf( ) fprintf( ) 199 psp_output_full( ) psp_input_full( ) psp_overflow( ) 201 putc( ) putchar( ) fputc( ) 202 puts( ) fputs( ) 203 qsort( ) 204 rand( ) 205 read_adc( ) 205 read_bank( ) 206 read_calibration( ) 207 read_configuration_memory( ) 208 read_eeprom( ) 208 C Compiler Reference Manual August 2009 x read_program_eeprom( ) 209 read_program_memory( ) read_external_memory( ) 209 realloc( ) 210 reset_cpu( ) 211 restart_cause( ) 211 restart_wdt( ) 212 rotate_left( ) 213 rotate_right( ) 213 rtos_await( ) 214 rtos_disable( ) 214 rtos_enable( ) 215 rtos_msg_poll( ) 215 rtos_msg_read( ) 216 rtos_msg_send( ) 216 rtos_overrun( ) 217 rtos_run( ) 217 rtos_signal( ) 218 rtos_stats( ) 218 rtos_terminate( ) 219 rtos_wait( ) 219 rtos_yield( ) 220 set_adc_channel( ) 220 set_adc_channel( ) 221 set_power_pwmx_duty( ) 221 set_power_pwm_override( ) 222 set_pwm1_duty( ) set_pwm2_duty( ) set_pwm3_duty( ) set_pwm4_duty( ) set_pwm5_duty( ) 223  set_rtcc( ) set_timer0( ) set_timer1( ) set_timer2( ) set_timer3( ) set_timer4( ) set_timer5( ) 224  set_timerx( ) 225 set_tris_x( ) 225 set_uart_speed( ) 226 setjmp( ) 227 setup_adc(mode) 227 setup_adc_ports( ) 228 setup_ccp1( ) setup_ccp2( ) setup_ccp3( ) setup_ccp4( ) setup_ccp5( ) setup_ccp6( ) 229 setup_comparator( ) 231 setup_counters( ) 231 setup_dac( ) 232 setup_external_memory( ) 233 setup_lcd( ) 233 setup_low_volt_detect( ) 234 setup_oscillator( ) 235 setup_opamp1( ) setup_opamp2( ) 235 setup_power_pwm( ) 236 setup_power_pwm_pins( ) 237 setup_pmp(option,address_mask) 238 setup_qei( ) 239 [...]... source codes structural and textual complexities using Halstead and McCabe metrics .TRE The tree file shows the call tree It details each function and what functions it calls along with the ROM and RAM usage for each function 3 C Compiler Reference Manual August 2009 HEX The compiler generates standard HEX files that are compatible with all programmers .COF This is a binary containing machine code... the compilations are done in a batch file it may be useful to terminate the batch run on the first error The +CC command line option will cause the compiler to return a windows error code if the compilation fails This can be tested in the batch file like this: "c: \program files\picc\ccsc"+FM +CC +EXPORT report .c if not errorlevel 1 goto abort goto end :abort echo COMPILE ERROR :end 21 C Compiler Reference. .. PCM ) // preprocessor directive that chooses the compiler #include // preprocessor directive that selects the chip PIC16F877 #fuses HS,NOWDT,NOPROTECT,NOLVP // preprocessor directive that defines fuses for the chip #use delay(clock=20000000) // preprocessor directive that specifies the clock speed #use rs232(baud=9600, xmit=PIN _C6 , rcv=PIN _C7 ) // preprocessor directive that includes the rs232... separate compilers PCB is for 12-bit opcodes, PCM is for 14-bit opcodes, and PCH is for 16-bit opcode PIC® microcontrollers Due to many similarities, all three compilers are covered in this reference manual Features and limitations that apply to only specific microcontrollers are indicated within These compilers are specifically designed to meet the unique needs of the PIC® microcontroller This allows... files can be included using this method to automatically link them For example: if you have main .c, x .c, x.h, y .c, y.h and z .c and z.h files in your project, you can say in: main .c #include x .c y .c #include #include z .c #include #include #include #include In this example there are 8 files and one compilation unit Main .c is the only file compiled... +J +DC +Y9 -T -A +M +LNlst +O8hex -P -Z If @filename appears on the CCSC command line, command line options will be read from the specified file Parameters may appear on multiple lines in the file If the file CCSC.INI exists in the same directory as CCSC.EXE, then command line parameters are read from that file before they are processed on the command line Examples: CCSC +FM C: \PICSTUFF\TEST .C CCSC +FM... project so that all include files become known for compilation Close all files associated with project Ability to search all files for specific text string 7 C Compiler Reference Manual August 2009 Edit Menu Ribbon Undo Undoes the last deletion Redo Re-does the last undo Cut Moves the selected text from the file to the clipboard Copy Copies the selected text to the clipboard Paste Applies the clipboard... files that can be included in the main C file to group the related functions by their category CCS C also requires to include the appropriate device file using #include directive to include the device specific functionality There are also some preprocessor directives like #fuses to specify the fuses for the chip and #use delay to specify the clock speed The functions contain the data declarations,definitions,statements... programs you wish to install and follow the on-screen instructions 1 C Compiler Reference Manual August 2009 Technical Support Compiler, software, and driver updates are available to download at: http://www.ccsinfo.com/download Compilers come with 30 or 60 days of download rights with the initial purchase One year maintenance plans may be purchased for access to updates as released The intent of new... ignored Characters after a // up to the end of the line are ignored Comments for Documentation GeneratorThe compiler recognizes comments in the source code based on certain markups The compiler recognizes these special types of comments that can be later exported for use in the documentation generator The documentation generator utility uses a user selectable template to export these comments and create . 43 Function Definition 45 C Compiler Reference Manual August 2009 vi Functional Overviews 47 I 2C 47 ADC 48 Analog Comparator 49 CAN Bus 50 CCP1 52 CCP2, CCP3, CCP4, CCP5, CCP6 53 Configuration. 227 setup_adc(mode) 227 setup_adc_ports( ) 228 setup_ccp1( ) setup_ccp2( ) setup_ccp3( ) setup_ccp4( ) setup_ccp5( ) setup_ccp6( ) 229 setup_comparator( ) 231 setup_counters( ) 231 setup_dac( ) 232 setup_external_memory(. PCW, PCWH, PCWHD, and PCDIDE Installation: Insert the CD ROM, select each of the programs you wish to install and follow the on-screen instructions. 1 C Compiler Reference Manual

Ngày đăng: 02/04/2014, 10:20

TỪ KHÓA LIÊN QUAN

w