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.

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

% e.g. bprobjwritesetpress(serialObject, 100) - sets the pressure of the
% BPR to 100 bar

% Range:

% serialObject = valid serial port object

% setPress = unsigned number: 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 a number from 0 to 350 bar')
end

% converts and rounds the pressure off
setPress = round(setPress * 10);
    
% need to convert number into a hexadecimal string for the bprcomm command
% - sends command
bprobjcomm(serialObject, ['#0x44 ', dec2hex(setPress)])

Contact us