Shop OBEX P1 Docs P2 Docs Learn Events
I''m stuck.Need help with some equation problem... — Parallax Forums

I''m stuck.Need help with some equation problem...

ArchiverArchiver Posts: 46,084
edited 2003-03-31 22:43 in General Discussion
> >
>> 1)in my program, i have to use this equation:
>> lbs = 0.0299* Volts - 0.0588 ,how to write this equation?i tried but
>> it wouldn't allow me to use decimals.


Hi Mizi,

The signal is more likely in millivolts, huh? Say, 2157 millivolts,
instead of 2.157 volts. The stamp can handle integers. By the same
token, you should look for an answer in, say, 1/10000ths of lbs. So,
(by your formula) 2157 millivolts --> 57/10000 of a pound. So
calculate and display in units of 0.0001 lb.

Transformation to use units of millivolts and 0.0001 pound:
lbs = .0000299 * millivolts - 0.0588
lbs10k = .299*millivolts - 588

' in Stampese...
millivolts=2157 ' example
lbs10k = 19595 ** millivolts - 588
debug dec lbs10k/10000,".",dec4 lbs10k," lbs" 'display 0.0056 lbs

Not very heavy!

The Stamp program uses the ** and the */ operators to do fractions.
The factor 19595 used with ** comes from,
19595/65536 =~ 0.299 closest approximation.

The division by 65536 is implied in the ** operator.


-- Tracy
Sign In or Register to comment.