Code covered by the BSD License  

Highlights from
Jasco BPR RS232 communication

Jasco BPR RS232 communication

by

 

20 May 2013 (Updated )

Drivers and higher level commands for controlling Jasco BPRs via RS232.

bprobjwritemaxpress(serialObject, maxPress)
function bprobjwritemaxpress(serialObject, maxPress)
% BPROBJWRITEMAXPRESS sets the maximum pressure of Jasco BPRs
% bprobjwritemaxpress(serialObject, maxPress) sets the maximum pressure on Jasco
% back-pressure regulators, where serialObject 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(serialObject, 300) - sets the maximum pressure of
% the BPR on COM5 to 300 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

% converts pressure to the correct units (whatever they are), and rounds
% off
maxPress = round(maxPress * 10);

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

Contact us