
Analog Inputs
Analog Inputs
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?? 

- Attachments
-
- RGB.fcf
- (9.5 KiB) Downloaded 578 times
- 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: Analog Inputs
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.
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 594 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Analog Inputs
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,
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,
- 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: Analog Inputs
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.
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"
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Analog Inputs
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,
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 521 times
Re: Analog Inputs
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
)
Thanks in advance.
PS: My project requires the use of 5 ADC channels.
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

Thanks in advance.
PS: My project requires the use of 5 ADC channels.

Re: Analog Inputs
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,
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,
- 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: Analog Inputs
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.
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 501 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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: Analog Inputs
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Analog Inputs
It seems to work ok now. GREAT!
Thank you very much for your support.
PS: I'm really starting to like Flowcode
Thank you very much for your support.
PS: I'm really starting to like Flowcode
