Re: How do i change numerics into binary numbers?



Hi Larry,

I'll remember your advice. I was thinking of jumping right into it, sorry
about all the errors, my first time trying out on programming. I guess
there's more to it than I had given thought to. Sorry about that.

I am currently working on the formula in treating the 8bit to convert into
6bit. This is what I came up with.

Private Function convCode (ByVal Code as integer , Keyascii as integer )
Dim A as Boolean
Code = Keyascii

If A = True Then
Error
End if

If (119< Code) OR (Code <48) Or (87<Code< 96) then
A = True

Elseif A = False then
Code = Code+ 40

Select Case Code

Case Code>128
Code = Code + 40
Case Else
Code = Code + 32
End Select
End if

My idea is to grab the LSB of the final output and then convert it at 6bit
ascii character. This formula guarantees I get the right output. However I am
don't know how to remove the first 2 MSB and decode it at the same time.


Larry, how do I extract the output from the user to make it an array? I
think I better work out the function first.


"Larry Serflaten" wrote:


"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: Puppy Mastiff wants to Nip at Faces
    ... in my first college textbook on structured programming. ... they did was loop through an array to show how you could easily ... design, PIC code, and real time programming. ...
    (rec.pets.dogs.behavior)
  • Re: LISPPA
    ... > The abstract mathematical definition doesn't cope too well ... programming languages which do not allow to write bad programs, ... definition of array? ...
    (comp.lang.lisp)
  • Re: Bug/Gross InEfficiency in HeathFields fgetline program
    ... Maybe this is true in the sort of programming you do, ... you are storing a list of amounts of money as integers. ... int average ... the array, rounded towards zero. ...
    (comp.lang.c)
  • Re: Puppy Mastiff wants to Nip at Faces
    ... in my first college textbook on structured programming. ... they did was loop through an array to show how you could easily access ...   and improve your crack pot licensing fee calculator. ...
    (rec.pets.dogs.behavior)
  • Re: TR 5/8 Big Show Synopsis
    ... The state of television programming is sinking ... watch and consequently this is what we've deposited into our brains to ... Garbage in, garbage out. ... expectations about family life and the divorce rate is 50%. ...
    (alt.fan.letterman)