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.

pumpobjwritemaxpress(pumpObj, maxPress)
function pumpobjwritemaxpress(pumpObj, maxPress)
% PUMPOBJWRITEMAXPRESS sets maximum pressure of Jasco pumps
% pumpobjwritemaxpress(pumpObj, maxPress) changes the maximum pressure of
% Jasco pumps (where the pump will stop pumping automatically) given a
% valid serial object and a pressure from 0 to 350 bar.  The function
% automatically rounds the maximum pressure to the nearest integer.

% e.g. pumpobjwritemaxpress(pumpObj(9), 250) - sets maximum pressure of the
% pump on COM9 to 250 bar

% Range:

% pumpObj = valid serial port object

% maxPress = unsigned number: 0-350


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

% error handling
if ~isnumberbetween(maxPress, 0, 350)
    % errors
    error('Maximum pressure must be a number from 0 to 350 bar')
end

% checks the maximum pressure
if maxPress ~= round(maxPress)
    % display a warning (don't actually need to round it off as the sprintf
    % will deal with that)
    warning('JascoPumpWriteMaxPress:ValueTooPrecise', 'Supplied maximum pressure was not an integer so has been rounded off.')
end

% forms and writes command
pumpobjcomm('write', pumpObj, sprintf('%.0f pmax set', maxPress))

Contact us