Mathimatical question

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

jbs4wd
Posts: 46
Joined: Thu Dec 03, 2009 7:29 am
Has thanked: 4 times
Contact:

Mathimatical question

Postby jbs4wd » Thu Sep 23, 2010 3:17 am

If I set 'A' at 100 and set 'B' at 200. How do I make a adc input 'C' with full range (0 -255) work at full range between A & B? Then if I Change 'B' to 150, C still need to operate at full rang , but between A & B.
C is a pot opperating between 0-5V.
I can achieve this through hardware, but would like to downsize on components.

Cheers
JOHN

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 266
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: Mathimatical question

Postby Dan81 » Thu Sep 23, 2010 2:37 pm

Hello John

If I understand your question :

D=B when C=255 and D=A when C=0.

D = (((B-A)*C)/255) + A ; D must be an integer.
Be careful with the brakets or accuracy will be lost

If it is not the right answer : sorry ,i will remove it .


Daniel
These users thanked the author Dan81 for the post:
medelec35 (Wed Nov 17, 2010 7:48 pm)
Rating: 5.26%
 

jbs4wd
Posts: 46
Joined: Thu Dec 03, 2009 7:29 am
Has thanked: 4 times
Contact:

Re: Mathimatical question

Postby jbs4wd » Fri Sep 24, 2010 12:46 am

Thanks heaps. I nearly had it. Will give it go but I think you're on the money there

Thanks
JOHN

jbs4wd
Posts: 46
Joined: Thu Dec 03, 2009 7:29 am
Has thanked: 4 times
Contact:

Re: Mathimatical question

Postby jbs4wd » Fri Sep 24, 2010 5:27 am

Daniel

Thanks again. It was spot on.

Cheers
JOHN

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8542
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2456 times
Been thanked: 3528 times
Contact:

Re: Mathimatical question

Postby medelec35 » Wed Nov 17, 2010 7:48 pm

Dan81 wrote:D=B when C=255 and D=A when C=0.

D = (((B-A)*C)/255) + A ; D must be an integer.
Be careful with the brakets or accuracy will be lost
Daniel

Dan that is a very useful equation. I have used it quit a bit now. I wished I had your maths skills :-)
Thank you
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.