-->ex355p
function [out] = ex355p(handle,command,data)
Scilab Driver for TTI EX355P power supply
Several power supplies may be connected on their respective ports on the
same computer. Each one will be addressed through its own handle.
REQUIREMENTS
------------
* Scilab >= 5 is required
* Serial TCL toolbox 0.2 (E. Segre) must be loaded:
http://atoms.scilab.org/toolboxes/serial
* OS: For Windows or Linux. Mac OS X does not support this driver (TCL used)
INPUT PARAMETERS
---------------
#1: Serial port number ('open' command), or handle returned by 'open'
(for all other commands). See examples.
#2: instruction to be performed by the device
#3: (optional) needed data (voltage or current value to be set, ...)
SERIAL CONNEXION
----------------
The power supply must be connected to the chosen serial port #1-9.
Connexion parameters are: 9600 bauds, 8 data bits, no parity, 1 stop bit.
port, 'open' : Open the RS-232 communication for the given RS-232 port.
If port is a string, it must follow the format "COM#:" or
'/dev/ttyS#' with # stating from 1 in the first case (Windows) and
from 0 in the second case (Linux). Else, integer numbers from 0 to 9
must be specified.
out = handle (string) of the device whether the connexion is
established, 0 otherwise.
handle, 'close' : Close the RS-232 communication for the given device (handle)
and frees the reserved port. out==1: OK ; out==0: KO
COMMANDS, DATA
--------------
After the 1st parameter = device handle (as returned by its 'open' command),
the second parameter is the command (case-insensitive). It can be:
"vset?" : returns the voltage setting (number in V)
"v?" : returns the actual voltage (number in V)
"v", v : sets the voltage to the value v (number in [0, 35] V)
"iset?" : returns the current setting (number in A)
"i?" : returns the actual current delivered (number in A)
"i", i : sets the current intensity to the value i (in [0 ,5] A)
"p?" : returns the actual power delivered (number in W)
"on" : activates the power output. Returns 1 if OK, 0 if KO
"off" : cancels the power output. Returns 1 if OK, 0 if KO.
"out?" : returns the output status: 'ON' | 'OFF'
"mode?" : returns the activated mode: "CC" | "CV"
(Constant Current or Constant Voltage). The actual mode is
automatically set by the device according to the output load and
V and I settings. It is not possible to force it.
"reset" : resets settings to Vset = 1V, Iset = 1A, no output
"id?" : returns the commercial identification of the device:
"name,model,0,version"
'err?' : returns the error status:
'no error' | 'unknown command' | 'out of range'
EXAMPLES:
--------
id = ex355p(3, "open"); // opens the serial com. through port #3,
// provided that the device is connected to this port
ex355p(id, "vset", 3.5); // sets U = 3.5 V
ex355p(id, "iset", 2.14); // sets I = 2.14 A
ex355p(id, "on"); // activates the output
ex355p(id, "v?"); // reads out the actual voltage
ex355p(id, "p?"); // reads out the actual power delivered
ex355p(id, "off"); // stops the output
ex355p(id, "id?"); // returns e.g. 'Thandar,EX355P,0,v2.00'
ex355p // displays these heading comments as an help