0

I have a device that is connected via a serial port to my PC, and I'm trying to figure out how it sends data. (to make a long story short) I have an app that can instruct it to send text to me over serial, and I'm trying to figure out how the device formats the data. So far, I've sleuthed out that for example:

If I send: 'Palindromes', I will see:

A1 87 66 9D D9 39 6F DB 97 98 00    

The ASCII data for 'Palindromes' is

P  a  l  i  n  d  r  o  m  e  s
50 61 6C 69 6E 64 72 6F 6D 65 73

If i shift each byte by position (+1) in the stream I get

P  a  l  i  n  d  r  o  m  e  s
50 61 6C 69 6E 64 72 6F 6D 65 73  <-- ASCII
01 02 03 04 05 06 07 08 09 0A 0B  <-- shift
--------------------------------
                        03 98 00  <-- 73 << 0B = 039800
                     01 94 00     <-- 65 << 0A = 019400
                     DA 00        <-- 6D << 09 = DA00
                  6F 00           <-- 6F << 08 = 6F00
               39 00              <-- 72 << 07 = 3900
            19 00                 <-- 64 << 06 = 1900
         0D C0                    <-- 6E << 05 = 0DC0
      06 90                       <-- 69 << 04 = 0690
   03 60                          <-- 6C << 03 = 0360
01 84                             <-- 61 << 02 = 0184
A0                                <-- 50 << 01 = A0
--------------------------------
A1 87 66 9D D9 39 6F DB 97 98 00

I've experimented with strings of varying size and the algorithm fits the bill.

Is there some sort of protocol(s) that does this? If so, which ones?

Thankful for any direction

Piotr
  • 541
  • 4
  • 19

2 Answers2

0

It looks like it is sending 7-bits per byte, and you are set up to receive 8. Check your serial port settings.

Robert McKee
  • 21,305
  • 1
  • 43
  • 57
  • This just struck me when I tried decoding the data I formed. To address your concern however, this data is part of a bigger packet, which is sent over 9600 baud no parity, 8 data, 1 stop, no flow. I think they simply are using bit packing for the data part. – Piotr Mar 09 '15 at 21:06
0

The data within the stream is bit-packed, meaning the MSBit of each byte is removed.

Piotr
  • 541
  • 4
  • 19