ADC 18f4525

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
jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

ADC 18f4525

Post 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? :roll:

Can anyone help, please!

Best regard

jgu1
Attachments
Lm35T.fcf
(10 KiB) Downloaded 303 times

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: ADC 18f4525

Post 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.

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

Re: ADC 18f4525

Post by medelec35 »

I see Ben got there before me :P 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
Martin

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: ADC 18f4525

Post 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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: ADC 18f4525

Post 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. :D

By the way, something new about FC ver5.

Best regard

Jørgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: ADC 18f4525

Post by jgu1 »

Hi again!

Please don´t laugh! :D

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. :D :D

Jørgen.

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

Re: ADC 18f4525

Post 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
Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: ADC 18f4525

Post by jgu1 »

Hi again!


Yes :D Finally, I am "in business" Thank you Martin.

Jørgen.

Post Reply