Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

gilsonpumpobjwritemaxpress(gilsonPumpObj, maxPress)
function gilsonpumpobjwritemaxpress(gilsonPumpObj, maxPress)
% GILSONPUMPOBJWRITEMAXPRESS writes the max. pressure of Gilson 30x pumps
% gilsonpumpobjwritemaxpress(gilsonPumpObj, maxPress) writes the maximum
% pressure of Gilson 30x pumps, where gilsonPumpObj is a valid serial
% object generated by gilsonPumpObj.  Maximum pressure is in bar.  If you
% insist on giving it a non-integer maximum pressure, it will be rounded
% off.

% error handling
if nargin < 2
    % errors
    error('Insufficient arguments.')
end

% deviceID
deviceID = 1;

% gets the maximum possible pressure (ignores the rest of the arguments)
maxPossiblePress = gilsonpumpobjreadmaxpossiblepress(gilsonPumpObj);

% error handling of minPress
if ~isnumeric(maxPress) || ~isscalar(maxPress) || isnan(maxPress) || ~isreal(maxPress) ||maxPress < 0 || maxPress > maxPossiblePress
    % errors
    error('Maximum pressure must be an integer between 0 and %d.', maxPossiblePress)
elseif strcmp(manometricModule, 'None')
    % errors
    error('Cannot set minimum pressure if no manometric module is installed.')
end

% rounds the maximum pressure
roundMaxPress = round(maxPress);

% checks the maximum pressure
if maxPress ~= roundMaxPress
    % rounds the number
    maxPress = roundMaxPress;
    
    % display a warning
    warning('Gilson30xWriteMaxPress:ValueTooPrecise', 'Supplied maximum pressure was not an integer so has been rounded off.')
end

% no easy way of writing maximum pressure, so need to navigate into the
% correct menu
gilsonpumpobjmainmenu(gilsonPumpObj)

% navigates to maximum pressure menu, then enters the new pressure in, then
% navigates back to the pump menu
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, ['Kb', num2str(maxPress), 'Ee']);

% reconnects the keypad
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'K');

Contact us