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.

bprobjmanualvalve(serialObject)
function bprobjmanualvalve(serialObject)
% BPROBJMANUALVALVE turns the BPR to manual valve regulation
% bprobjmanualvalve(serialObject) changes valve regulation to manual

% e.g. bprobjclosevalve(serialObject) changes the Jasco BPR valve
% regulation to manual.


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

% gets the current valve status
valveStatus = bprobjreadvalvestatus(serialObject);

% try-catched for robustness
try
    %chooses action depending on the current status
    switch valveStatus
        case {0, 1}
            % its open or closed, so it'll won't work, must turn it to auto
            % first...
            bprobjcomm(serialObject, '#0x24 2')

            % only now can we change it to manual
            bprobjcomm(serialObject, '#23 1')

        case 2
            % its auto-regulated, only need to send it once
            bprobjcomm(serialObject, '#23 1')

        case 3
            % its manually regulated so we don't need to do anything
    end

catch
    % get the new valve status
    newValveStatus = bprobjreadvalvestatus(serialObject);

    % it errored
    error('Unknown valve error - could not close the BPR valve.  Current valve status: %d', newValveStatus)
end

Contact us