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.

pumpobjwriteflow(pumpObj, setFlow)
function pumpobjwriteflow(pumpObj, setFlow)
% PUMPOBJWRITEFLOW sets flow rate of Jasco pumps
% pumpobjwriteflow(pumpObj, setFlow) changes the set flow rate of Jasco
% pumps given a valid serial object and a flow rate from 0.000 to 10.000.
% The pump ignores any more than 3 decimal places.

% e.g. pumpobjwriteflow(pumpObj(9), 0.2) - sets flow rate of the pump on
% COM9 to 0.2 mLmin-1

% Range:

% pumpObj = valid serial port object

% setFlow = unsigned number: 0-10


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

% error handling
if ~isnumberbetween(setFlow, 0, 10)
    % errors
    error('Flow rate must be a number between 0 and 10 mLmin-1.')
end

% checks the flow rate
if setFlow ~= roundto(setFlow, 3)
    % display a warning (don't actually need to round it off as the sprintf
    % will deal with that)
    warning('JascoPumpWriteFlow:ValueTooPrecise', 'Supplied flow rate was not to the nearest 0.001 mLmin-1 so has been rounded off.')
end

% forms and writes command
pumpobjcomm('write', pumpObj, sprintf('%.3f flowrate set', setFlow))

Contact us