<< closeserial serial readserial >>

serial >> serial > openserial

openserial

open serial port

Syntax

h = openserial(p, smode, translation, handshake, xchar, blocking, timeout)

Parameters

p

port number, or port device name. Numbers are mapped in the following standard way:
p MSDOS Unix
1 COM1: /dev/ttyS0
2 COM2: /dev/ttyS1
... ... ...
If needed (e.g. on unix systems using different naming conventions), the serial port device can be specified as a string instead. If omitted, default is 1.

smode

string, communication parameters, in the form "baud,parity,data_bits,stop_bits"

translation

string, either "auto", "binary", "cr", "crlf" or "lf". Default is "binary".

handshake

string, either "none", "rtscts", "xonxoff" or "dtrdsr"

xchar

xon and xoff characters

timeout

timeout for reading? msec

blocking

boolean, blocking mode of the serial channel. If %t, Scilab hangs until all the requested characters are read from or written to the serial port. Default is %f.

h

string, handle to the serial port file returned by TCL

Description

Wrapper to the TCL commands open and fconfigure. Parameters can be omitted or given with the named argument convention (e.g., openserial(1,handshake="rtscts"))

Serial port communication is supported (as of Tcl 8.4.11) only on Windows and Unix platforms.

Apparently, no port locking mechanism is implemented under my linux...

Examples

h = openserial(1,"9600,n,8,1")
writeserial(h, "#02"+ascii(13))
sleep(200)
readserial(h)
closeserial(h)

See Also

Contributors

Enrico SEGRE
Aditya SENGUPTA <apsengupta@iitb.ac.in>
Samuel GOUGEON
Silvio KUEHN

Bibliography

History

VersionDescription
0.5 Port numbers > 9 are now supported.

Report an issue
<< closeserial serial readserial >>