Adam Nielsen

2009-10-04 13:24:12 UTC

Hi all,

Sorry for the basic question but it's been a while! I have a list of numbers:

A | B

-----+-----

0 | 0

32 | 3.6

64 | 7.6

128 | 15.6

255 | 31.5

And I need a formula such that I can put in any number (between 0 and 255

inclusive) for A, and obtain the result B. Unfortunately because this isn't

quite straightforward division I'm a bit stuck.

Just for a bit of background I'm writing a Linux driver for a USB-connected PC

power supply, and the current being drawn on the various rails is reported as

an 8-bit number (A) and for it to be of any use it will need to be converted

into amps (B). The values above are taken from the Windows driver, so there

could be some rounding issues in the values of B depending on how well that

code was written.

Annoyingly the six current rails all have slightly different values for B, so

I'd be grateful for a couple of tips so I can calculate a formula for each of

those as well.

Many thanks,

Adam.

Sorry for the basic question but it's been a while! I have a list of numbers:

A | B

-----+-----

0 | 0

32 | 3.6

64 | 7.6

128 | 15.6

255 | 31.5

And I need a formula such that I can put in any number (between 0 and 255

inclusive) for A, and obtain the result B. Unfortunately because this isn't

quite straightforward division I'm a bit stuck.

Just for a bit of background I'm writing a Linux driver for a USB-connected PC

power supply, and the current being drawn on the various rails is reported as

an 8-bit number (A) and for it to be of any use it will need to be converted

into amps (B). The values above are taken from the Windows driver, so there

could be some rounding issues in the values of B depending on how well that

code was written.

Annoyingly the six current rails all have slightly different values for B, so

I'd be grateful for a couple of tips so I can calculate a formula for each of

those as well.

Many thanks,

Adam.