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.

Built-in Functions<br />

delay_cycles( )<br />

Syntax:<br />

delay_cycles (count)<br />

Parameters: count - a constant 1-255<br />

Returns:<br />

Function:<br />

undefined<br />

Creates code to perform a delay of the specified number of instruction clocks<br />

(1-255). An instruction clock is equal to four oscillator clocks.<br />

The delay time may be longer than requested if an interrupt is serviced during<br />

the delay. The time spent in the ISR does not count toward the delay time.<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

All devices<br />

Nothing<br />

delay_cycles( 1 ); // Same as a NOP<br />

delay_cycles(25); // At 20 mhz a 5us delay<br />

ex_cust.c<br />

delay_us(), delay_ms()<br />

delay_ms( )<br />

Syntax:<br />

delay_ms (time)<br />

Parameters: time - a variable 0-65535(int16) or a constant 0-65535<br />

Note: Previous compiler versions ignored the upper byte of an int16, now the<br />

upper byte affects the time.<br />

Returns:<br />

Function:<br />

undefined<br />

This function will create code to perform a delay of the specified length. Time<br />

is specified in milliseconds. This function works by executing a precise<br />

number of instructions to cause the requested delay. It does not use any<br />

timers. If interrupts are enabled the time spent in an interrupt routine is not<br />

counted toward the time.<br />

The delay time may be longer than requested if an interrupt is serviced during<br />

the delay. The time spent in the ISR does not count toward the delay time.<br />

171

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

Saved successfully!

Ooh no, something went wrong!