ADC input error?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times

ADC input error?

Post by Stanga »

I wrote a piece of code using 4.5 that included two ADC inputs. One ADC input went to pin A0 on a PIC16F88. The other ADC input went to A4. I tried changing the ADC properties to match the A0 and A4 inputs. A0 worked fine, but ADC4 always defaulted to ADC1. So basically A4 was getting its data from ADC1 in the Flowcode code.
After spending a whole weekend trying to find out why the software runs fine, but the hardware refused to read anything on A0, I solved the problem by adding ADC1, ADC2, and ADC3 as 'dummies' in the code, but marked them as unconnected in the Properties. The hardware running the code in the PIC is now working fine.

I have added this information so that potential designers who need an ADC input are not caught out by this anomaly.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: ADC input error?

Post by medelec35 »

Hi Stanga,
it's easy to get confused with component number & channel number when leaning about Flowcode.
So I posted this on a different thread for someone else:

Component connection: ----------------------------------- An pin on Pic:

ADC(0) ---------- = ------------------------------ any analogue channel in any order eg. AN4

ADC(1) ---------- = ------------------------------ any analogue channel in any order eg. AN1

ADC(2) ---------- = ------------------------------ any analogue channel in any order eg. AN0

ADC(3) ---------- = ------------------------------ any analogue channel in any order eg. AN7

E.t.c

The number is brackets is not the analouge channel of microcontroller but just the component number.

So If you want AN0 and AN4 channels.
Then
ADC(0)=AN0
&
ADC(1)=AN4

Or
ADC(0)=AN4
&
ADC(1)=AN0

Makes no difference.
You only need to of the ADC components.

However, just to play it safe if this is not referring to your issue, then if your OK posting flowchart, we can look into the issue.
Hope this helps

Martin
Martin

Post Reply