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.

bprobjconnect(serialObject)
function bprobjconnect(serialObject)
% BPROBJCONNECT initialises communication with Jasco BPRs
% bprobjconnect(serialObject) initialises communication with Jasco BPRs, given
% serialObject as a valid BPR serial object (generated by bprobj).

% e.g. bprobjconnect(bprobj(5)) - initialises communication with the BPR
% attached to COM5 - the front panel can no longer be used while this is
% the case.

% Range:

% serialObject = valid serial port object


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

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

% opens communication (MLint wrongly reports this as outputting something)
fopen(serialObject)

% Vista needs a brief pause to behave itself correctly - I've left this is
% for XP too, but in case you wanted to shave off that whole 400 ms, you
% could try...BUT old MATLAB versions detect Vista as "Microsoft Windows
% 2000"
%if isempty(strfind(system_dependent('getos'), 'XP'))
pause(0.4)
%end

% sends command
bprobjcomm(serialObject, '#1')

Contact us