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.

pumpobjwritesetpress(pumpObj, setPress)
function pumpobjwritesetpress(pumpObj, setPress)
% PUMPOBJWRITESETPRESS sets set pressure of Jasco pumps
% pumpobjwritesetpress(pumpObj, setPress) changes the set pressure of Jasco
% pumps given a valid serial object and a set pressure from 0 to 350 bar.

% e.g. pumpobjwritesetpress(pumpObj(9), 150) - sets the set pressure of the
% pump on COM9 to 150 bar

% Range:

% pumpObj = valid serial port object

% setPress = unsigned integer: 0-350


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

% error handling
if ~isnumberbetween(setPress, 0, 350)
    % errors
    error('Set pressure must be an integer between 0 and 350 bar.')
end

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

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

Contact us