Re: How do i change numerics into binary numbers?
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Tue, 3 Oct 2006 07:55:26 -0500
"Howk013" <Howk013@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
(6),(7),(9),(10),(11) need to be divided by certain equations , for the one
you listed (7) , it was multiplied by 1/10 , hence the decimal.
Those are needed details. Programming is an exact science (to a large part)
Every character on every line in the entire program has to be correct or else
the program won't compile and run. To get there you have to know precisely
what you expect for input, (even if you know that it may be garbage, you have
to know that garbage may be expected) and you have to know what the desired
output should be, _exactly_.
My point is that every detail has to be in place. When you were asked for
details, you skipped several. The equations above were one area,
the minimun and maximum values allowed for each input, was another area,
and even after being reminded to be sure everything is correct, you skipped
part of the input data:
<quote>
11) Direction bits 117-128
12) True Heading bits 129-137
13) Repeat indicator bits 144-145
14) Reserved bits 146-149
</quote>
What is held in bits 138 - 143 ???
You simply have to be more fastidious to be a good programmer.
We all make mistakes, but here, detailed information is required before
a reasonable reply can even be attempted. It is just a bit discouraging
to have to come back time and time again to ask for more details, just
to get enough information to make an educated guess as to what may
be desired....
In any case, I notice that no input is greater than 30 bits in length. That
means you could use the Long data type to hold each input value. So
lets say you use an array of Longs (1 to 17) to hold the input values.
In addition to that array, you could build another array that indicates
how many bits of each value are to be used. For your situation that
would start out like: 6, 1, 1, 30, 4, 8, 10 ... etc
Compre that to this section of modified input list where the number
of bits required are also listed:
1) 6 Message ID bits 1-6
2) 1 Data Terminal bits 7
3) 1 Data Indicator bit 8
4) 30 User ID bits 9-38
5) 4 Current status bits 39-42
6) 8 Rate of turn bits 43-50
7) 10 Speed bits 51-60
Now with 2 arrays, one having values an the other the number of
bits to use, you could develop an algorithm that would build 6-bit
bytes from the input (arrays) and store the new bytes in a third array.
The values in the third array could then be transposed to your
needed output either by a lookup table, or a simple ASCII conversion
formula.
That's one way to attack it, I'll wait to hear what others offer before
getting into writting any code.....
LFS
.
- Follow-Ups:
- Re: How do i change numerics into binary numbers?
- From: Howk013
- Re: How do i change numerics into binary numbers?
- References:
- Re: How do i change numerics into binary numbers?
- From: Rick Rothstein \(MVP - VB\)
- Re: How do i change numerics into binary numbers?
- From: mayayana
- Re: How do i change numerics into binary numbers?
- From: Rick Rothstein \(MVP - VB\)
- Re: How do i change numerics into binary numbers?
- From: Howk013
- Re: How do i change numerics into binary numbers?
- From: Larry Serflaten
- Re: How do i change numerics into binary numbers?
- From: Howk013
- Re: How do i change numerics into binary numbers?
- From: Larry Serflaten
- Re: How do i change numerics into binary numbers?
- From: Rick Rothstein \(MVP - VB\)
- Re: How do i change numerics into binary numbers?
- From: Howk013
- Re: How do i change numerics into binary numbers?
- From: Rick Rothstein \(MVP - VB\)
- Re: How do i change numerics into binary numbers?
- From: Howk013
- Re: How do i change numerics into binary numbers?
- Prev by Date: Re: Binary Write to DBF file
- Next by Date: Re: exporting graphical data from VB
- Previous by thread: Re: How do i change numerics into binary numbers?
- Next by thread: Re: How do i change numerics into binary numbers?
- Index(es):
Relevant Pages
|