Analog input port question

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Pactor
Posts: 61
Joined: Sat Apr 11, 2015 12:07 pm
Has thanked: 20 times
Been thanked: 14 times
Contact:

Analog input port question

Post by Pactor »

Hello just wondering about something, I'm sure someone here will have the answer.
I was just playing about with an ECIO module and reading two Analog input ports.
I had them both at 0v via a 10k resistor on each input. But if I put 5v on one input they both read out as being at 255 on the lcd display even though one was at 0v and the other at 5v read with a multimeter.

But if you did it the other way around held them both at 5v and then took one to 0v they would both show up individually, one read 255 the other close to 0.
why is that?
I'd run out of digital inputs for a little project, but they only worked individually as switches if both held high and pulled low but not if held low and pulled high as they both went up and down together.

Thanks

Mark
Last edited by Pactor on Sat Jan 21, 2017 7:59 pm, edited 2 times in total.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Analog input port question

Post by kersing »

Mark, it helps if you list which pins you are using. Also providing a simple test program allows checking the issue.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Pactor
Posts: 61
Joined: Sat Apr 11, 2015 12:07 pm
Has thanked: 20 times
Been thanked: 14 times
Contact:

Re: Analog input port question

Post by Pactor »

Hello
Thanks for the reply.
I took out the resistors and it seem to work ok now.
With one input reading 5v and showing 255 the other only rises to about 35 when connected to ground.
I think maybe the ADC could not discharge fast enough before reading the next input and still held the pervious voltage.
something like that anyway.

I'll call it solved.

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

Re: Analog input port question

Post by Benj »

Sounds like your getting some ADC channel bleed. The ADC has a single capacitor which it connects to the ADC input pin being sampled. If this capacitor is not given enough time to charge / discharge then you get ADC channel bleed between channels where one channel effects another.

The ADC component properties should allow you to configure the ADC to overcome the channel bleed. What are your current ADC component properties and target Microcontroller clock speed? Attaching your project allows us to find these type of problems straight away without having to guess.

Pactor
Posts: 61
Joined: Sat Apr 11, 2015 12:07 pm
Has thanked: 20 times
Been thanked: 14 times
Contact:

Re: Analog input port question

Post by Pactor »

Thanks for the info.
I had 10k resistors on the port inputs, maybe that stopped the capacitor discharging.
I don't suppose those resistors were needed.
I am using one of your ECIO Arm modules. The settings for the port were 4Mhz and 40 cycles.
Anyway I have it working in my own fashion, all wrong I expect but its going.
Have you stopped making the ECIOARM module?
I got one when you were selling them at a reduced price maybe they're obsolete.

I've had great fun with flowcode, got little projects working that I'd have had no chance of completing without it.

All the best.
Mark

Post Reply