[Elecraft] K3 programming - Text decode

Paul Fletcher paul at melreed.demon.co.uk
Fri May 22 05:37:02 EDT 2009




Mike Clarke-5 wrote:
> 
> The manual states "Returned strings are never interspersed with
> text data, so this can easily be done."  Ahem.
> 

Hi Mike,

I think that (reading between the lines) it is the responses from the radio
that are the issue you are concerned with because commands sent to the radio
aren't a big deal.

I fully agree that text wrapped up in a command response would help you but
thought I would share the approach I've used plus a few other thoughts that
may help.

I have used a similar technique to one of the ones you mentioned. Each
response that I'm looking for is stored in a table as the two character
response code together with format info (i.e. numerals, alphas, any special
characters etc) and length of response.

I examine the incoming data looking for possible matches to the start of a
response, and as soon as a matching pair is found the subsequent data is
examined as it arrives to make sure it matches the expected format. If it
doesn't or a semicolon is received before or after it is expected the state
machine goes back to looking for a valid response.

Whilst this doesn't eliminate the possibility of someone sending an exact K3
command response in CW it is more robust. This approach works for me because
I know what response I am expecting as I keep track of which commands are
pending a response (taking into account that commands need to be able to
time out).

Another possible approach is to take the LP-Bridge route where the software
maintains a virtual K3 so client apps don't talk directly to the radio. This
would allow you to take complete control over the command / response cycle
so you would know what responses to expect and when.

73 Paul
-- 
View this message in context: http://n2.nabble.com/K3-programming---Text-decode-tp2954806p2956470.html
Sent from the Elecraft mailing list archive at Nabble.com.



More information about the Elecraft mailing list