Hello,
I am very new to PIC microcontroller and very little knowledge.
I am trying to read 2 analog sources (potentiometer and proximity sensor) and convert them to digital values.
All the samples I found are reading from one source.
Could someone point me to the right direction and help me understand how it works.
For example: (say I want to read from A0 and A1 inputs, how do I get two readings?)
Code:
setup_adc(ALL_ANALOG); //sets porta toall analog inputs
set_adc_channel(1); //points a/d at channel 1
delay_ms(5000); //waits 5 seconds
value = read_adc(); //reads value
Thanks in advance,
Kevin
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Fri Mar 12, 2010 12:17 pm
Set the channel. Wait for a short delay (not 5 seconds). Then read
the A/D value into a variable. Example:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum