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 gilsonpumpobjconnect(serialObject)
% GILSONPUMPOBJCONNECT initialises communication with Gilson pumps
% gilsonpumpobjconnect(serialObject) initialises communication with Gilson
% pumps, given serialObject as a valid pump serial object (generated by
% gilsonpumpobj).

% e.g. gilsonpumpobjconnect(gilsonpumpobj(6)) - initialises communication
% with the pump attached to COM6

% Range:

% serialObject = valid serial port object

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

% error handling
if ~isserial(serialObject) || isrunning(serialObject)
    % errors
    error('serialObject must be a valid closed serial object.')
elseif isfield(serialObject.UserData, 'realTermHandle') && isrunning(serialObject.UserData.realTermHandle)
    % errors
    error('The realterm application must not be connected.')

% if the real term handle is there, do a different sequence of events
if isfield(serialObject.UserData, 'realTermHandle')
    % run the real term opener
    serialObject.UserData.captureFileID = realtermfopen(serialObject.UserData.realTermHandle);

    % opens communication

% fetches some information
    % gets the pump head size, the manometric module, and maximum possible
    % pressure, if it can
    [maxPossiblePress, manometricModule, pumpHeadSize] = gilsonpumpobjreadmaxpossiblepress(serialObject);

	% stores it in the user data (maxFlow is currently not used in the
	% CO2gui, but is there for future use)
    serialObject.UserData = catstructs(serialObject.UserData, struct(   'maxPossiblePress', maxPossiblePress,...
                                                                        'manometricModule', manometricModule,...
                                                                        'pumpHeadSize', pumpHeadSize,...
                                                                        'maxFlow', pumpHeadSize));

    % displays a warning
    warning('gilson:connectionInfo', 'Did not retrieve some pump information (pump may be priming).')

Contact us