adc16_set_channel

Pico ADC-16

adc16_set_channel

Top  Previous  Next

 

void adc16_set_channel (

       unsigned short int port,

       unsigned short int channel,

       unsigned short int resolution,

       unsigned short int single_ended,

       unsigned short int filter_factor);

 

You should call this routine once for each channel that you would like to take readings from. You can do this any time after calling adc16_driver_open. It is permissible to change the settings as and when required.

The fewer channels are selected, the more frequently these channels will be updated: it takes about  1 second per active channel.

Arguments:

port specifies which serial port you wish to define a channel for.

channel specifies which channel you want to set the details for.  It should be 1..8 for single-ended or 1,3,5,7 for differential.

 

The resolution specifies the conversion accuracy: it should be between 8 bits and 16 bits. See appendix A for the conversion times at each resolution.

single_ended specifies whether to use the channel as a single-ended input, or to use the channel together with the next channel as a differential input. single_ended = FALSE is valid only for odd-numbered channels.

filter_factor controls the time constant of the filter. Each time the driver takes a reading from this channel, it updates the filtered value by adding a proportion of the difference between the measured and filtered values. The filter_factor sets the proportion that is added.

 

The filter_factor must be between 1 and 100. A filter_factor of 1 means add all of the difference (effectively no filtering) and 100 means add 1/100 of the difference (very slow filtering). A factor of 10 gives a time constant of about a minute when all channels are selected.

The effective resolution is increased by the filter_factor, and the noise floor is reduced by approximately the square root of the filter_factor.