Page 1 of 1
ADC 18f4525
Posted: Tue Sep 06, 2011 11:41 am
by jgu1
Hi everybody!
I play a little with a lm35. that works. But when I want to add an analog input more, and I want to use analog4 or 5 or 6 I can dedicate the component connection to these, but when I add component macro I can only select ADC0 and ADC1? I use Pic18f4525 having many analog inputs. Using FC4.5
Am I doing something wrong in setup?
Can anyone help, please!
Best regard
jgu1
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 11:57 am
by Benj
Hello,
The ADC component numbering is not the same as the ADC channel numbering.
Select the ADC component on the panel, right click and select the Connections menu item, Select which ADC channel you wish to connect the component to.
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 12:19 pm
by medelec35
I see Ben got there before me

Since I was already typing an answer, and with my typing takes a while.
I will post it anyway, so it may be saying the same thing as Ben.
Still two replies are better then none.
The component number is within brackets. This does not represent the analogue channel.
It mealy represents how many ADC components you have (-1).
Each time you add a new ADC component, the number within brackets increments by 1.
What you then have to do is use the ADC component connections to select correct analogue channel.
E.g using ADC component just once and you want it set to analogue channel 4.
Then you will have the number within brackets will be 0 since you have 1 ADC component.
You can then right click on the pot that’s on control panel and select connections. Select 4 from drop down list..
Martin
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 12:26 pm
by Benj
One slight thing to add on top of mine and Martins posts.
This effects PICs and maybe also some PIC16BITs. The 18F4525 device is effected by this problem.
Some devices have a bit of a strange analogue peripheral which only allows you to switch on analogue pins in series. Eg you cannot use RA1 as an analogue pin without also converting RA0 into an analogue pin. Similarly you cannot use RA2 as an analogue pin without also converting RA1 and RA0. Flowcode takes care of all this code behind the scenes so you don't have to worry about doing anything. Just something to be aware of if you have digital signals happening on lower analogue channels which you need to keep going while you do a conversion.
In summary if you can always use the lower analogue channels for analogue and keep any digital signals or comms on non analogue or higher analogue pins then you shouldn't have any problems.
See the device datasheet and the ADCON1 register description for more information.
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 12:59 pm
by jgu1
Hi Both!
Hello again!
First of all, thanks for the lightning fast response, real service in record time.
Now I think there was some more buttons on place in my head. I understand your explanations, but just need a little experience. Thank you both.
By the way, something new about FC ver5.
Best regard
Jørgen
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 7:19 pm
by jgu1
Hi again!
Please don´t laugh!
But only to confirm theori :
Component connection: ------------ An pin on Pic:
Acd0 ---------- = ------------------------------ An0
Acd1 ---------- = ------------------------------- An1
Adc2 ---------- = ------------------------------- An2
ect. ect
Is this correct or am I total out of range
Thank´s world´s best team.
Jørgen.
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 7:31 pm
by medelec35
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
Re: ADC 18f4525
Posted: Tue Sep 06, 2011 8:53 pm
by jgu1
Hi again!
Yes

Finally, I am "in business" Thank you Martin.
Jørgen.