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.
ADC input error?
Moderator: Benj
-
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?
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
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