Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

function status = gilsonpumpobjstatus(gilsonPumpObj)
% GILSONPUMPOBJSTATUS reads the status of Gilson 30x pumps
% gilsonobjstatus(gilsonPumpObj) reads the status of the pump.  Status is 1
% if it is running, and 0 if it is not.

% e.g. gilsonpumpobjstatus(gilsonPumpObj(6)) gets the status of the pump
% attached to COM6, e.g. 1 if it is pumping.

% checks the number of arguments
error(nargchk(1, 1, nargin))

% sets deviceID for future use
deviceID = 1;

% navigates back to the main menu

% then goes to the flow screen
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'Kda');

% selects the second line to read out next
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'W1');

% reads out the second line
bottomLine = gilsonpumpobjcomm('read', gilsonPumpObj, deviceID, 'W');

% gets the status
statusText = deblank(bottomLine(24:27));

% if it is stopped, start the pump, otherwise do nothing else
if strcmp(statusText, 'Run')
    % sets the status
    status = false;
elseif strcmp(statusText, 'Stop')
    % sets the status
    status = true;

% returns control back to the keypad
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'K');

% errors if it wasn't Run or Stop (does this afterwards so that the
% keypad control is correctly released)
if ~strcmp(statusText, 'Run') && ~strcmp(statusText, 'Stop')
    % errors
    error(['Unknown status of Gilson pump: ', status])

Contact us