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.

gilsonpumpobjwritepresssetup(gilsonPumpObj, minPress, maxPress)
function gilsonpumpobjwritepresssetup(gilsonPumpObj, minPress, maxPress)
% GILSONPUMPOBJWRITEPRESSSETUP writes the pressure setup of Gilson 30x pumps
% gilsonpumpobjwritepresssetup(gilsonPumpObj, minPress, maxPress) writes
% the minimum and maximum pressure of Gilson 30x pumps, where gilsonPumpObj
% is a valid serial object generated by gilsonPumpObj.  Minimum and maximum
% pressure is in bar.  If you insist on giving it a non-integer pressure,
% it will be rounded off.

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

% deviceID
deviceID = 1;

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

% error handling
if strcmp(manometricModule, 'None')
    % errors
    error('Cannot set pressures if no manometric module is installed.')
elseif ~isscalar(minPress) || ~isnumberbetween(minPress, 0, maxPossiblePress)
    % errors
    error('Minimum pressure must be an integer between 0 and %d.', maxPossiblePress)
elseif ~isscalar(maxPress) || ~isnumberbetween(maxPress, minPress, maxPossiblePress)
    % errors
    error('Maximum pressure must be an integer between the minimum pressure (%d) and %d.', minPress, maxPossiblePress)

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

% rounds the maximum pressure (and warns if it does)
maxPress = roundto(maxPress, 0, true);

% navigates to maximum pressure menu, then enters the new pressure in,
% presses enter, then navigates to the minimum pressure menu, enters that
% in, presses enter, then navigates back to the main menu
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, ['Kb', num2str(maxPress), 'E', num2str(minPress), 'Ee']);

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

Contact us