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.

bprobjdisconnect(serialObject)
function bprobjdisconnect(serialObject)
% BPROBJDISCONNECT terminates communication with Jasco BPRs
% bprobjdisconnect(serialObject) terminates communication with Jasco BPRs,
% given serialObject as a valid BPR serial object (generated by bprobj).

% e.g. bprobjdisconnect(bprobj(5)) - terminates communication with the BPR
% attached to COM5 - the front panel can now be used as normal, and the
% serialObject is deleted and cleared from memory

% Range:

% serialObject = valid serial port object


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

% error handling
if ~isa(serialObject, 'serial') || ~isvalid(serialObject) || ~strcmp(serialObject.Status, 'open')
    % errors if not a valid serial object or is closed
    error('serial must be a valid open serial object.')
end

% disconnect from RC mode
try
    % send command
    bprobjcomm(serialObject, '#2')
    
catch
    % display a warning if it didn't like it
    warning('bprDisconnect:rcError', 'Did not properly exit RC mode.')
end

% closes communication
fclose(serialObject)

% deletes it
delete(serialObject)

Contact us