Code covered by the BSD License  

Highlights from
Jasco Pumps RS232 communicatios

Jasco Pumps RS232 communicatios



20 May 2013 (Updated )

Commands to read and control Jasco pumps via RS232.

pumpobjwriteflow(serialObject, setFlow)
function pumpobjwriteflow(serialObject, setFlow)
% PUMPOBJWRITEFLOW sets flow rate of Jasco pumps
% pumpobjwriteflow(serialObject, 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(serialObject, 0.2) - sets flow rate of the pump to
% 0.2 mL min-1

% Range:

% serialObject = valid serial port object

% setFlow = unsigned number: 0-10

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

% error handling
if ~isscalar(setFlow) || ~isnumeric(setFlow) || setFlow < 0 || setFlow > 10
    % errors
    error('Flow rate must be a number between 0 and 10 mL min-1.')

% 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.')

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

Contact us