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: awe...@hidglobal.com


HID Global, 3 Cae Gwrydd, Green Meadow Springs, Cardiff, CF15 7AB , United 
Kingdom
www.hidglobal.com

-----Original Message-----
From: users <users-boun...@lists.scilab.org> On Behalf Of James Holland
Sent: 21 June 2018 21:23
To: users@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@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to