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.

bprobjwritemaxpress(BPRObj, maxPress)
function bprobjwritemaxpress(BPRObj, maxPress)
% BPROBJWRITEMAXPRESS sets the maximum pressure of Jasco BPRs
% bprobjwritemaxpress(BPRObj, maxPress) sets the maximum pressure on Jasco
% back-pressure regulators, where BPRObj is a valid serial port object
% (generated by bprobj) and maxPress is the pressure in bar (number from
% 0-350).  The pressure is automatically rounded to the nearest integer.

% e.g. bprobjwritemaxpress(BPRObj(5), 300) - sets the maximum pressure of
% the BPR on COM5 to 300 bar

% Range:

% BPRObj = valid serial port object

% maxPress = unsigned number: 0-350


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

% error handling
if ~isnumberbetween(maxPress, 0, 350)
    % errors
    error('Maximum pressure must be a number from 0 to 350 bar')
end

% changes the maxPress for the next steps
maxPress = roundto(maxPress * 10, 0, true);

% need to convert number into a hexadecimal string for the bprcomm command
% - sends command
bprobjcomm(BPRObj, ['#0x42 ', dec2hex(maxPress)])

Contact us