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.

bprobjreadvalvestatus(serialObject)
function status = bprobjreadvalvestatus(serialObject)
% BPROBJREADVALVESTATUS reads the valve status of Jasco BPRs
% status = bprobjreadvalvestatus(serialObject) reads the current valve
% status of Jasco BPRs.  serialObject is the BPR serial object (generated
% by bprobj). The status is returned as 0 (open), 1 (closed), 2
% (regulated), or 3 (manual).

% e.g. bprobjreadvalvestatus(serialObject) - returns the current valve
% status of the BPR e.g. 2.

% Range:

% serialObject = valid serial port object


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

% requests valve status
status = bprobjcomm(serialObject, '#0x1000 0x88');

% splits response into a cell array - the response should be "#0 0
% status"
status = textscan(status, '%s');

% selects out the status and converts it into a number
status = str2double(status{1}{3});

% if the status is larger than 2, its in manual mode
if status > 2
    % changes the status
    status = 3;
end

Contact us