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

ADC_CLOCK_DIV_32<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

undefined<br />

Configures the analog to digital converter.<br />

Only the devices with built in analog to digital converter.<br />

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

setup_adc_ports( ALL_ANALOG );<br />

setup_adc(ADC_CLOCK_INTERNAL );<br />

set_adc_channel( 0 );<br />

value = read_adc();<br />

setup_adc( ADC_OFF );<br />

ex_admm.c<br />

setup_adc_ports(), set_adc_channel(), read_adc(), #DEVICE, ADC<br />

Overview,<br />

see header file for device selected<br />

setup_adc_ports( )<br />

Syntax:<br />

setup_adc_ports (value)<br />

setup_adc_ports (ports, [reference])<br />

Parameters: value - a constant defined in the devices .h file<br />

ports - is a constant specifying the ADC pins to use<br />

reference - is an optional constant specifying the ADC reference to use<br />

By default, the reference voltage are Vss and Vdd<br />

Returns:<br />

Function:<br />

undefined<br />

Sets up the ADC pins to be analog, digital, or a combination and the voltage<br />

reference to use when computing the ADC value. The allowed analog pin<br />

combinations vary depending on the chip and are defined by using the bitwise OR<br />

to concatenate selected pins together. Check the device include file for a complete<br />

list of available pins and reference voltage settings. The constants ALL_ANALOG<br />

and NO_ANALOGS are valid for all chips. Some other example pin definitions are:<br />

Also See:<br />

setup_adc(), read_adc(), set_adc_channel(), ADC Overview<br />

281

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

Saved successfully!

Ooh no, something went wrong!