Description
Synchronous read of all 10 bits of analog channelPIC's such as the 16F876 have a built-in Analog to Digital Convertor (ADC). The ADC is connected to the outside world through analog input pins. These pins share functions with other peripherals. Before they can be used as analog inputs they must be configured as analog inputs using the ADC_init function.
The PIC ADC is 10 bits wide this means that an analog input can be digtised and read as a value between 0 and 1023.
This function reads the selected analog input channel using the 10 bit ADC and returns it as a 16 bit word.
Definition
ubyte ADC_read_10bit(ubyte channel_id)Library
LIB/adc_lib.basUsage
On entry:channel_id is the id of the analog channel to read. This corresponds to the PIC pin labelled ANj where channel_id is the index j and is in the range 0 to 7 (inclusive)On exit:e.g. if channel_id is 0 then pin AN0 (pin 2 of the 16f876) is read if channel_id is 4 then pin AN4 (pin 7 of the 16f876) is readsee ADC configuration for a more detailed description
return all 10 bits of ADC
return immediately with 0 is the channel is invalid