PCWHD IDE COMPILER Custom Computer Services Inc (CCS), PCWHD IDE COMPILER Datasheet - Page 248

PCWHD PIC10,16,18,24, DSPIC

PCWHD IDE COMPILER

Manufacturer Part Number
PCWHD IDE COMPILER
Description
PCWHD PIC10,16,18,24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCWHD IDE COMPILER

For Use With/related Products
Microchip PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC MCUs
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1009
read_adc( ) read_adc2( )
Syntax:
Parameters:
Returns:
Function:
Availability:
Requires:
Examples:
Example Files:
Also See:
234
value = read_adc ([mode])
value = read_adc2 ([mode])
mode is an optional parameter. If used the values may be:
ADC_START_AND_READ (continually takes readings, this is the default)
ADC_START_ONLY (starts the conversion and returns)
ADC_READ_ONLY (reads last conversion result)
Either a 8 or 16 bit int depending on #DEVICE ADC= directive.
This function will read the digital value from the analog to digital converter. Calls to
setup_adc(), setup_adc_ports() and set_adc_channel() should be made
sometime before this function is called. The range of the return value depends on
number of bits in the chips A/D converter and the setting in the #DEVICE ADC=
directive as follows:
Note: x is not defined
Only available on devices with built in analog to digital converters.
Pin constants are defined in the devices .h file.
int16 value;
setup_adc_ports(sAN0|sAN1, VSS_VDD);
setup_adc(ADC_CLOCK_DIV_4|ADC_TAD_MUL_8);
while (TRUE)
{
}
ex_admm.c,
setup_adc(), set_adc_channel(), setup_adc_ports(), #DEVICE,
#DEVICE
ADC=8
ADC=10
ADC=11
ADC=12
ADC=16
set_adc_channel(0);
value = read_adc();
printf(“Pin AN0 A/C value = %LX\n\r”, value);
delay_ms(5000);
set_adc_channel(1);
read_adc(ADC_START_ONLY);
...
value = read_adc(ADC_READ_ONLY);
printf("Pin AN1 A/D value = %LX\n\r", value);
10 bit
00-FF
0-3FF
x
0-FFC
0-FFC0
12 bit
00-FF
0-3FF
0-FFF0
x
0-FFF
ADC Overview

Related parts for PCWHD IDE COMPILER