ADC Channels pulling relatively same values

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

ADC Channels pulling relatively same values

Postby Steven_SS » Wed Mar 27, 2019 9:00 pm

In Flowcode V8, on my atmega2560 I am pulling in values from each analog input(0-3). I am reading the adc for its corresponding channel(correctly). But when I am looking at-as an example-the first one(PF0), and it gives me 512, all the other channels follow similarly to that like their connected to the first channel. WHICH THEIR NOT, their supposed to be independent from each other.
The attachment below is how I am doing it for each channel. I have a component per channel(PF0-PF3). I have also tried just using one and re-setting the channels as I move on. No luck. I can't find anywhere in the forum or online that can help me with this.

What do I have to do to get these channel's readings all independent!?
Attachments
Read_Analog_Input.PNG
Read_Analog_Input.PNG (20.63 KiB) Viewed 569 times
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

User avatar
Benj
Matrix Staff
Posts: 14150
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4078 times
Contact:

Re: ADC Channels pulling relatively same values

Postby Benj » Thu Mar 28, 2019 10:59 am

Hello Steven,

You don't need the delays or the RawEnable / RawDisable macros. Just use the GetAverageInt macro.

To know more I would have to see the properties of the ADC components. Specifically the precharge time and conversion rate.

If you post your project file then I can have a look for you.