Code covered by the BSD License  

Highlights from
Jasco Pumps RS232 communicatios

Jasco Pumps RS232 communicatios

by

 

20 May 2013 (Updated )

Commands to read and control Jasco pumps via RS232.

pumpobjwritesetpress(serialObject, setPress)
function pumpobjwritesetpress(serialObject, setPress)
% PUMPOBJWRITESETPRESS sets set pressure of Jasco pumps
% pumpobjwritesetpress(serialObject, 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(serialObject, 150) - sets the set pressure of the
% pump to 150 bar

% Range:

% serialObject = valid serial port object

% setPress = unsigned integer: 0-350


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

% error handling
if ~isscalar(setPress) || ~isnumeric(setPress) || setPress < 0 || setPress > 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', serialObject, sprintf('%.0f press set', setPress))

Contact us