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.

pumpobjwritemaxpress(serialObject, maxPress)
function pumpobjwritemaxpress(serialObject, maxPress)
% PUMPOBJWRITEMAXPRESS sets maximum pressure of Jasco pumps
% pumpobjwritemaxpress(serialObject, 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(serialObject, 250) - sets maximum pressure of
% the pump to 250 bar

% Range:

% serialObject = valid serial port object

% maxPress = unsigned number: 0-350


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

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

Contact us