View Single Post
  #7   Report Post  
posted to rec.boats.electronics
Paul Paul is offline
external usenet poster
 
First recorded activity by BoatBanter: Aug 2006
Posts: 76
Default Help me identify an AIS Message (type 63???)


"Victor Fraenckel" wrote in message
...
Meindert Sprang wrote:

Decoding an ASCII character to its binary value goes like this:

ASCII value + 101000. If sum 1000000 then add 100000 else add 101000.
Then
use the resulting 6 LSB's.

Meindert


I think an easier way to decode binary numbers is positional:

position weight
1 = 1
1 = 2
1 = 4
1 = 8
0 = 16
0 = 32
0 = 64
0 = 128

so the value of 001111 = 1 + 2 + 4 + 8 + 0 + 0 = 16

FYI, Download a table of ASCII values he

http://www.cs.mun.ca/~michael/c/ascii-table.html


Vic-

The decoding that Meindert shows is specific to the 6-bit coding used in the
AIS NMEA messages, so there's more (and less) to it than the normal ASCII
conversion. You probably know this, but in any case, the 6-bit coding uses
selected ASCII characters to represent 6-bits of data. There are gaps in
the mapping, thus the "if-then-else" in the decoding.

-Paul