NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Reading from Multiple ADC sources.
August 23, 2011 by Twarter369 |
I am trying to set up the ADC converter to work on PC5 then PC4 Basically I want to average both and then compare those averages. Specifically, how do I tell ADSC which input to read from? Does anyone have a code example for this? I am currently trying to build a Photovore Robot, if that helps at all. |
---|---|
August 23, 2011 by Twarter369 |
Nevermind, I found it! "MUX0 to MUX3 are used to select which input channel you wish to read." |
August 24, 2011 by bretm |
If you just need to compare voltages you could use the analog comparator instead of the ADC but it doesn't do averaging. |
August 24, 2011 by Twarter369 |
Thanks, I am not sure which of those methods would give me a better read? Could you show an example of using the Comparator two compare two voltage sources? Even though I know the different Registers for the different pins I am having trouble figuring out how to control where the ADSC is reading from. Do I switch the bit patter by assigning it a binary value such as
or something like
|
August 24, 2011 by Twarter369 |
okay, I think this will handle the problem:
let me know if there is a more efficient way to do it (or any glaring holes in my logic) |
Please log in to post a reply.
Did you know that a thermometer can be made "faster" by using a bit of math? Learn more...
|