17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Functional Overview<br />

Relevant Preprocessor:<br />

None<br />

Relevant Interrupts :<br />

INT_CCP1<br />

Interrupt fires when capture or compare on CCP1<br />

Relevant Include Files:<br />

None, all functions built-in<br />

Relevant getenv() parameters:<br />

CCP1<br />

Returns 1 if the device has CCP1<br />

Example Code:<br />

#int_ccp1<br />

void isr()<br />

{<br />

rise = CCP_1;<br />

//CCP_1 is the time the pulse went high<br />

fall = CCP_2;<br />

//CCP_2 is the time the pulse went low<br />

pulse_width = fall - rise; //pulse width<br />

}<br />

..<br />

setup_ccp1(CCP_CAPTURE_RE); // Configure CCP1 to capture rise<br />

setup_ccp2(CCP_CAPTURE_FE); // Configure CCP2 to capture fall<br />

setup_timer_1(T1_INTERNAL); // Start timer 1<br />

Some chips also have fuses which allows to multiplex the ccp/pwm on different pins. So check<br />

the fuses to see which pin is set by default. Also fuses to enable/disable pwm outputs.<br />

CCP2, CCP3, CCP4, CCP5, CCP6<br />

Similar to CCP1<br />

Code Profile<br />

Profile a program while it is running. Unlike in-circuit debugging, this tool grabs information<br />

while the program is running and provides statistics, logging and tracing of it's execution. This<br />

is accomplished by using a simple communication method between the processor and the ICD<br />

with minimal side-effects to the timing and execution of the program. Another benefit of code<br />

47

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

Saved successfully!

Ooh no, something went wrong!