DAC

( IUT de Cachan - Version 12/2011 )
The available functions are :
void adc_init(char numero_dernier_canal);
///////////////////////////////////////////////////////////////////////////////
// Function name : adc_init
// Return value : none
// Parameters : char last_channel_number
// integer value between 0 and 7, number of the last channel
// configured as analog input
// Description: configuration of the ADC on the range 0-5V
// and the choice of the last analog channel
// 0 indicates only AN0 analog
// 7 indicates AN0, AN1,...,AN7 analog
///////////////////////////////////////////////////////////////////////////////
Initialization of the ADC, by specifying the number of the last analog channel used
adc_init(0); activates only a channel : AN0.
adc_init(3); activates 4 channels : AN0, AN1, AN2 et AN3
This function allows the user a maximum of 8 channels : adc_init(7);
int adc_read(char numero_channel);
///////////////////////////////////////////////////////////////////////////////
// Function name : adc_read
// Return value : int => valeur lue 10 bits
// Parameters : char channel_number
// Integer value between 0 and 7, number of channel to convert
// Description : selection of an analog channel
// wait for the end of the conversion
// return of the read value, on 10 bits
// conversion period : about 25us
///////////////////////////////////////////////////////////////////////////////
This function reads the converted value on an analog channel
Pins are configured in analog mode through par adc_init
Conversion period : about 25 us
Pin | Analog channel |
A0 | AN0 |
A1 | AN1 |
A2 | AN2 |
A3 | AN3 |
A5 | AN4 |
E0 | AN5 |
E1 | AN6 |
E2 | AN7 |
For more information, refer to p18f4550_39632e.pdf §21