help-octave
[Top][All Lists]
Advanced

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

Aw: Serial data acquisition with GNU octave 4.0.1


From: Stefan Mahr
Subject: Aw: Serial data acquisition with GNU octave 4.0.1
Date: Mon, 11 Apr 2016 16:16:19 +0200

> *package load instrument-control
> if (exist("serial") != 3)
>   disp("No Serial Support");
> else
>   disp("Serial supported");
>   PortSerie = serial("\\\\.\\COM4");
>   fopen(PortSerie);
>   /set(PortSerie,'terminator','CR'); =>first problem/
> endif
> 
> /fprintf(PortSerie,'#020');
> ValF1 = fscanf(PortSerie); => second problem/*

> I don't know how to set a terminator with octave. I can see  here
> <http://octave.sourceforge.net/instrument-control/function/@octave_serial/set.html>
>   
> that this property is not in octave.

> For the fprintf and the fscanf i don't understand how to communicate with my
> hardware. I use ADAM module for my acquisition. And that work with matlab.
> The octave help doesn't help.

See wiki [1] for a simple example. fprintf, fscanf and terminator are not 
supported yet.

As replacement for fprintf and terminator you can use 
srl_write(PortSerie, sprintf("*IDN?\n"))
where "\n" is the terminator.

fscanf is a bit harder to replace. If readings have a specific timeout and your 
application is not time critical, just set the timeout higher than the time you 
expect the input to be ready. Also set number of bytes to read higher than the 
size of data you expect.

set(PortSerie,'timeout', 10);   % one second
in=srl_read(PortSerie,1000);    % tries to read 1000 bytes until timeout

Hope it helps.

BR,
Stefan
-----

[1] http://wiki.octave.org/Instrument_control_package



reply via email to

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