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.

gilsonpumpobjwriteminpress(gilsonPumpObj, minPress)
function gilsonpumpobjwriteminpress(gilsonPumpObj, minPress)
% GILSONPUMPOBJWRITEMINPRESS writes the min. pressure of Gilson 30x pumps
% gilsonpumpobjwriteminpress(gilsonPumpObj, minPress) writes the minimum
% pressure of Gilson 30x pumps, where gilsonPumpObj is a valid serial
% object generated by gilsonPumpObj.  Minimum pressure is in bar.  If you
% insist on giving it a non-integer minimum 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 if the arguments
maxPossiblePress = gilsonpumpobjreadmaxpossiblepress(gilsonPumpObj);

% error handling
if ~isnumeric(minPress) || ~isscalar(minPress) || isnan(minPress) || ~isreal(minPress) || minPress < 0 || minPress > maxPossiblePress
    % errors
    error('Minimum 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 minimum pressure
roundMinPress = round(minPress);

% checks the minimum pressure
if minPress ~= roundMinPress
    % rounds the number
    minPress = roundMinPress;
    
    % display a warning
    warning('Gilson30xWriteMinPress:ValueTooPrecise', 'Supplied minimum pressure was not an integer so has been rounded off.')
end

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

% navigates to minimum pressure menu, then enters the new pressure in, then
% navigates back to the flow menu
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, ['Kba', num2str(minPress), 'Ee']);

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

Contact us