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 />

Returns:<br />

Function:<br />

Availability:<br />

Requires<br />

Examples:<br />

Example Files:<br />

undefined<br />

Sets the analog comparator module. The above constants have four parts<br />

representing the inputs: C1-, C1+, C2-, C2+<br />

This function is only available on devices with an analog comparator.<br />

Constants are defined in the devices .h file.<br />

// Sets up two independent comparators (C1 and C2),<br />

// C1 uses A0 and A3 as inputs (- and +), and C2<br />

// uses A1 and A2 as inputs<br />

setup_comparator(A0_A3_A1_A2);<br />

ex_comp.c<br />

Also See:<br />

Analog Comparator overview<br />

setup_counters( )<br />

Syntax:<br />

setup_counters (rtcc_state, ps_state)<br />

rtcc_state may be one of the constants defined in the devices .h file. For<br />

example: RTCC_INTERNAL, RTCC_EXT_L_TO_H or RTCC_EXT_H_TO_L<br />

Parameters:<br />

Returns:<br />

Function:<br />

ps_state may be one of the constants defined in the devices .h file.<br />

For example: RTCC_DIV_2, RTCC_DIV_4, RTCC_DIV_8, RTCC_DIV_16,<br />

RTCC_DIV_32, RTCC_DIV_64, RTCC_DIV_128, RTCC_DIV_256,<br />

WDT_18MS, WDT_36MS, WDT_72MS, WDT_144MS, WDT_288MS,<br />

WDT_576MS, WDT_1152MS, WDT_2304MS<br />

undefined<br />

Sets up the RTCC or WDT. The rtcc_state determines what drives the RTCC.<br />

The PS state sets a prescaler for either the RTCC or WDT. The prescaler will<br />

lengthen the cycle of the indicated counter. If the RTCC prescaler is set the<br />

WDT will be set to WDT_18MS. If the WDT prescaler is set the RTCC is set to<br />

RTCC_DIV_1.<br />

This function is provided for compatibility with older versions. setup_timer_0<br />

and setup_WDT are the recommended replacements when possible. For <strong>PCB</strong><br />

devices if an external RTCC clock is used and a WDT prescaler is used then<br />

this function must be used.<br />

285

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

Saved successfully!

Ooh no, something went wrong!