17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

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

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

profile versus in-circuit debugging is that a program written with profile support enabled will run<br />

correctly even if there is no ICD connected.<br />

In order to use Code Profiling, several functions and pre-processor statements need to be<br />

included in the project being compiled and profiled. Doing this adds the proper code profile<br />

run-time support on the microcontroller.<br />

See the help file in the Code Profile tool for more help<br />

and usage examples.<br />

Relevant Functions:<br />

profileout()<br />

Relevant Pre-Processor:<br />

#use profile()<br />

#profile<br />

Relevant Interrupts:<br />

Relevant Include Files:<br />

Relevant getenv():<br />

Example Code:<br />

Send a user specified message or variable to be displayed or<br />

logged by the code profile tool.<br />

Global configuration of the code profile run-time on the<br />

microcontroller.<br />

Dynamically enable/disable specific elements of the profiler.<br />

The profiler can be configured to use a microcontroller's<br />

internal timer for more accurate timing of events over the<br />

clock on the PC. This timer is configured using the #profile<br />

pre-processor command.<br />

None – all the functions are built into the compiler.<br />

None<br />

#include <br />

#use delay(crystal=10MHz, clock=40MHz)<br />

#profile functions, parameters<br />

void main(void)<br />

{<br />

int adc;<br />

setup_adc(ADC_CLOCK_INTERNAL);<br />

set_adc_channel(0);<br />

}<br />

for(;;)<br />

{<br />

adc = read_adc();<br />

profileout(adc);<br />

delay_ms(250);<br />

}<br />

48

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

Saved successfully!

Ooh no, something went wrong!