Re: How do i change numerics into binary numbers?




"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


.



Relevant Pages

  • Re: Arrays: compare fields?
    ... Just use single dimension array for the names to match. ... > Dim myArray() As Variant ... >>the matched rows into a third array and write this third array into ...
    (microsoft.public.excel.programming)
  • Re: [C] Array bounds in function prototypes
    ... > Well, just like it says, an array argument 'decays' into a pointer ... Thanks for the detailed information. ... I can't see why the array typing ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Frequency question
    ... where 90 is the value in your highest bin. ... In this formula generates an array of 100 TRUE/FALSE ... depending on whether the cells in A1:A100 are greater than B1. ... corresponding element of the third array will equal 1. ...
    (microsoft.public.mac.office.excel)
  • Re: SUM(IF..... in Visual basic
    ... third array to be placed in a fourth array if the result of the ... second and third array are then ... Much the same thing, but SUMPRODUCT is faster. ... >> There is a speed advantage to using SUMPRODUCTrather than SUM), ...
    (microsoft.public.excel)
  • Re: [C] Array bounds in function prototypes
    ... >> Well, just like it says, an array argument 'decays' into a pointer ... > Thanks for the detailed information. ... I can't see why the array typing ...
    (alt.comp.lang.learn.c-cpp)