[Scilab-users] Sockets in scilab 6.0
Adrian Weeks
aweeks at hidglobal.com
Fri Jun 22 09:11:49 CEST 2018
Hi James,
I use Scilab to control an oscilloscope. Mine is connected to a serial port not a TCP socket but I have had problems with CR LF.
You could look at the TCL 'configure' command.
When I open the serial port I use something like:
TCL_EvalStr("fconfigure $serialport -translation binary");
so that TCL doesn't automatically add CR LF, then I add them, as required, to the string I'm sending.
Adrian Weeks.
Engineer, Hardware Engineering EMEA.
Office: +44 (0) 2920 528500 | Direct: +44 (0) 2920 528523
Email: aweeks at hidglobal.com
HID Global, 3 Cae Gwrydd, Green Meadow Springs, Cardiff, CF15 7AB , United Kingdom
www.hidglobal.com
-----Original Message-----
From: users <users-bounces at lists.scilab.org> On Behalf Of James Holland
Sent: 21 June 2018 21:23
To: users at lists.scilab.org
Subject: Re: [Scilab-users] Sockets in scilab 6.0
This is my code:
// Exemple avec Socket
SOCKET_open(1,"192.168.1.72",3000);
SOCKET_write(1,["*IDN?"]);
SOCKET_read(1)
SOCKET_close(1);
I've modified the write routine from this:
function SOCKET_write(id,commande)
TCL_EvalStr([ "puts $tclsocket"+string(id)+" """+commande+ascii(10)+"""";
"flush $tclsocket"+string(id)]);
endfunction
to this:
function SOCKET_write(id,commande)
TCL_EvalStr([ "puts $tclsocket"+string(id)+"" ""+commande+"";
"flush $tclsocket"+string(id)]);
endfunction
That has already removed some spurious LF/CRs.
Putty also works OK and doesn't add the CR/LF at the end.
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list