The Instrument Control toolkit is a set of low level I/O functions for serial, i2c, spi, modbus, parallel, tcp, gpib, vxi11, udp and usbtmc interfaces
The Instrument Control toolkit must be installed and then loaded to be used.
It can be installed in GNU Octave directly from octave-forge, or can be installed in an off-line mode via a downloaded tarball.
The toolkit must be then be loaded once per each GNU Octave session in order to use its functionality.
For GPIB support (Linux only), linux-gpib must be installed before installing instrument-control. GPIB support is also available for windows by following the information from the wiki: https://wiki.octave.org/Instrument_control_package#Requirements
For VXI11 support, rpcgen, and libtirpc-devel must be installed before installing instrument-control.
For MODBUS support, the libmodbus-devel must be installed before installing instrument-control.
If using the GNU Octave installer in Windows, the toolkit will have already been installed, and does not need to be re-installed unless a newer version is available.
Run the following command to verify if the toolkit is available:
pkg list instrument-control
With an internet connection available, toolkit can be installed from octave-forge using the following command within GNU Octave:
pkg install -forge instrument-control
The latest released version of the toolkit will be downloaded, compiled and installed.
The Instrument control package provides low level I/O functions for serial, i2c, spi, parallel, tcp, gpib, vxi11, udp and usbtmc interfaces.
It was written mainly by the following developers:
The ability to use each interface is dependent on OS and what libraries were available during the toolkit install.
To verify the available interfaces, run the following command in octave:
instrhwinfo
The function will return information on the supported interfaces that are available, similar to below:
ToolboxVersion = 0.7.0
ToolboxName = octave instrument control package
SupportedInterfaces =
{
[1,1] = gpib
[1,2] = i2c
[1,3] = parallel
[1,4] = serial
[1,5] = serialport
[1,6] = tcp
[1,7] = tcpclient
[1,8] = udp
[1,9] = udpport
[1,10] = usbtmc
[1,11] = vxi11
}
Most interfaces have two types of functions:
|
NOTE: The serial object has been deprecated and may not appear in newer versions of the instrument-control toolbox. Instead new code should use the serialport object. |
The serial port can be opened using the serial function:
s = serial("/dev/ttyUSB1", 115200)
The first parameter is the device name and is OS specific. The second parameter is the baudrate.
A list of available serial ports can be retrieved using the function:
seriallist
After creating the interface object, properties of the device can be set or retrieved using get or set functions or as property access.
s = serial("/dev/ttyUSB1", 115200)
br = get(s, "baudrate") # gets the baudrate
br = s.baudrate # also gets the baudrate
set(s, "baudrate", 9600) # set the baudrate
s.baudrate = 9600 # also sets the baudrate
The device can be written and read from using fread, fwrite and srl_read and slr_write functions.
srl_write(s, "hello world") # write hello world fprintf(s, "hello again") val = srl_read(s, 10) # attempt to read val = fread(s, 10)
The device can be closed using fclose or srl_close.
fclose(s)
The recommended method of accessing serial ports is through the serialport object.
The serial port can be opened using the serialport function:
s = serialport("/dev/ttyUSB1", 115200)
The first parameter is the device name and is OS specific. The second parameter is the baudrate.
A list of available serial ports can be retrieved using the function:
serialportlist
After creating the interface object, properties of the device can be set or retrieved using get or set functions or as property access.
s = serialport("/dev/ttyUSB1", 115200)
br = get(s, "BaudRate") # gets the baudrate
br = s.BaudRate # also gets the baudrate
set(s, "BaudRate", 9600) # set the baudrate
s.BaudRate = 9600 # also sets the baudrate
The device can be written and read from using read and write functions.
write(s, "hello world") # write hello world val = read(s, 10)
The device can be closed by clearing the serialport object.
clear s
|
NOTE: The TCP object has been deprecated and may not appear in newer versions of the instrument-control toolbox. Instead new code should use the tcpclient object. |
A TCP connection can be opened using the tcp or tcpip function:
s = tcp("127.0.0.1", 80)
The first parameter is the IP address to connect to. The second parameter is the port number. And optional timeout value can be also be provided.
A more matlab compatible function is available as tcpip to also open a tcp port:
s = tcpip("gnu.org", 80)
The first parameter is a hostname or ip address, the second the port number. Additional parameter/value pairs can be provided after the port.
After creating the interface object, properties of the device can be set or retrieved using get or set functions or as property access.
s = tcp("127.0.0.1", 80)
oldtimeout = get(s, "timeout") # get timeout
set(s, "timeout", 10) # set the timeout
s.timeout = oldtimeout # also sets the timeout
The device can be written and read from using fread, fwrite and tcp_read and tcp_write functions.
tcp_write(s, "HEAD / HTTP/1.1\r\n\r\n") val = tcp_read(s, 100, 500) # attempt to read 100 bytes
The device can be closed using fclose or tcp_close.
fclose(s)
The recommended method of creating a tcp connection is through the tcpclient object.
A TCP connection can be opened using the tcpclient function:
s = tcpclient("127.0.0.1", 80)
The first parameter is the IP address or hostname to connect to. The second parameter is the port number.
Additional parameter/value pairs can be provided after the port.
After creating the interface object, properties of the device can be set or retrieved using get or set functions or as property access.
s = tcpclient("127.0.0.1", 80)
oldtimeout = get(s, "Timeout") # get timeout
set(s, "Timeout", 10) # set the timeout
s.Timeout = oldtimeout # also sets the timeout
The device can be written and read from using read and write functions.
write(s, "HEAD / HTTP/1.1\r\n\r\n") val = read(s, 100) # attempt to read 100 bytes
The device can be closed by clearing the object variable.
clear s
|
NOTE: The UDP object has been deprecated and may not appear in newer versions of the instrument-control toolbox. Instead new code should use the udpport object. |
A UDP connection can be opened using the udp function:
s = udp("127.0.0.1", 80)
The first parameter is the IP address data will be to. The second parameter is the port number.
If and ip address and port is not provides, it will default to "127.0.0.1" and 23.
The address and port can be changed after creation using the remotehost and remoteport properties.
s = udp() s.remotehost = "127.0.0.1"; s.remoteport = 100;
After creating the interface object, other properties of the device can be set or retrieved using get or set functions or as property access.
s = udp("127.0.0.1", 80)
oldtimeout = get(s, "timeout") # get timeout
set(s, "timeout", 10) # set the timeout
s.timeout = oldtimeout # also sets the timeout
The device can be written and read from using fread, fwrite and udp_read and udp_write functions.
udp_write(s, "test") val = udp_read(s, 5)
The device can be closed using fclose or udp_close.
fclose(s)
The recommended method of creating a udp socket is through the udpport object.
A udpport object can be created using the udpport function:
s = udpport()
Additional parameter/value pairs can be provided during creation of the object.
After creating the interface object, properties of the device can be set or retrieved using get or set functions or as property access.
s = udpport() oldtimeout = get(s, "Timeout") # get timeout set(s, "Timeout", 10) # set the timeout s.Timeout = oldtimeout # also sets the timeout
The device can be written and read from using read and write functions.
The destination address and port to send data to must be specified at least on the first time write is used.
write(s, "test", "127.0.0.1", s.LocalPort) val = read(s)
The device can be closed by clearing the object variable.
clear s
The functions currently available in the toolkit are described below.
(dev)Flush the instruments input buffers
dev - connected device or array of devices
None
See also: flushoutput.
(dev)Flush the instruments output buffers
dev - connected device or array of devices
None
See also: flushinput.
data = readbinblock (dev)data = readbinblock (dev, datatype)read a binblock of data from a instrument device
dev - connected device
datatype - optional data type to read data as (default ’uint8’)
data - data read
See also: flushoutput.
data = readline (dev)read data from a instrument device excluding terminator value
dev - connected device
data - ASCII data read
See also: flushoutput.
(dev, data, datatype)Write a IEEE 488.2 binblock of data to a instrument device
binblock formatted data is defined as:
#<A><B><C>
where: <A> ASCII number containing the length of part <B>
<B> ASCII number containing the number of bytes of <C>
<C> Binary data block
dev - connected device
data - binary data to send
datatype - datatype to send data as
None
See also: flushoutput.
()(funcname)(obj)Display instrument help
funcname - function to display help about.
obj - object to display help about.
If no input is provided, the function will display and overview of the package functionality.
None
[list] = instrhwinfo ()list = instrhwinfo (interface)Query available hardware for instrument-control
When run without any input parameters, instrhwinfo will provide the toolbox information and a list of supported interfaces.
interface is the instrument interface to query. When provided, instrhwinfo will provide information on the specified interface.
Currently only interface "serialport","i2c" and "spi" and is supported, which will provide a list of available serial ports or i2c ports.
If an output variable is provided, the function will store the information to the variable, otherwise it will be displayed to the screen.
instrhwinfo
scalar structure containing the fields:
ToolboxVersion = 0.4.0
ToolboxName = octave instrument control package
SupportedInterfaces =
{
[1,1] = i2c
[1,2] = parallel
[1,3] = serialport
[1,4] = tcp
[1,5] = udp
[1,6] = usbtmc
[1,7] = vxi11
}
name = resolvehost (host)[name, address] = resolvehost (host)out = resolvehost (host, returntype)Resolve a network host name or address to network name and address
host - Host name or IP address string to resolve.
name - Resolved IP host name.
returntype - ’name’ to get host name, ’address’ to get IP address.
name - Resolved IP host name.
address - Resolved IP host address.
out - host name if returntype is ’name’, ipaddress if returntype is ’address’
%% get resolved ip name and address of www.gnu.org
[name, address] = resolvehost ('www.gnu.org');
%% get ip address of www.gnu.org
ipaddress = resolvehost ('www.gnu.org', 'address');
See also: tcp, udp.
res = fopen (obj) (dummy)Opens connection to GPIB device obj This currently is a dummy function to improve compatibility to MATLAB
(obj, cmd)(obj, format, cmd)(obj, cmd, mode)(obj, format, cmd, mode)Writes string cmd to GPIB instrument
obj is a GPIB object
cmd String format Format specifier mode sync
data = fread (obj)data = fread (obj, size)data = fread (obj, size, precision)[data,count] = fread (obj, ...)[data,count,errmsg] = fread (obj, ...)Reads data from GPIB instrument
obj is a GPIB object
size Number of values to read. (Default: 100) precision precision of data
count values read errmsg read operation error message
res = fscanf (obj)res = fscanf (obj, format)res = fscanf (obj, format, size)[res,count] = fscanf (obj, ...)[res,count,errmsg] = fscanf (obj, ...)Reads data res from GPIB instrument
obj is a GPIB object
format Format specifier size number of values
count values read errmsg read operation error message
(obj, data)(obj, data, precision)(obj, data, mode)(obj, data, precision, mode)Writes data to GPIB instrument
obj is a GPIB object
data data to write precision precision of data mode sync
(obj)Send clear command to Clear GPIB instrument.
obj is a GPIB object
gpib = gpib ([gpibid], [timeout])Open gpib interface.
gpibid - the interface number.
timeout - the interface timeout value. If omitted defaults to blocking call.
The gpib() shall return instance of octave_gpib class as the result gpib.
(gpib)Close the interface and release a file descriptor.
gpib - instance of octave_gpib class.
[data, count, eoi] = gpib_read (gpib, n)Read from gpib interface.
gpib - instance of octave_gpib class.
n - number of bytes to attempt to read of type Integer.
The gpib_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array. eoi indicates read operation complete
(gpib, timeout)t = gpib_timeout (gpib)Set new or get existing gpib interface timeout parameter. The timeout value is valid from 0 to 17.
gpib - instance of octave_gpib class.
timeout - Value of 0 means never timeout, 11 means one second and 17 means 1000 seconds (see GPIB documentation (ibtmo) for further details)
If timeout parameter is omitted, the gpib_timeout() shall return current timeout value as the result t.
n = gpib_write (gpib, data)Write data to a gpib interface.
gpib - instance of octave_gpib class.
data - data to be written to the gpib interface. Can be either of String or uint8 type.
Upon successful completion, gpib_write() shall return the number of bytes written as the result n.
res = fopen (obj) (dummy)Opens I2C connection obj
This currently is a dummy function to improve compatibility to MATLAB
data = fread (obj)data = fread (obj, size)data = fread (obj, size, precision)[data,count] = fread (obj, ...)[data,count,errmsg] = fread (obj, ...)Reads data from I2C instrument
obj is a I2C object.
size Number of values to read. (Default: 100).
precision precision of data.
data data values.
count number of values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to I2C instrument
obj is a I2C object.
data data to write.
precision precision of data.
returns number of bytes written.
struct = get (i2c)field = get (i2c, property)Get the properties of i2c object.
i2c - instance of octave_i2c 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_i2c/set.
set (obj, property,value)set (obj, property,value,…)Set the properties of i2c object.
obj - instance of octave_i2c 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 name for the i2c socket.
Set the remote address for the i2c socket.
None
See also: @octave_i2c/get.
i2c = i2c ([port_path], [address])Open i2c interface.
port_path - the interface device port/path of type String. If omitted defaults to
’/dev/i2c-0’.
address - the slave device address. If omitted must be set using i2c_addr() call.
i2c - An instance of octave_i2c class.
The i2c object has the following properties:
Name of the object
the slave device address
The interface driver port (readonly)
(i2c, address)addr = i2c_addr (i2c)Set new or get existing i2c slave device address.
i2c - instance of octave_i2c class.
address - i2c slave device address of type Integer.
The address is passed in the 7 or 10 lower bits of the argument.
addr - If address parameter is omitted, the i2c_addr() shall return current i2c slave device address.
(i2c)Close the interface and release a file descriptor.
i2c - instance of octave_i2c class.
None
[data, count] = i2c_read (i2c, n)Read from i2c slave device.
i2c - instance of octave_i2c class.
n - number of bytes to attempt to read of type Integer.
The i2c_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
n = i2c_write (i2c, data)Write data to a i2c slave device.
i2c - instance of octave_i2c class.
data - data, of type uint8, to be written to the slave device.
Upon successful completion, i2c_write() shall return the number of bytes written as the result n.
struct = get (dev)field = get (dev, property)Get the properties of modbus object.
dev - instance of octave_modbus 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_modbus/set.
data = maskWrite (dev, address, andmask, ormask)data = maskWrite (dev, address, andmask, ormask, serverid)Read holding register at address from modbus device dev apply masking and write the change data.
writeregister value = (readregister value AND andMask) OR (orMask AND (NOT andMask))
dev - connected modbus device
address - address to read from.
andmask - AND mask to apply to the register
ormask - OR mask to apply to the register
serverId - address to send to (0-247). Default of 1 is used if not specified.
data - data read from the device
See also: modbus.
data = read (dev, target, address)data = read (dev, target, address, count)data = read (dev, target, address, count, serverId, precision)Read data from modbus device dev target target starting at address address.
dev - connected modbus device
target - target type to read. One of ’coils’, ’inputs’, ’inputregs’ or ’holdingregs’
address - address to start reading from.
count - number of elements to read. If not provided, count is 1.
serverId - address to send to (0-247). Default of 1 is used if not specified.
precision - Optional precision for how to interpret the read data. Currently known precision values are uint16 (default), int16, uint32, int32, uint64, uint64, single, double.
data - data read from the device
See also: modbus.
set (obj, property,value)set (obj, property,value,…)Set the properties of modbus object.
obj - instance of octave_modbus 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 stored string name of the object.
Set the timeout value.
Set the numretries value.
Set the byteorder value
Set the wordorder value
Set the userdata value
None
See also: @octave_modbus/get.
(dev, target, address, values)(dev, target, address, values, serverId, precision)Write data data to modbus device dev target target starting at address address.
dev - connected modbus device
target - target type to read. One of ’coils’ or ’holdingregs’
address - address to start reading from.
data - data to write.
serverId - address to send to (0-247). Default of 1 is used if not specified.
precision - Optional precision for how to interpret the write data. Currently known precision values are uint16 (default), int16, uint32, int32, uint64, uint64, single, double.
None
See also: modbus.
data = writeRead (dev, writeAddress, values, readAddress, readcount)data = writeRead (dev, writeAddress, values, readAddress, readcount, serverId)data = writeRead (dev, writeAddress, values, writePrecision, readAddress, readCount, readPrecision)Write data values to the modbus device dev holding registers starting at address writeAddress and then read readCount register values starting at address readAddress.
dev - connected modbus device
writeAddress - address to start writing to.
values - data to write to the device.
readAddress - address to start reading from.
readCount - number of elements to read.
serverId - address to send to (0-247). Default of 1 is used if not specified.
precision - Optional precision for how to interpret the read data. Currently known precision values are uint16 (default), int16, uint32, int32, uint64, uint64, single, double.
data - data read from the device
See also: modbus.
dev = modbus ('tcpip', deviceaddress)dev = modbus ('tcpip', deviceaddress, remoteport)dev = modbus ('tcpip', deviceaddress, name, value)dev = modbus ('serialrtu', serialport)dev = modbus ('serialrtu', serialport, name, value)Open modbus interface using a specified transport of ’tcpip’ or ’serialrtu’.
deviceaddress - the device ip address of type String.
remoteport - the device remote port number. If not specified, a default of 502 will be used.
name, value - Optional name value pairs for setting properties of the object.
serialport - the name of the serial port to connect to. It must be specified when transport is ’serialrtu’.
timeout value used for waiting for data
number of retries after a timeout
Additional data to attach to the object
Baudrate for the serial port
number of databits for serial port
Parity for serial port (’odd’, ’even’ or ’none’)
number of stopbits for serial port
The modbus() shall return instance of octave_modbus class as the result modbus.
The modbus object has the following public properties:
name assigned to the modbus object
instrument type ’modbus’ (readonly)
Remote port number or serial port name (readonly)
Device address if transport was ’tcpip’ (readonly)
status of the object ’open’ or ’closed’ (readonly)
timeout value used for waiting for data
number of retries after a timeout
Additional data to attach to the object
res = fopen (obj) (dummy)Opens parallel interface obj
This currently is a dummy function to improve compatibility to MATLAB
data = fread (obj)data = fread (obj, size)data = fread (obj, size, precision)[data,count] = fread (obj, ...)[data,count,errmsg] = fread (obj, ...)Reads data from parallel instrument
obj is a parallel object.
size Number of values to read. (Default: 1).
precision precision of data.
data The read data.
count values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to parallel instrument
obj is a parallel object.
data data to write.
precision precision of data.
returns number of bytes written.
parallel = parallel ([path], [direction])Open Parallel interface.
path - the interface path of type String. If omitted defaults to ’/dev/parport0’.
direction - the direction of interface drivers of type Integer, see: PP_DATADIR for more info.
If omitted defaults to 1 (Input).
The parallel() shall return instance of octave_parallel class as the result parallel.
(parallel)Close the interface and release a file descriptor.
parallel - instance of octave_serial class.
None
(parallel, ctrl)c = pp_ctrl (parallel)Sets or Read the Control lines.
parallel - instance of octave_parallel class.
ctrl - control parameter to be set of type Byte.
If ctrl parameter is omitted, the pp_ctrl() shall return current Control lines state as the result c.
(parallel, data)d = pp_data (parallel)Sets or Read the Data lines.
parallel - instance of octave_parallel class.
data - data parameter to be set of type Byte.
If data parameter is omitted, the pp_data() shall return current Data lines state as the result d.
(parallel, direction)dir = pp_datadir (parallel)Controls the Data line drivers.
Normally the computer’s parallel port will drive the data lines, but for byte-wide transfers from the peripheral to the host it is useful to turn off those drivers and let the peripheral drive the signals. (If the drivers on the computer’s parallel port are left on when this happens, the port might be damaged.)
parallel - instance of octave_parallel class.
direction - direction parameter of type Integer. Supported values: 0 - the drivers are turned on
(Output/Forward direction); 1 - the drivers are turned off (Input/Reverse direction).
If direction parameter is omitted, the pp_datadir() shall return current Data direction as the result dir.
(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.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to serial instrument
obj is a serial object.
data data to write.
precision precision of data.
returns number of bytes written.
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.
(serial)(serial, time)Send a break to the serial port
serial - serial object
time - number of milliseconds to break for. If not specified a value of 10 will be used.
None
See also: serial.
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.
(serial, term)(serial, readterm, writeterm)Set terminator for ASCII string manipulation
serial - serialport object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data
The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.
None
See also: serialport.
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the serial port buffers
dev - connected serialport device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: serialport.
numbytes = fprintf (obj, template ...)Writes formatted string template using optional parameters to serialport instrument
obj is a serialport 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 port instrument
obj is a serialport object.
size Number of values to read.
precision precision of data.
data The read data.
count number of values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to serial port instrument
obj is a serial port object.
data data to write.
precision precision of data.
returns number of bytes written.
struct = get (serial)field = get (serial, property)Get the properties of serialport object.
serial - instance of octave_serialport 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.
status getpinstatus (serial)Get status of serial pins
serial - serial object
status - a structure with the logic names of ClearToSend, DataSetReady, CarrierDetect, and RingIndicator
See also: serialport.
data = read (dev, count)data = read (dev, count, precision)Read a specified number of values from a serialport using optional precision for valuesize.
dev - connected serialport device
count - number of elements to read
precision - Optional precision for the output data read data. Currently known precision values are uint8 (default), int8, uint16, int16, uint32, int32, uint64, uint64
data - data read from the device
See also: serialport.
(serial)(serial, time)Send a break to the serial port
serial - serialport object
time - number of milliseconds to break for. If not specified a value of 10 will be used.
None
See also: serial.
set (obj, property,value)set (obj, property,value,…)Set the properties of serialport object.
serial - instance of octave_serialport 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_serialport/-get.
(dev, true_false)Set the state of the DTR line
dev - connected serial device.
true_false - state to set the line.
None
See also: serialport, getpinstatus, setRTS.
(dev, true_false)Set the state of the RTS line
dev - connected serial device.
true_false - state to set the line.
None
See also: serialport, getpinstatus.
numbytes = write (obj, data)numbytes = write (obj, data, precision)Writes data to serialport instrument
obj is a serialport object.
data data to write.
precision precision of data.
returns number of bytes written.
serial = serialport ([path], [baudrate])serial = serialport ([path], [propname, propvalue])Open serial port interface.
path - the interface path of type String.
baudrate - the baudrate of interface.
propname,propvalue - property name/value pairs.
Known input properties:
Numeric baudrate value
Numeric timeout value in seconds or -1 to wait forever
number of stopbits to use
Parity setting ’none’, ’even’, ’odd’
Number of bits to a byte (5 to 8)
Number of bits to a byte ’none’, ’hardware’, ’software’
User settable string to identify the port.
The serialport() shall return an instance of octave_serialport 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 bytes written (readonly)
number of stopbits to use
Parity setting ’none’, ’even’, ’odd’
Number of bits to a byte (5 to 8)
Baudrate setting
Number of bits to a byte ’none’, ’hardware’, ’software’
current state of pins (readonly)
user defined data
user defined tag name
list = serialportlist ()list = serialportlist ("all")list = serialportlist ("available")Returns a list of all serial ports detected in the system.
’all’ - show all serial ports (same as providing no arguments) ’available’ - show only serial ports that are available for use
list is a string cell array of serial ports names detected in the system.
See also: instrhwinfo("serialport").
res = fopen (obj) (dummy)Opens SPI connection obj
This currently is a dummy function to improve compatibility to MATLAB
data = fread (obj)data = fread (obj, size)data = fread (obj, size, precision)[data,count] = fread (obj, ...)[data,count,errmsg] = fread (obj, ...)Reads data from a SPI instrument
obj is a SPI object.
size Number of values to read. (Default: 10).
precision precision of data.
data data values.
count number of values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to SPI instrument
obj is a SPI object.
data data to write.
precision precision of data.
returns number of bytes written.
struct = get (spi)field = get (spi, property)Get the properties of spi object.
spi - instance of octave_spi class.
property - name of property.
Name for the spi socket.
The bitrate for the spi object.
The clock polarity for the spi object of ’idlehigh’ or ’idlelow’.
The clock phase for the spi object of ’firstedge’ or ’secondedge’.
The device port name.
The device status of ’open’ or ’closed’
When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.
See also: @octave_spi/set.
data = read (obj)data = read (obj, size)Reads data from SPI instrument
obj is a SPI object.
size Number of values to read. (Default: 10).
data data values.
set (obj, property,value)set (obj, property,value,…)Set the properties of spi object.
obj - instance of octave_spi 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 name for the spi socket.
Set the bitrate for the spi object.
Set the clock polarity for the spi object of ’idlehigh’ or ’idlelow’.
Set the clock phase for the spi object of ’firstedge’ or ’secondedge’.
None
See also: @octave_spi/get.
numbytes = fwrite (obj, data)Writes data to SPI instrument
obj is a SPI object.
data data to write.
returns number of bytes written.
data = writeAndRead (obj, wrdata)Writes and reads data from SPI instrument
obj is a SPI object.
wrdata Data to write.
data data values read.
spi = spi ([port_path])spi = spi ([port_path], [propname, propvalue])Open a spi interface.
port_path - the interface device port/path of type String. If omitted defaults to
’/dev/spi-0’.
propname,propvalue - property name/value pairs.
Known input properties:
Name of the object
Numeric bitrate value
Clock polarity: idlehigh or idlelow.
Clock phase value: firstedge or secondedge
spi - An instance of octave_spi class.
The spi object has the following properties:
Name of the object
Open or closed status of object (readonly).
Numeric bitrate value
Clock polarity: idlehigh or idlelow.
Clock phase value: firstedge or secondedge
The interface driver port (readonly)
(spi)Close the interface and release a file descriptor.
spi - instance of octave_spi class.
None
[data, count] = spi_read (spi, n)Read from spi slave device.
spi - instance of octave_spi class.
n - number of bytes to attempt to read of type Integer.
The spi_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
n = spi_write (spi, data)Write data to a spi slave device.
spi - instance of octave_spi class.
data - data, of type uint8, to be written to the slave device.
Upon successful completion, spi_write() shall return the number of bytes written as the result n.
rddata = spi_writeAndRead (spi, wrdata)Write data to a spi slave device and then read same number of values.
spi - instance of octave_spi class.
wrdata - data, of type uint8, to be written to the slave device.
Upon successful completion, spi_writeAndRead() shall return the bytes read.
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the tcp socket buffers
dev - connected tcp device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: serialport.
(tcp)Flush the pending input, which will also make the BytesAvailable property be 0.
tcp - instance of octave_tcp class.
None.
See also: flushoutput.
(tcp)Flush the output buffer.
tcp - instance of octave_tcp class.
None.
See also: flushinput.
res = fopen (obj) (dummy)Opens TCP connection obj
This currently is a dummy function to improve compatibility to MATLAB
numbytes = fprintf (obj, template ...)Writes formatted string template using optional parameters to TCP instrument
obj is a TCP object.
template Format template string
Number of characters written
data = fread (obj)data = fread (obj, size)data = fread (obj, size, precision)[data,count] = fread (obj, ...)[data,count,errmsg] = fread (obj, ...)Reads data from TCP instrument
obj is a TCP object.
size Number of values to read. (Default: 100).
precision precision of data.
data data read.
count values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to TCP instrument
obj is a TCP object.
data data to write.
precision precision of data.
returns number of bytes written.
struct = get (tcp)field = get (tcp, property)Get the properties of tcp object.
tcp - instance of octave_tcp 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_tcp/set.
data = read (obj)data = read (obj, size)data = read (obj, size, datatype)Reads data from TCP instrument
obj is a TCP object.
size Number of values to read. (Default: 100).
datatype datatype of data.
data data read.
set (obj, property,value)set (obj, property,value,…)Set the properties of tcp object.
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 name for the tcp socket.
Set the remote host name for the tcp socket.
Set the remote port for the tcp socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
None
See also: @octave_tcp/get.
numbytes = write (obj, data)numbytes = write (obj, data, datatype)Writes data to TCP instrument
obj is a TCP object.
data data to write.
datatype datatype of data. If not specified, it defaults to "uint8".
returns number of bytes written.
tcp = tcp ()tcp = tcp (ipaddress)tcp = tcp (ipaddress, port)tcp = tcp (ipaddress, port, timeout)tcp = tcp (ipaddress, [propertyname, propertyvalue])tcp = tcp (ipaddress, port, [propertyname, propertyvalue])Open tcp interface.
ipaddress - the ip address of type String. If omitted defaults to ’127.0.0.1’.
port - the port number to connect. If omitted defaults to 23.
timeout - the interface timeout value. If omitted defaults to blocking call.
propname,propvalue - property name/value pairs.
Known input properties:
name value
Numeric timeout value or -1 to wait forever
The tcp() shall return instance of octave_tcp class as the result tcp.
The tcp object has the following public properties:
name assigned to the tcp object
instrument type ’tcp’ (readonly)
local port number (readonly)
remote port number
remote host
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
(tcp)Close the interface and release a file descriptor.
tcp - instance of octave_tcp class.
None
[data, count] = tcp_read (tcp, n, timeout)Read from tcp interface.
tcp - instance of octave_tcp class.
n - number of bytes to attempt to read of type Integer
timeout - timeout in ms if different from default of type Integer
count - number of bytes successfully read as an Integer
data - data bytes themselves as uint8 array.
(tcp, timeout)t = tcp_timeout (tcp)Set new or get existing tcp interface timeout parameter used for tcp_read() requests. The timeout value is specified in milliseconds.
tcp - instance of octave_tcp class.
timeout - tcp_read() timeout value in milliseconds. Value of -1 means a blocking call.
If timeout parameter is omitted, the tcp_timeout() shall return current timeout value as the result t.
n = tcp_write (tcp, data)Write data to a tcp interface.
tcp - instance of octave_tcp class.
data - data to be written to the tcp interface. Can be either of String or uint8 type.
Upon successful completion, tcp_write() shall return the number of bytes written as the result n.
tcp = tcpip (host, [port], [PropertyName, PropertyValue...])Matlab compatible wrapper to the tcp interface.
NOTE: tcpip has been deprecated. Use tcpclient instead
host - the host name or ip.
port - the port number to connect. If omitted defaults to 80.
PropertyName, PropertyValue - Optional property name, value pairs to set on the tcp object.
Currently the only known properties are "timeout" and "name".
tcpip will return an instance of octave_tcp class as the result.
(tcp, term)(tcp, readterm, writeterm)Set terminator on a tcpclient object for ASCII string manipulation
tcp - tcpclient object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data
The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.
None
See also: tcpport.
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the tcpclient socket buffers
dev - connected tcpclient device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: serialport.
struct = get (tcpclient)field = get (tcpclient, property)Get the properties of tcpclient object.
tcpclient - instance of octave_tcpclient 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_tcpclient/set.
data = read (obj)data = read (obj, size)data = read (obj, size, datatype)Reads data from TCP instrument
obj is a TCP object.
size Number of values to read. (Default: NumBytesAvailable).
datatype datatype of data.
data data read.
set (obj, property,value)set (obj, property,value,…)Set the properties of tcpclient object.
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 name for the tcpclient socket.
Set user data for the tcpclient socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
Set user tag to identify the port
None
See also: @octave_tcpclient/get.
numbytes = write (obj, data)numbytes = write (obj, data, datatype)Writes data to TCP instrument
obj is a TCPclient object.
data data to write.
datatype datatype of data. If not specified, it defaults to "uint8".
returns number of bytes written.
tcpclient = tcpclient (ipaddress, port)tcpclient = tcpclient (ipaddress, port, [propertyname, propertyvalue])Open tcpclient interface.
ipaddress - the ip address of type String.
port - the port number to connect.
propname,propvalue - property name/value pairs.
Known input properties:
name value
tag value
Numeric timeout value or -1 to wait forever
Boolean to enable or disable the nagle algorithm for delay transfer.
User data value.
The tcpclient() shall return instance of octave_tcpclient class as the result tcpclient.
The tcpclient object has the following public properties:
name assigned to the tcpclient object
user tag assigned to the tcpclient object
instrument type ’tcpclient’ (readonly)
remote port number (Readonly)
remote host address (Readonly)
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
number of bytes currently available to read (readonly)
Byte order for data (currently not used)
Terminator value used for string data (currently not used)
User data
Bool for whether transfer delay is enabled. (Read only)
(tcp, term)(tcp, readterm, writeterm)Set terminator on a tcpserver object for ASCII string manipulation
tcp - tcpserver object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data
The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.
None
See also: tcpport.
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the tcpserver socket buffers
dev - connected tcpserver device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: serialport.
struct = get (tcpserver)field = get (tcpserver, property)Get the properties of tcpserver object.
tcpserver - instance of octave_tcpserver 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_tcpserver/set.
data = read (obj)data = read (obj, size)data = read (obj, size, datatype)Reads data from TCP instrument
obj is a TCP Server object.
size Number of values to read. (Default: NumBytesAvailable).
datatype datatype of data.
data data read.
set (obj, property,value)set (obj, property,value,…)Set the properties of tcpserver object.
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 name for the tcpserver socket.
Set user data for the tcpserver socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
None
See also: @octave_tcpserver/get.
numbytes = write (obj, data)numbytes = write (obj, data, datatype)Writes data to TCP instrument
obj is a TCPServer object.
data data to write.
datatype datatype of data. If not specified, it defaults to "uint8".
returns number of bytes written.
tcpserver = tcpserver (ipaddress, port)tcpserver = tcpserver (port)tcpserver = tcpserver (…, [propertyname, propertyvalue])Open tcpserver interface.
ipaddress - the ip address of type String.
port - the port number to bind.
propname,propvalue - property name/value pairs.
Known input properties:
name value
Numeric timeout value or -1 to wait forever
User data value.
The tcpserver() shall return instance of octave_tcpserver class as the result tcpserver.
The tcpserver object has the following public properties:
boolean flag for when connected to a client (Readonly)
connected client port number (Readonly)
connected client address (Readonly)
name assigned to the tcpserver object
instrument type ’tcpserver’ (readonly)
server port number (Readonly)
server address (Readonly)
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
number of bytes currently available to read (readonly)
Byte order for data (currently not used)
Terminator value used for string data (currently not used)
User data
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the udp socket buffers
dev - open udp device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: udp.
(udp)Flush the pending input, which will also make the BytesAvailable property be 0.
udp - instance of octave_udp class.
None
See also: flushoutput.
(udp)Flush the output buffer.
udp - instance of octave_udp class.
None
See also: flushinput.
res = fopen (obj) (dummy)Opens UDP connection obj This currently is a dummy function to improve compatibility to MATLAB
numbytes = fprintf (obj, template ...)Writes formatted string template using optional parameters to UDP instrument
obj is a UDP object.
template Format template string.
numbytes is the number of bytes written to the 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 UDP instrument
obj is a UDP object.
size Number of values to read. (Default: 100).
precision precision of data.
data data values.
count number of values read.
errmsg read operation error message.
numbytes = fwrite (obj, data)numbytes = fwrite (obj, data, precision)Writes data to UDP instrument
obj is a UDP object.
data data to write.
precision precision of data.
returns number of bytes written.
struct = get (udp)field = get (udp, property)Get the properties of udp object.
udp - instance of octave_udp 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_udp/set.
data = read (obj)data = read (obj, size)data = read (obj, size, datatype)Reads data from UDP instrument
obj is a UDP object.
size Number of values to read. (Default: BytesAvailable).
datatype datatype of data.
data data read.
set (obj, property,value)set (obj, property,value,…)Set the properties of udp object.
obj - instance of octave_udp 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 name for the udp socket.
Set the remote host name for the udp socket.
Set the remote port for the udp socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
None
See also: @octave_udp/get.
numbytes = write (obj, data)numbytes = write (obj, data, destinationAddress, destinationPort))numbytes = write (obj, data, datatype)numbytes = write (obj, data, datatype, destinationAddress, destinationPort)Writes data to UDP instrument
obj is a UDP object.
data data to write.
datatype datatype of data. If not specified defaults to uint8.
destinationAddress ipaddress to send to. If not specified, use the remote address.
destinationPort port to send to. If not specified, use the remote port.
returns number of bytes written.
udp = udp ()udp = udp (remoteipaddress, remoteport)udp = udp (remoteipaddress, remoteport, [propertyname, propertyvalue ...])Open udp interface.
remoteipaddress - the ip address of type String. If omitted defaults to ’127.0.0.1’.
remoteport - the port number to connect. If omitted defaults to 23.
localport - the local port number to bind. If omitted defaults to 0
propertyname, propertyvalue - property name/value pair
The udp() shall return instance of octave_udp class as the result udp.
The udp object has the following public properties:
name assigned to the udp object
instrument type ’udp’ (readonly)
local port number (readonly)
local host address (readonly)
remote port number
remote host
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
(udp)Close the interface and release a file descriptor.
udp - instance of octave_udp class.
None
result = udp_demo ()Run test SNTP demonstration for udp class
See also: udp.
[data, count] = udp_read (udp, n, timeout)Read from udp interface.
udp - instance of octave_udp class.
n - number of bytes to attempt to read of type Integer
timeout - timeout in ms if different from default of type Integer
The udp_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
(udp, timeout)t = udp_timeout (udp)Set new or get existing udp interface timeout parameter used for udp_read() requests. The timeout value is specified in milliseconds.
udp - instance of octave_udp class.
timeout - udp_read() timeout value in milliseconds. Value of -1 means a blocking call.
If timeout parameter is omitted, the udp_timeout() shall return current timeout value as the result t.
n = udp_write (udp, data)Write data to a udp interface.
udp - instance of octave_udp class.
data - data to be written to the udp interface. Can be either of String or uint8 type.
Upon successful completion, udp_write() shall return the number of bytes written as the result n.
data = configureMulticast((dev, address)data = configureMulticast((dev, "off")Configure udpport device to receive multicast data
dev - open udpport device
If address is ’off’ disable udp multicast. Otherwise it is the multicast address to use.
None
See also: udpport.
(udp, term)(udp, readterm, writeterm)Set terminator for ASCII string manipulation
udp - udpport object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data
The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.
None
See also: udpport.
data = flush (dev)data = flush (dev, "input")data = flush (dev, "output")Flush the udpport socket buffers
dev - open udpport device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: udpport.