Analog!

A forums to allow bugs and problems with Flowcode v6 to be reported and resolved.

Moderator: Benj

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

Analog!

Post by jgu1 »

Hi!

After using FC6 with arduino Uno and mega 2560 for a while, I have had good experiences. Quick Compiling etc. :D :D :D :D

But I think there is an error in analog component. If I read bytes from an analog input and write to a display, the minimum byte at 0 volts at the input 4 (show 4 byte in display) and maximum 250 at 5 volt at the Analog input.
If I change the byte to int. is a minimum of 17 (in display) at 0 V and max 1000 at 5 Volts on the analog input. If I test with Aduino IDE, the values are correct.

In simulation ok, but not in real World

Best regard

Jorgen
Attachments
Analog_In.fcfx
(5.23 KiB) Downloaded 218 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: Analog!

Post by Benj »

Hello Jorgen,

Yes compile speed is very nice outside of the PIC chip pack. We are working on improving this as PIC is currently our most popular offering.

Have you tried playing with the conversion speed and acquisition time properties of the ADC component?

Might be worth upping the Acquisition cycles to say 100 and lowering the conversion speed to see if this improves things.

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

Re: Analog!

Post by jgu1 »

Hi Benj!

I try this evening. Many thank´s for reply. You hear from me. Concening the compilingspeed for Pic, really really good. :D :D :D

Best regard


Jorgen

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

Re: Analog!

Post by jgu1 »

Hi Benj!

I promised a response back. It works now, yes, yes good news. :D

It was not Acquisition cycles but your idea to try changes in properties, did I tried to change the clock setting from the default Fosc / 8 to Fosc / 32 and above, work perfect 100% :D But who could know this.

Apologies for this I thought it was a bug................

But Benj, I'm not expert and knows what happens 100% in the controller. Can / will you briefly describe why this change of division osc influence Analog. :?:

And I'm really looking forward to speed up the compilation of Pic also, it is a pure delight with Arduino.

But many thanks for your help.

Jorgen

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: Analog!

Post by Benj »

Hello Jorgen,

The Acquisition time sets how long the internal capacitor is connected to the external analogue voltage. The conversion speed sets the rate at which the internal voltage is converted to a digital signal. The slower the conversion the more accurate the reading up to a point. The options are provided to allow you to get the optimal ADC sample speed no matter what your clock speed is.

The speed limitation is likely down to RC time constant characteristics in the ADC converter peripheral. An RC constant I think gives you 33% of the input voltage difference per time period, it been a long time since I learned this stuff.

This has some good AVR based info on max sample rates: http://www.avrfreaks.net/forum/max-adc-speed

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: Analog!

Post by Benj »

If I got my maths right each dot on the graph is a time constant.
RCconst.jpg
RCconst.jpg (52.32 KiB) Viewed 4848 times
The time constant for the actual ADC peripheral will be dependent on the internal resistance and capacitance.

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

Re: Analog!

Post by jgu1 »

Ok Benj!

make sense Thank´s


Jorgen

Post Reply