Re: How to Convert 8bit into 6bit AIS encapsulation?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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








.



Relevant Pages

  • Re: Problem Writing DVDs
    ... > don't now how to use crontab so as to avoid gaps in the stream between ... > segments but I'm not sure you can just arbitrarily split an hdtv mpeg ... > stream. ... start playing one of the segments. ...
    (comp.os.linux.hardware)
  • Re: How to Convert 8bit into 6bit AIS encapsulation?
    ... Each of those characters represent a certain combination of 6 bits. ... You then chop that stream up into ... Dim table As Collection ... ' Chop stream into segments ...
    (microsoft.public.vb.general.discussion)
  • Re: How can I split a mpg movie in segments
    ... I'm a newbie in DS, what I need is to open a stream to read a mpg file and ... split it in different segments, besides that I need to access the memory ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Datatable Column ByteArray Problem
    ... 'Dim utf8encoder As New UTF8Encoding ... ' Crypto functions need a stream to output the encrypted info. ... 'We want to use a memory stream ... >> CaseSensitive False Boolean ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Datatable Column ByteArray Problem
    ... 'Dim utf8encoder As New UTF8Encoding ... _encryptInitVector = aesProvider.IV ... ' Crypto functions need a stream to output the encrypted info. ... 'We want to use a memory stream ...
    (microsoft.public.dotnet.framework.adonet)