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.

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

% e.g. bprobjreadvalvestatus(bprobj(5)) - returns the current
% valve status of the BPR on COM5 e.g. 2.

% Range:

% BPRObj = valid serial port object


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

% requests valve status
status = bprobjcomm(BPRObj, '#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