help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

instrument-control toolbox


From: kees
Subject: instrument-control toolbox
Date: Mon, 31 Dec 2012 08:51:08 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0

I am trying to communicate to an ADR2205 card from Ontrak control systems. I have been able to send commands to it with this simple code:

# write to serial port test program

pkg load instrument-control;
s1 = serial("/dev/ttyS0", 9600,10);
srl_flush(s1);

% different commands to switch the relays on the board

% switch relay #3 K2
%srl_write(s1, "SK2\r");

% outputs binary data to port K order MSB-->LSB
%srl_write(s1, "SPK00110011\r");

% output decimal data to port K setting relay K7,K5, K3, K1 -->MK170
srl_write(s1, "MK170\r");


However I have trouble reading from the ADR card. It seems that after reading eight (8)_characters the string gets terminated. I have extended the number of bytes to read to 20 but anything after eight characters is garbage. Here is the code I have been using;

# read from the serial port test program
pkg load instrument-control;

s1 = serial("/dev/ttyS0", 9600,10);
srl_flush(s1);

% request to return status of relay K3
%srl_write(s1, "RPK3\r");

% request to return status of all relays decimal
%srl_write(s1, "PK\r");

% request to return status of all relays binary
srl_write(s1, "RPK\r");

data = srl_read(s1,20);
char(data)
%data

With "char(data)" I am getting "1 0 1 0 g " but the remainder 1 0 1 0 is missing.

(every other relay is on so I should get 1 0 1 0 1 0 1 0)

When I just print data and get the ASCII characters it shows;

49 32 48 32 49 32 48 32 0 0 0 0 103 0 0

So I do not know if this is wrong in my code or that there is something in the software that truncate the number of bytes being read.

It is my ultimate goal to talk to a spectrum analyzer and the return string is I do not know how many bytes long containing: start and stop frequency, VBW, RBW, marker and of course trace data. So if I cannot read beyond 8 characters this will never work. So what is it that I am doing wrong.

Kees Blom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]