I've found a solution with python... The problem was getting it to not 
interpret '\xB2' as an escape sequence, so I just re-encode it with string 
escapes, then do a string replacement:

>>> source = 'DS@1\xB200\xB325\x80\x90'
>>> source2 = source.encode('string-escape').replace(r'\xb', '.')
>>> freq = source2[2:12].replace('@','').zfill(10)
>>> freq
'01.200.325'

Thanks for all the replies!

-Dave

    

-----Original Message-----
From: "Bill Noyce" <wbno...@gmail.com>
Sent: Friday, May 16, 2014 1:18pm
To: elecraft@mailman.qth.net
Subject: Re: [Elecraft] Programmers Reference Questions

David Patino asks:

> But the responses I'm seeing from
> the KX3 don't appear to follow this
> layout. Given an active frequency of
> 1.200.325 the response is:
>
> DS@1\xB200\xB325\x80\x90;
>
> The appears to be the active
> frequency in plain text, replacing
> spaces with @'s and .'s with \xB,
> only the last two entries for icon
> data and extended data are 8-bit
> bytes expressed in hex.

It looks like the digits are in plain ASCII, as suggested by the note that
the minimum value is 0x30 (the ASCII code for "0").  The digits with a
decimal point to their left are encoded as ASCII+0x80, so for example ".2"
appears as "0xB2" because 0x32+0x80=0xB2.
This would be clearer if each byte of the response is presented on its own
line:
D
S
@
1
\xB2
0
0
\xB3
2
5
\x80
\x90
;

Hope this helps,
  -- Bill, AB1AV
______________________________________________________________
Elecraft mailing list
Home: http://mailman.qth.net/mailman/listinfo/elecraft
Help: http://mailman.qth.net/mmfaq.htm
Post: mailto:Elecraft@mailman.qth.net

This list hosted by: http://www.qsl.net
Please help support this email list: http://www.qsl.net/donate.html
Message delivered to d...@onitap.com


______________________________________________________________
Elecraft mailing list
Home: http://mailman.qth.net/mailman/listinfo/elecraft
Help: http://mailman.qth.net/mmfaq.htm
Post: mailto:Elecraft@mailman.qth.net

This list hosted by: http://www.qsl.net
Please help support this email list: http://www.qsl.net/donate.html
Message delivered to arch...@mail-archive.com

Reply via email to