Re: How to Convert 8bit into 6bit AIS encapsulation?
- From: Howk013 <Howk013@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 1 Nov 2006 17:51:02 -0800
Thanks for replying Larry
Just giving an overview after reading this code, correct me if im wrong, i
think this is towards decoding of the 6bit codes after i encapsulated coding
them right?
I was thinking about how to do the encapsulation, but reading your
explanation, i am trying to think of a similar method to encode to 6bit.
Does it mean that i have to come up with a similar table to decipher the
dec into bin?
"Larry Serflaten" wrote:
.
"Howk013" <Howk013@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
Hi guys, after weeks of asking alot of people here, i finally reach this
stage of requiring me to convert the codes from 8bit to 6bit.
To better illustrate my idea, page 34 of this link
http://www.navcenter.org/marcomms/IEC/80_330e_PAS.pdf
is what i am trying to convert.
1P000Oh1IT1svTP2r:43grwb05q4
Each of those characters represent a certain combination of 6 bits.
What you need to do is to build a table that will tell you what each
combination is, given any specific character. To do that you would
use a look-up table.
Using the lookup table, you can turn that string of characters into
a long stream of 1's and 0's. You then chop that stream up into
the right sizes for each segment and tanslate the segments from
1's and 0's into values you can use.
Paste this into a new form and see if it helps you move a little
farther along...
LFS
Private Sub Form_Load()
Dim table As Collection
Dim stream As String, bits
Dim data As String
Show
AutoRedraw = True
' build lookup table
Set table = New Collection
table.Add "000001", "1"
table.Add "000010", "2"
table.Add "000011", "3"
table.Add "000100", "4"
' ... for all entries
table.Add "111111", "w"
' acquire message
data = "4w3122143"
' Build bit stream
Dim i, ch, seg
stream = String$(6 * Len(data), 48)
For i = 1 To Len(data)
' get the character
ch = Mid(data, i, 1)
' add to stream the converted bits
Mid(stream, i * 6 - 5, 6) = table(ch)
Next
Print "DATA STREAM"
Print data; " = "; stream
' Chop stream into segments
bits = Array(6, 2, 30, 4, 8, 10) ' Ref page 35 of your PDF
Print vbCrLf & "SEGMENTS"
For i = 0 To 4
' get segment
seg = Left(stream, bits(i))
' remove from stream
stream = Mid(stream, bits(i) + 1)
' (show segments on form)
Print Array("Msg ID", "Rep", "User ID", "Nav", "ROT")(i), seg
' TO DO: Convert segments to values....
' Straight bits to long conversion, search Google for examples
Next
End Sub
- Follow-Ups:
- Re: How to Convert 8bit into 6bit AIS encapsulation?
- From: Larry Serflaten
- Re: How to Convert 8bit into 6bit AIS encapsulation?
- References:
- How to Convert 8bit into 6bit AIS encapsulation?
- From: Howk013
- Re: How to Convert 8bit into 6bit AIS encapsulation?
- From: Larry Serflaten
- How to Convert 8bit into 6bit AIS encapsulation?
- Prev by Date: Re: How do I automatically get my app running with focus when a PC
- Next by Date: Re: dll version, possible from VB? Solved
- Previous by thread: Re: How to Convert 8bit into 6bit AIS encapsulation?
- Next by thread: Re: How to Convert 8bit into 6bit AIS encapsulation?
- Index(es):
Relevant Pages
|