Analog Inputs

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

LuckyLuke
Posts: 2
Joined: Tue Mar 10, 2009 8:25 am
Contact:

Analog Inputs

Postby LuckyLuke » Tue Mar 10, 2009 8:39 am

I want to use a 16F88 pic controller with 3 analog inputs (ADC2, ADC3 and ADC4) to control 3 differents PWM signals. In flowcode everything works properly but in real only 1 channel (ADC2) works. The other channels dont work. What can be the problem? The register?? :shock:
Attachments
RGB.fcf
(9.5 KiB) Downloaded 280 times

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

Re: Analog Inputs

Postby Benj » Tue Mar 10, 2009 10:13 am

Hello

Please can you try copying the attached fcd file into your Flowcode FCD folder. Then restart Flowcode and recompile your program to the device.

Let us know how you get on.
Attachments
16F88.fcd
(6.21 KiB) Downloaded 298 times

LuckyLuke
Posts: 2
Joined: Tue Mar 10, 2009 8:25 am
Contact:

Re: Analog Inputs

Postby LuckyLuke » Wed Mar 11, 2009 12:14 pm

It works :P Thank you very much :lol:

Addy
Posts: 5
Joined: Fri May 29, 2009 11:12 am
Location: Egripment B.V.
Contact:

Re: Analog Inputs

Postby Addy » Fri May 29, 2009 12:02 pm

Hello

I have found a similar problem with the ARM processor.
As soon as I try to use more than 1 ADC-channel the simulation looks good but after compiling and downloading either all channels seem to react to one another or the second channel takes over from the first (depending on the programming order).

Is there also a copiler fix availlable for this ARM-version?
(I am using the EB031 + EB034 and Flowcode V.3.6.11.53.)

Also, I have no access to the configuration of the chip. Is this normal?

Regards,

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

Re: Analog Inputs

Postby Benj » Fri May 29, 2009 2:25 pm

Hello

Are you setting the target device as the EB031 or the AT91SAM7S128? You should be using the EB031.

There are no configurations required for the ARM processors so you do not have to worry about this.

The following line of the FCD file determines the ADC sample routine. Please can you check that the line in your targets FCD file matches what I have here.

Code: Select all

ADCCapture="AT91F_ADC_EnableChannel(AT91C_BASE_ADC, (1 << %a));\nAT91F_ADC_StartConversion(AT91C_BASE_ADC);\nwhile(!(AT91F_ADC_GetStatus(AT91C_BASE_ADC) & (1 << %a)));\nAT91F_ADC_EnableChannel(AT91C_BASE_ADC, (1 << %a));\n"

Addy
Posts: 5
Joined: Fri May 29, 2009 11:12 am
Location: Egripment B.V.
Contact:

Re: Analog Inputs

Postby Addy » Fri May 29, 2009 3:48 pm

Hi,

I just did a small test (see attached) with the EB031 as target, just to be sure, and the result is the same.
I have 2 LED's on the PWM outputs and they both respond to either of the ADC inputs.

I don't believe it's a hardware failure since the board-test program works fine.

Please advise.

Kind regards,
Attachments
TEST_EB031.fcf_arm
(5.5 KiB) Downloaded 236 times

Addy
Posts: 5
Joined: Fri May 29, 2009 11:12 am
Location: Egripment B.V.
Contact:

Re: Analog Inputs

Postby Addy » Tue Jun 02, 2009 3:34 pm

Gentlemen,

I've been running some more basic ADC tests (see previous attachement) and found the following:

1) Whenever I use a combination of ADC channels 0 & 1 or 1 & 2 both PWM outputs respond in unisun to the highest ADC channel #.
2) If I use any other combination of channels the ADC works okΓ© however, if at start-up (or reset) one of the inputs is '0' then both outputs follow the highest ADC channel # until this channel has been 0. After that it works fine.
When I make sure that no input is at ground level during start-up/reset it works fine from the get go.

Regarding 1):
Is this a real hardware failure or a crosstalk/timing issue? Can someone test this on another board?
Do I have any control over the sampling rate?

Regarding 2):
Is this normal behaviour? Are there any tips or tricks for this. (I'm new at this :oops: )

Thanks in advance.

PS: My project requires the use of 5 ADC channels. :P

Addy
Posts: 5
Joined: Fri May 29, 2009 11:12 am
Location: Egripment B.V.
Contact:

Re: Analog Inputs

Postby Addy » Thu Jun 11, 2009 8:39 am

Hello...

Done some more tests on various combinations of ADC-channels and still the conclusion is the same.
I can use any single channel without a problem.
I can use up to 2 channels without a problem as long as they are not a combination of the first 3 channels (O,1 or2).
Whenever I try to use 3 channels or more it's a disaster! Then all ADC vallues respond to just 1 of the input.

I seriously doubt the ADC (or multiplexer) inside my ARM processor.
Can I order just a a spare EB034 daughter board somewhere?
(I can't find it listed as a standalone part anywhere.)

Kind regards,

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

Re: Analog Inputs

Postby Benj » Thu Jun 11, 2009 1:49 pm

Hello

Ok we have been able to replicate this problem and I am happy to announce we have been able to find the cause.

On the ARM each analogue channel that is enabled is sampled in order. Flowcode should enable one analogue channel, sample it and then disable the channel however after the sample was completed the channel was still enabled.

To fix this problem please copy the content of the attached archive into your "Flowcode_ARM/FCD" directory and restart Flowcode.
Attachments
FCD.zip
(44.71 KiB) Downloaded 234 times

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

Re: Analog Inputs

Postby Benj » Thu Jun 11, 2009 1:51 pm

Oh and if you still wish to have a second EB034 then you can contact sales<at>matrixmultimedia.co.uk and they will be able to quote you a price etc.

Addy
Posts: 5
Joined: Fri May 29, 2009 11:12 am
Location: Egripment B.V.
Contact:

Re: Analog Inputs

Postby Addy » Thu Jun 11, 2009 3:11 pm

It seems to work ok now. GREAT!
Thank you very much for your support.

PS: I'm really starting to like Flowcode :P