instrument-control toolbox

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

instrument-control toolbox

kees
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


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: instrument-control toolbox

Andrius Sutas
On Mon, Dec 31, 2012 at 1:51 PM, kees <[hidden email]> wrote:
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


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


Thanks for a good description.

Have you tried Instrument-Control version from the SVN repository?

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: instrument-control toolbox

Andrius Sutas

On Mon, Dec 31, 2012 at 6:05 PM, kees <[hidden email]> wrote:
On 12/31/2012 11:54 AM, Andrius Sutas wrote:
On Mon, Dec 31, 2012 at 1:51 PM, kees <[hidden email]> wrote:
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:

<snip>

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


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


Thanks for a good description.

Have you tried Instrument-Control version from the SVN repository?


I am using package 0.1.0  from 2012-10-02 from this link. I believe it is SVN;
http://octave.sourceforge.net/instrument-control/index.html

I have the zip file attached for your reference.

Kees


Please try attached development version.

0b49d0f5942d2f07025cf5f5aa1be8a3  instrument-control-svn-20130104.tar.gz

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

instrument-control-svn-20130104.tar.gz (32K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: instrument-control toolbox

Andrius Sutas
On Sat, Jan 5, 2013 at 12:54 PM, kees <[hidden email]> wrote:
On 01/04/2013 05:05 PM, Andrius Sutas wrote:

On Mon, Dec 31, 2012 at 6:05 PM, kees <[hidden email]> wrote:
On 12/31/2012 11:54 AM, Andrius Sutas wrote:
On Mon, Dec 31, 2012 at 1:51 PM, kees <[hidden email]> wrote:
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:

<snip>

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


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


Thanks for a good description.

Have you tried Instrument-Control version from the SVN repository?


I am using package 0.1.0  from 2012-10-02 from this link. I believe it is SVN;
http://octave.sourceforge.net/instrument-control/index.html

I have the zip file attached for your reference.

Kees


Please try attached development version.

0b49d0f5942d2f07025cf5f5aa1be8a3  instrument-control-svn-20130104.tar.gz
I installed the new updated version and it works. I am receiving the correct string back from the ADR card.

Thanks Kees


Thank you for testing and reporting back the warning messages.

Andrew.

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave