Hi,
I have a multi Tabs sketch, and there are more than one tabs used ADC.
The pictures show the layout of the ADC in 'MAIN' and Tab1.
The 'MAIN's ADC trig works fine (A4 to GND), and the Tab1's never trigged (A6 input Voltage), why?
Thanks for help.
Adam
Did your code work with only one tab?
Maybe because after you do the ADC setup for Tab1 you change the ADC setup for MAIN? Are you trying to ask the ADC to do two different things at the same time?!? It would be easier to follow if all of the ADC setup was in one place.
Thanks.
There are two independent use of ADC at different time and input pin, and in two files.
I don't know if I can setup ADC in only 'MAIN'?
Your ATmega has only one ADC.
The same ADC is used even if the tabs are separated.
No matter how you divide code, the last setting you executed overwrites everything.
If you are thinking of using ADC and AC instead of two ADCs.
ATmega analog multiplexers can only be used for either ADC or AC.
Thanks,
How to solve this can take care of two applications please?
Such a microcontroller doesn't work like a PC.
Basically they don't have an OS and there is no concept of an application.
You can only do one thing at a time, so you have to achieve pseudo-multitasking with coding yourself.
Thanks.
Hi,
I got more questions:
- one file used ADC external reference voltage applied to the AREF pin, a Tab used ADC internal voltage reference, how to deal with this?
- I have two inputs to ADC at different pin, and actually input at different time, but how the code shown that in sequentially rather than simultaneously?
Thanks
You can't. If you apply a voltage to the AREF pin it will be shorted to whatever internal reference you select. You can either have an EXTERNAL reference or you can switch between the INTERNAL references but you can't use both EXTERNAL and INTERNAL in the same sketch.
Thank you.
Is that a good idea to use a relay on/off the AREF? OR it it possible to change the built-in reference number, say INTERNAL2V56 to INTERNAL2V?
What is the exact Arduino model name you are using?
Thanks.
My board is UNO.
I added: analogReference(EXTERNAL);
it doesn't take internal reference, why?
Please show all the compilable code and your UNO connection, the figure can be handwritten.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.