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.

bprobjwritesettemp.m
function bprobjwritesettemp(serialObject, setTemp)
% BPROBJWRITESETTEMP sets the temperature of Jasco BPRs
% bprobjwritesettemp(serialObject, setTemp) sets the valve temperature on
% Jasco back-pressure regulators, where serialObject is a valid serial port
% object (generated by bprobj) and setTemp is the temperature in C (number
% from 30-90).

% e.g. bprobjwritesettemp(serialObject, 50) - sets the temperature of
% the BPR to 50 (C).

% Range:

% serialObject = valid serial port object

% setTemp = unsigned number: 30-90


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

% error handling
if ~isscalar(setTemp) || ~isnumeric(setTemp) || setTemp < 30 || setTemp > 90
    % errors
    error('Temperature must be a number from 30 to 90 C')
end

% coverts units and rounds the temperature off
setTemp = round(setTemp * 100);

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

Contact us