Re: LZ: Re:Need algorithmic help!!!
[Prev][Next][Index][Thread]
Marty Williams wrote:
[SNIP]
> Ok, I see the BCD format in the number. But I don't understand how to do
> the conversion. Can you help me with an algorithum that will take a number
> and convert it into the Hex byte format needed to calculate the check-sum
> and for tranmission. And then, to take it out of this format, back into a
> decimal format.
>
> <Cut-outs>
> 00 02 FC 12 30 00 00 00 00 00
>
> What it means is this:
>
> +--- <Range> (one byte)
> |
> | +--+--+--+--+--+--+--- <Number> (in BCD, 7 bytes)
> | | | | | | | |
> 00 02 FC 12 30 00 00 00 00 00
> | |
> +--+--- <Exponent> (in hex, 2 bytes)
You have made a small mistake in the format of the number. Thr first
bytes
is the sign of the number (80=- 00=+). The two next bytes is the
exponent.
The last bytes are the digits. So the number above wouldbe
sign : 00 = positive
exponent : 02FC = 02+256d*(FC-FC) = 2
digits : 12300000000000 = 1.23
so the number would be +1.23*10^2 =123.
If you wantsome algoritmes to convert this format to another please mail
me
personally with more information on what you need it for (so i know
exatly
what you want to do).
<pre>
--
_______________________________________
Dines Justesen
Email: dines@post1.com or
c958362@student.dtu.dk
WWW : http://www.gbar.dtu.dk/~c958362/
_______________________________________
</pre>
References: