(serial)
¶Flush the pending input, which will also make the BytesAvailable property be 0.
serial - instance of octave_serial class.
None
See also: srl_flush, flushoutput.
(serial)
¶Flush the output buffer.
serial - instance of octave_serial class.
None
See also: srl_flush, flushinput.
res =
fopen (obj) (dummy)
¶Opens SERIAL interface obj
This currently is a dummy function to improve compatibility to MATLAB
numbytes =
fprintf (obj, template ...)
¶Writes formatted string template using optional parameters to serial instrument
obj is a serial object.
template Format template string
numbytes - number of bytes written to the serial device.
data =
fread (obj)
¶data =
fread (obj, size)
¶data =
fread (obj, size, precision)
¶[data,count] =
fread (obj, ...)
¶[data,count,errmsg] =
fread (obj, ...)
¶Reads data from serial instrument
obj is a serial object.
size Number of values to read. (Default: 100).
precision precision of data.
data The read data.
count values read.
errmsg read operation error message.
struct =
get (serial)
¶field =
get (serial, property)
¶Get the properties of serial object.
serial - instance of octave_serial class.
property - name of property.
When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.
See also: @octave_serial/set.
set
(obj, property,value)
¶set
(obj, property,value,…)
¶Set the properties of serial object.
serial - instance of octave_serial class.
property - name of property.
If property is a cell so must be value, it sets the values of all matching properties.
The function also accepts property-value pairs.
Set the baudrate of serial port. Supported values by instrument-control: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200 and 230400. The supported baudrate of your serial port may be different.
Set the bytesize. Supported values: 5, 6, 7 and 8.
Set the stored string name of the serial object.
Set the parity value. Supported values: Even/Odd/None. This Parameter must be of type string. It is case insensitive and can be abbreviated to the first letter only
Set the number of stopbits. Supported values: 1, 2.
Set the timeout value in tenths of a second. Value of -1 means a blocking call. Maximum value of 255 (i.e. 25.5 seconds).
Set the requesttosend (RTS) line.
Set the dataterminalready (DTR) line.
None
See also: @octave_serial/get.
(serial, baudrate)\
¶br =
srl_baudrate (serial)
¶Set new or get existing serial interface baudrate parameter. Only standard values are supported.
serial - instance of octave_serial class.
baudrate - the baudrate value used. Supported values: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600 19200, 38400, 57600, 115200 and 230400.
If baudrate parameter is omitted, the srl_baudrate() shall return current baudrate value as the result br.
br - The currently set baudrate
This function is obsolete. Use get and set method instead.
(serial, bsize)
¶bs =
srl_bytesize (serial)
¶Set new or get existing serial interface byte size parameter.
serial - instance of octave_serial class.
bsize - byte size of type Integer. Supported values: 5/6/7/8.
If bsize parameter is omitted, the srl_bytesize() shall return current byte size value or in case of unsupported setting -1, as the result bs.
This function is obsolete. Use get and set method instead.
bs -the currently set byte size.
(serial)
¶Close the interface and release a file descriptor.
serial - instance of octave_serial class.
This function is obsolete. Use fclose() method instead.
None
(serial, [q])
¶Flush the pending input/output.
serial - instance of octave_serial class.
q - queue selector of type Integer. Supported values:
flush untransmitted output
flush pending input
flush both pending input and untransmitted output.
If q parameter is omitted, the srl_flush() shall flush both, input and output buffers.
None
(serial, parity)
¶p =
srl_parity (serial)
¶Set new or get existing serial interface parity parameter. Even/Odd/None values are supported.
serial - instance of octave_serial class.
parity - parity value of type String. Supported values:
Even/Odd/None (case insensitive, can be abbreviated to the first letter only)
If parity parameter is omitted, the srl_parity() shall return current parity value as the result p.
This function is obsolete. Use get and set method instead.
p - The currently set parity
(serial, stopb)
¶sb =
srl_stopbits (serial)
¶Set new or get existing serial interface stop bits parameter. Only 1 or 2 stop bits are supported.
serial - instance of octave_serial class.
stopb - number of stop bits used. Supported values: 1, 2.
If stopb parameter is omitted, the srl_stopbits() shall return current stop bits value as the result sb.
This function is obsolete. Use get and set method instead.
(serial, timeout)
¶t =
srl_timeout (serial)
¶Set new or get existing serial interface timeout parameter used for srl_read() requests. The timeout value is specified in tenths of a second.
serial - instance of octave_serial class.
timeout - srl_read() timeout value in tenths of a second.
A value of -1 means a blocking call. Maximum value of 255 (i.e. 25.5 seconds).
If timeout parameter is omitted, the srl_timeout() shall return current timeout value as the result t.
This function is obsolete. Use get and set method instead.
serial =
serial ([path], [baudrate], [timeout])
¶Open serial interface.
path - the interface path of type String.
baudrate - the baudrate of interface. If omitted defaults to 115200.
timeout - the interface timeout value. If omitted defaults to blocking call.
The serial() shall return an instance of octave_serial class as the result serial.
The serial object has the following public properties:
name assigned to the object
instrument type ’serial’ (readonly)
OS specific port name (readonly)
status of the object ’open’ or ’closed’ (readonly)
timeout value used for waiting for data
number of bytes currently available to read (readonly)
number of stopbits to use
request to send state - ’on’ or ’off’
Parity setting ’none’, ’even’, ’odd’
Number of bits to a byte (7 or 8)
Baudrate setting
state of dataterminal ready - ’on’ or ’off’
current state of pins (readonly)
list =
seriallist ()
¶Returns a list of all serial ports detected in the system.
None
list is a string cell array of serial ports names detected in the system.
See also: instrhwinfo("serial").
[data, count] =
srl_read (serial, n)
¶Read from serial interface.
serial - instance of octave_serial class.
n - number of bytes to attempt to read of type Integer.
The srl_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
n =
srl_write (serial, data)
¶Write data to a serial interface.
serial - instance of octave_serial class.
data - data to be written to the serial interface. Can be either of String or uint8 type.
Upon successful completion, srl_write() shall return the number of bytes written as the result n.