Re: 16-bit value in 3 bytes?



Andre-John Mas wrote:

I recently got myself a 'Spaceball 5000' and since there is no driver
for my platform, I am trying to reverse engineer the protocol. The
place where I am stuck is that a given value for a rotation is
represented as a 16-bit signed integer, using four bytes. From what I
can tell the first byte represents the sign and the remaining 3 bytes
are used to encode the value using the characters ".023569:<?
ABCDEGHKLMNPSenors", so no more than 7 bits are used in each 8 bit
value. Additionally the first of the four bytes either has a value H
or G, which I believe might represent the sign.

Can anyone help me working out how the 16-bit value is being encoded?
Is there a better place to ask this question?

You listed 28 characters for numeric encoding. Three characters would give 28^3 = 21952 possible values, less than 15 bits. If there were 32 characters, you would encode 5 bits for each character, yielding 15 bits for 3 characters, plus 1 character for sign, giving 2^16 -1 possible values.

--
Thad
.



Relevant Pages

  • Re: urllib.unquote and unicode
    ... input string in unicode is encoded to UTF-8 and then each byte ... followed by two hex characters. ... For all valid URIs ... encode to ascii before unquoting. ...
    (comp.lang.python)
  • Re: HTML entities from input fields
    ... >> IE to encode characters outside of the current code-page ... submitting whatever characters they care to paste into the submission ... Browsers will then send the data in UTF-8 format ...
    (comp.infosystems.www.authoring.html)
  • Re: URL Encode via SQL?
    ... Not sure which characters you want encoded. ... >> encode the value as needed. ... The guy who administrates Goldmine ... > wants to send out a mass mail to every customer in the database. ...
    (microsoft.public.sqlserver.programming)
  • Re: "Wide character in syswrite" in writing an HTML form.
    ... people don't know about "encode", it was also necessary to write ... What that says is that you feed it a "string" (i.e of characters ... fed to syswrite. ... return value of syswriteare in UTF-8 encoded Unicode characters). ...
    (comp.lang.perl.misc)
  • Re: What is the difference between using Unicode and UUENCODE?
    ... Thus unicode is able to encode all characters: ... Since email server usually only transport 7 bits, unicode characters must be ... and encode binary data with BASE64. ...
    (microsoft.public.outlook)