ADC_read_8bit_nowait

Description

This function completes the 8 bit asynchronous read of the selected analog channel.

This function is the third of three functions that must be used to perform the asynchronous equivalent of the synchronous ADC_read_8bit function.

See ADC_read_8bit for a more detailed discussion of reading the ADC as an 8 bit value.

Definition

ubyte ADC_read_8bit_nowait(ubyte channel_id)

Library

LIB/adc_lib.bas

Usage

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)
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 read

see ADC configuration for a more detailed description

On exit:
return most significant 8 bits of ADC
return immediately with 0 is the channel is invalid

Example of use


	ADC_start_read_8bit_nowait(bit_id)

	while ADC_service_nowait() == 0 do
		task_wait 1
	done

	val = ADC_read_8bit_nowait(bit_id)